Skip to content

Commit 1cb4a82

Browse files
author
Aaron Kaplan
committed
Merge remote-tracking branch 'origin/main' into ase_md_npt
2 parents d88b3f5 + e7969e9 commit 1cb4a82

File tree

3 files changed

+101
-26
lines changed

3 files changed

+101
-26
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ docs = [
8181
"sphinx-copybutton==0.5.2",
8282
"sphinx==8.1.3",
8383
"sphinx_design==0.6.1",
84-
"jupyterlab==4.4.4",
84+
"jupyterlab==4.4.5",
8585
]
8686
dev = ["pre-commit>=2.12.1"]
8787
tests = [

src/atomate2/vasp/sets/core.py

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
if TYPE_CHECKING:
1717
from emmet.core.math import Vector3D
1818
from pymatgen.core import Structure
19-
from pymatgen.io.vasp import Kpoints, Outcar, Vasprun
19+
from pymatgen.io.vasp import Kpoints
2020

2121

2222
logger = logging.getLogger(__name__)
@@ -38,31 +38,13 @@ def incar_updates(self) -> dict:
3838
return {"NSW": 99, "LCHARG": False, "ISIF": 3, "IBRION": 2}
3939

4040

41+
@dataclass
4142
class RelaxConstVolSetGenerator(VaspInputGenerator):
4243
"""Class to generate VASP constant volume relaxation input sets."""
4344

44-
def get_incar_updates(
45-
self,
46-
structure: Structure,
47-
prev_incar: dict = None,
48-
bandgap: float = None,
49-
vasprun: Vasprun = None,
50-
outcar: Outcar = None,
51-
) -> dict:
52-
"""Get updates to the INCAR for a constant volume relaxation job.
53-
54-
Parameters
55-
----------
56-
structure
57-
A structure.
58-
prev_incar
59-
An incar from a previous calculation.
60-
bandgap
61-
The band gap.
62-
vasprun
63-
A vasprun from a previous calculation.
64-
outcar
65-
An outcar from a previous calculation.
45+
@property
46+
def incar_updates(self) -> dict:
47+
"""Get updates to the INCAR for a tight constant volume relaxation job.
6648
6749
Returns
6850
-------
@@ -104,7 +86,7 @@ class TightRelaxConstVolSetGenerator(VaspInputGenerator):
10486

10587
@property
10688
def incar_updates(self) -> dict:
107-
"""Get updates to the INCAR for a static VASP job.
89+
"""Get updates to the INCAR for a constant volume tight relaxation job.
10890
10991
Returns
11092
-------

tests/vasp/test_sets.py

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,21 @@
22
from pymatgen.core import Lattice, Species, Structure
33
from pymatgen.io.vasp.sets import MPScanRelaxSet
44

5-
from atomate2.vasp.sets.core import StaticSetGenerator
5+
from atomate2.vasp.sets.core import (
6+
ElectronPhononSetGenerator,
7+
HSEBSSetGenerator,
8+
HSERelaxSetGenerator,
9+
HSEStaticSetGenerator,
10+
HSETightRelaxSetGenerator,
11+
LobsterTightStaticSetGenerator,
12+
MDSetGenerator,
13+
NonSCFSetGenerator,
14+
RelaxConstVolSetGenerator,
15+
RelaxSetGenerator,
16+
StaticSetGenerator,
17+
TightRelaxConstVolSetGenerator,
18+
TightRelaxSetGenerator,
19+
)
620

721

822
@pytest.fixture(scope="module")
@@ -199,3 +213,82 @@ def test_set_kspacing_bandgap_tol_and_auto_ismear(
199213

200214
actual = {key: incar[key] for key in expected_params}
201215
assert actual == pytest.approx(expected_params)
216+
217+
218+
def test_core(struct_no_magmoms):
219+
input_gen = RelaxSetGenerator()
220+
incar = input_gen.get_input_set(struct_no_magmoms, potcar_spec=True)["INCAR"]
221+
assert incar["ISIF"] == 3
222+
assert incar["IBRION"] == 2
223+
224+
input_gen = RelaxConstVolSetGenerator()
225+
incar = input_gen.get_input_set(struct_no_magmoms, potcar_spec=True)["INCAR"]
226+
assert incar["ISIF"] == 2
227+
assert incar["IBRION"] == 2
228+
assert incar["EDIFF"] == 1e-5
229+
230+
input_gen = TightRelaxSetGenerator()
231+
incar = input_gen.get_input_set(struct_no_magmoms, potcar_spec=True)["INCAR"]
232+
assert incar["ISIF"] == 3
233+
assert incar["IBRION"] == 2
234+
assert incar["EDIFF"] == 1e-7
235+
236+
input_gen = TightRelaxConstVolSetGenerator()
237+
incar = input_gen.get_input_set(struct_no_magmoms, potcar_spec=True)["INCAR"]
238+
assert incar["ISIF"] == 2
239+
assert incar["IBRION"] == 2
240+
assert incar["EDIFF"] == 1e-7
241+
242+
input_gen = StaticSetGenerator()
243+
incar = input_gen.get_input_set(struct_no_magmoms, potcar_spec=True)["INCAR"]
244+
assert incar["ISMEAR"] == -5
245+
assert incar["NSW"] == 0
246+
247+
input_gen = NonSCFSetGenerator()
248+
incar = input_gen.get_input_set(struct_no_magmoms, potcar_spec=True)["INCAR"]
249+
assert incar["NSW"] == 0
250+
assert incar["ISYM"] == 0
251+
252+
input_gen = HSERelaxSetGenerator()
253+
incar = input_gen.get_input_set(struct_no_magmoms, potcar_spec=True)["INCAR"]
254+
assert incar["PRECFOCK"] == "Fast"
255+
assert incar["HFSCREEN"] == 0.2
256+
assert incar["EDIFF"] == 1e-5
257+
258+
input_gen = HSETightRelaxSetGenerator()
259+
incar = input_gen.get_input_set(struct_no_magmoms, potcar_spec=True)["INCAR"]
260+
assert incar["PRECFOCK"] == "Fast"
261+
assert incar["HFSCREEN"] == 0.2
262+
assert incar["EDIFF"] == 1e-7
263+
264+
input_gen = HSEStaticSetGenerator()
265+
incar = input_gen.get_input_set(struct_no_magmoms, potcar_spec=True)["INCAR"]
266+
assert incar["PRECFOCK"] == "Fast"
267+
assert incar["HFSCREEN"] == 0.2
268+
assert incar["EDIFF"] == 1e-5
269+
assert incar["NSW"] == 0
270+
271+
input_gen = HSEBSSetGenerator()
272+
incar = input_gen.get_input_set(struct_no_magmoms, potcar_spec=True)["INCAR"]
273+
assert incar["PRECFOCK"] == "Fast"
274+
assert incar["HFSCREEN"] == 0.2
275+
assert incar["EDIFF"] == 1e-5
276+
assert incar["NSW"] == 0
277+
assert incar["ISMEAR"] == 0
278+
279+
input_gen = ElectronPhononSetGenerator()
280+
incar = input_gen.get_input_set(struct_no_magmoms, potcar_spec=True)["INCAR"]
281+
assert incar["PHON_NSTRUCT"] == 0
282+
assert incar["NSW"] == 1
283+
assert incar["ISMEAR"] == 0
284+
285+
input_gen = MDSetGenerator()
286+
incar = input_gen.get_input_set(struct_no_magmoms, potcar_spec=True)["INCAR"]
287+
assert incar["TEBEG"] == 300
288+
assert incar["TEEND"] == 300
289+
290+
input_gen = LobsterTightStaticSetGenerator()
291+
incar = input_gen.get_input_set(struct_no_magmoms, potcar_spec=True)["INCAR"]
292+
assert incar["EDIFF"] == 1e-7
293+
assert incar["ISYM"] == 0
294+
assert incar["LWAVE"] is True

0 commit comments

Comments
 (0)