Skip to content

Commit fad9396

Browse files
Transition to pymatgen VASP input sets (#854)
* complete refactor to PMG input sets for vasp * bug fixes for input set change * linting * move type import to type_checking block * remove duplicated MP yaml files * drop dict.get(key, None) -> dict.get(key) * change inheritance slightly, install pmg from pr * linting * revert vis["INCAR"] --> vis.incar * fix lobster interface * remove lobster test file * revert pymatgen testing install now that separate pr is merged * try to force pip install of pymatgen in testing * force pmg to install from git * improve check_poscar method to account for reordering of sites in POSCAR * linting * remove POTCARs and replace with spec where appropriate; remove unused vaspout.h5 files which contain full POTCARs * restore missing test file, but only header of POTCAR * remove POTCAR.orig.spec files * gzip test input files * linting * slightly refactor MP sets * precommit * slight matpes modification * precommit * revert gh workflow dependency install * update changelog * fix pymatgen pip version install for strict * bump pymatgen to v2024.6.4 * refactor MP and MatPES VASP input sets to inherit directly from pymatgen equivalents * linting * further cleanup matpes r2scan set * change ase to use most recent pypi release * add missing pip install line * revert lobster vis potcar changes * remove version conflict * remove version conflict * remove version conflict * replace lobster sets with pymatgen equivalents * precommit * add ispin to lobster tightstatitsetgenerator * remove BaseVasp.yaml to rely on inheritance from MP input sets * precommit * remove temp test file * move matpes jobs/flow to pymatgen sets, mark matpes sets for deprecation * lint * move mp sets fully to pmg, add deprecation warnings to existing atomate2 mp sets * remove mp set dependence from tests * precommit * add bandgap_tol options to vasp.test_sets * remove todo from tests.vasp.flows.test_mp * add pytest.warns check for deprecated mp sets * revert docstr changes * move deprecation warnings from __post_init__ to class warning before: <string>:31: FutureWarning: __post_init__ is deprecated, and will be removed on 2025-01-01 Use MPRelaxSet in pymatgen.io.vasp.sets instead. warning after: <string>:31: FutureWarning: MPGGARelaxSetGenerator is deprecated, and will be removed on 2025-01-01 Use MPRelaxSet in pymatgen.io.vasp.sets instead. * pin monty==2024.7.30 in deps and strict * add kludge for monty zpath * precommit * extend monty fix to vasp tests * precommit --------- Co-authored-by: Janosh Riebesell <[email protected]>
1 parent 270408f commit fad9396

File tree

1,304 files changed

+643
-10737
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,304 files changed

+643
-10737
lines changed

.github/workflows/testing.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ jobs:
6161
python -m pip install --upgrade pip
6262
mkdir -p ~/.abinit/pseudos
6363
cp -r tests/test_data/abinit/pseudos/ONCVPSP-PBE-SR-PDv0.4 ~/.abinit/pseudos
64-
# ase needed to get FrechetCellFilter used by ML force fields
65-
pip install git+https://gitlab.com/ase/ase
6664
pip install .[strict,tests,abinit]
6765
pip install torch-runstats
6866
pip install --no-deps nequip==0.5.6
@@ -100,8 +98,6 @@ jobs:
10098
- name: Install dependencies
10199
run: |
102100
python -m pip install --upgrade pip
103-
# ase needed to get FrechetCellFilter used by ML force fields
104-
pip install git+https://gitlab.com/ase/ase
105101
pip install .[strict,docs]
106102
107103
- name: Build

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Change log
22

3+
## v0.0.15
4+
5+
## New Features 🎉
6+
* Transition VASP calculations to use input sets defined in pymatgen by @esoteric-ephemera in https://github.com/materialsproject/atomate2/pull/854
7+
8+
### Bug Fixes 🐛
9+
* Increase k-point density for MP GGA static calculations to close issue https://github.com/materialsproject/atomate2/issues/844 by @esoteric-ephemera in https://github.com/materialsproject/atomate2/pull/854
10+
* Adds missing MAGMOMs for MatPES jobs by @esoteric-ephemera in https://github.com/materialsproject/atomate2/pull/854
11+
312
## v0.0.14
413

514
### New Features 🎉

pyproject.toml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ dependencies = [
3030
"custodian>=2024.4.18",
3131
"emmet-core==0.82.2",
3232
"jobflow>=0.1.11",
33-
"monty>=2024.2.2",
33+
"monty>=2024.7.30",
3434
"numpy",
3535
"pydantic-settings>=2.0.3",
3636
"pydantic>=2.0.1",
37-
"pymatgen>=2024.4.13",
37+
"pymatgen>=2024.6.4",
3838
]
3939

4040
[project.optional-dependencies]
@@ -50,7 +50,7 @@ defects = [
5050
"python-ulid",
5151
]
5252
forcefields = [
53-
"ase>=3.22.1",
53+
"ase>=3.23.0",
5454
"calorine<=2.2.1",
5555
"chgnet>=0.2.2",
5656
"mace-torch>=0.3.3",
@@ -81,9 +81,7 @@ tests = [
8181
]
8282
strict = [
8383
"PyYAML==6.0.1",
84-
# must use >= for ase to not uninstall main branch install in CI
85-
# last known working commit: https://gitlab.com/ase/ase@2bab58f4e
86-
"ase>=3.22.1",
84+
"ase==3.23.0",
8785
"calorine==2.2.1",
8886
"cclib==1.8.1",
8987
"chgnet==0.3.8",
@@ -96,7 +94,7 @@ strict = [
9694
"lobsterpy==0.4.5",
9795
"mace-torch>=0.3.3",
9896
"matgl==1.1.2",
99-
"monty==2024.5.24",
97+
"monty==2024.7.30",
10098
"mp-api==0.41.2",
10199
"numpy",
102100
"phonopy==2.26.6",

src/atomate2/abinit/sets/base.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,10 @@ def get_input_set(
326326
structure : Structure
327327
Pymatgen Structure object.
328328
restart_from : str or Path or list or tuple
329-
Directory (as a str or Path) or list/tuple of 1 directory (as a str
330-
or Path) to restart from.
329+
Directory or list/tuple of 1 directory to restart from.
331330
prev_outputs : str or Path or list or tuple
332-
Directory (as a str or Path) or list/tuple of directories (as a str
333-
or Path) needed as dependencies for the AbinitInputSet generated.
331+
Directory or list/tuple of directories needed as dependencies for the
332+
AbinitInputSet generated.
334333
"""
335334
# Get the pseudos as a PseudoTable
336335
pseudos = as_pseudo_table(self.pseudos) if self.pseudos else None

src/atomate2/abinit/utils/history.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def get_total_run_time(self) -> Any:
195195
"""Get the total run time based summing the abinit stop event run times."""
196196
total_run_time = 0
197197
for te in self.get_events_by_types(JobEvent.ABINIT_STOP):
198-
run_time = te.details.get("run_time", None)
198+
run_time = te.details.get("run_time")
199199
if run_time:
200200
total_run_time += run_time
201201

src/atomate2/common/files.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ def delete_files(
9797
The hostname used to specify a remote filesystem. Can be given as either
9898
"username@host" or just "host" in which case the username will be
9999
inferred from the current user. If ``None``, the local filesystem will be used.
100-
include_files : None or list of (str or Path)
100+
include_files : None or list of (str or .Path)
101101
Filenames to include as a list of str or Path objects given relative to
102102
directory. Glob file paths are supported, e.g. "\*.dat". If ``None``, all files
103103
in the directory will be deleted.
104-
exclude_files : None or list of (str or Path)
104+
exclude_files : None or list of (str or .Path)
105105
Filenames to exclude. Supports glob file matching, e.g., "\*.dat".
106106
allow_missing : bool
107107
Whether to error if a file in ``include_files`` is not present in the directory.
@@ -188,11 +188,11 @@ def gzip_files(
188188
The hostname used to specify a remote filesystem. Can be given as either
189189
"username@host" or just "host" in which case the username will be
190190
inferred from the current user. If ``None``, the local filesystem will be used.
191-
include_files : None or list of (str or Path)
191+
include_files : None or list of (str or .Path)
192192
Filenames to include as a list of str or Path objects given relative to
193193
directory. Glob file paths are supported, e.g. "\*.dat". If ``None``, all files
194194
in the directory will be gzipped.
195-
exclude_files : None or list of (str or Path)
195+
exclude_files : None or list of (str or .Path)
196196
Filenames to exclude. Supports glob file matching, e.g., "\*.dat".
197197
allow_missing : bool
198198
Whether to error if a file in ``include_files`` is not present in the directory.
@@ -241,11 +241,11 @@ def gunzip_files(
241241
The hostname used to specify a remote filesystem. Can be given as either
242242
"username@host" or just "host" in which case the username will be
243243
inferred from the current user. If ``None``, the local filesystem will be used.
244-
include_files : None or list of (str or Path)
244+
include_files : None or list of (str or .Path)
245245
Filenames to include as a list of str or Path objects given relative to
246246
directory. Glob file paths are supported, e.g. "\*.dat". If ``None``, all
247247
gzipped files in the directory will be gunzipped.
248-
exclude_files : None or list of (str or Path)
248+
exclude_files : None or list of (str or .Path)
249249
Filenames to exclude. Supports glob file matching, e.g., "\*.dat".
250250
allow_missing : bool
251251
Whether to error if a file in ``include_files`` is not present in the directory.
@@ -287,11 +287,11 @@ def find_and_filter_files(
287287
A file client.
288288
directory : str or Path
289289
A directory in which to find files.
290-
include_files : None or list of (str or Path)
290+
include_files : None or list of (str or .Path)
291291
Filenames to include as a list of str or Path objects given relative to
292292
directory. Glob file paths are supported, e.g. "\*.dat". If ``None``, all files
293293
in the source directory will be returned.
294-
exclude_files : None or list of (str or Path)
294+
exclude_files : None or list of (str or .Path)
295295
Filenames to exclude. Supports glob file matching, e.g., "\*.dat".
296296
host : str or None
297297
A hostname used to specify a remote filesystem. Can be given as either

src/atomate2/common/jobs/defect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ def get_defect_entry(charge_state_summary: dict, bulk_summary: dict) -> list[dic
460460
"bulk_dir_name": bulk_dir_name,
461461
"bulk_locpot": bulk_locpot,
462462
"bulk_uuid": bulk_summary.get("uuid"),
463-
"defect_uuid": qq_summary.get("uuid", None),
463+
"defect_uuid": qq_summary.get("uuid"),
464464
}
465465
)
466466
return defect_ent_res

src/atomate2/cp2k/jobs/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class BaseCp2kMaker(Maker):
9292
----------
9393
name : str
9494
The job name.
95-
input_set_generator : .VaspInputGenerator
95+
input_set_generator : .Cp2kInputGenerator
9696
A generator used to make the input set.
9797
write_input_set_kwargs : dict
9898
Keyword arguments that will get passed to :obj:`.write_cp2k_input_set`.

src/atomate2/lobster/schemas.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
from emmet.core.structure import StructureMetadata
1212
from monty.dev import requires
1313
from monty.json import MontyDecoder, jsanitize
14-
from monty.os.path import zpath
14+
15+
# TODO: remove this kludge when monty is fixed
16+
from monty.os.path import zpath as monty_zpath
1517
from pydantic import BaseModel, Field
1618
from pymatgen.core import Structure
1719
from pymatgen.electronic_structure.cohp import Cohp, CompleteCohp
@@ -45,6 +47,11 @@
4547
logger = logging.getLogger(__name__)
4648

4749

50+
def zpath(pathname: Union[str, Path]) -> str:
51+
"""Kludge to fix monty zpath bug."""
52+
return monty_zpath(str(pathname))
53+
54+
4855
class LobsteroutModel(BaseModel):
4956
"""Definition of computational settings from the LOBSTER computation."""
5057

src/atomate2/vasp/files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,4 @@ def write_vasp_input_set(
201201
Path(filename).unlink()
202202

203203
logger.info("Writing VASP input set.")
204-
vis.write_input(directory, potcar_spec=potcar_spec, **kwargs)
204+
vis.write_input(directory, **kwargs)

0 commit comments

Comments
 (0)