-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #532 from materialsproject/matpes
Add MatPES GGA and r2SCAN static makers
- Loading branch information
Showing
55 changed files
with
490 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
""" | ||
Module defining MatPES flows. | ||
In case of questions, consult @janosh or @esoteric-ephemera. Makes PBE + r2SCAN | ||
cheaper than running both separately. | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass, field | ||
from typing import TYPE_CHECKING | ||
|
||
from jobflow import Flow, Maker | ||
|
||
from atomate2.vasp.jobs.matpes import MatPesGGAStaticMaker, MatPesMetaGGAStaticMaker | ||
|
||
if TYPE_CHECKING: | ||
from pathlib import Path | ||
|
||
from pymatgen.core import Structure | ||
|
||
|
||
@dataclass | ||
class MatPesGGAPlusMetaGGAStaticMaker(Maker): | ||
"""MatPES flow doing a GGA static followed by meta-GGA static. | ||
Uses the GGA WAVECAR to speed up electronic convergence on the meta-GGA static. | ||
Parameters | ||
---------- | ||
name : str | ||
Name of the flows produced by this maker. | ||
static1 : .BaseVaspMaker | ||
Maker to generate the first VASP static. | ||
static2 : .BaseVaspMaker | ||
Maker to generate the second VASP static. | ||
""" | ||
|
||
name: str = "MatPES GGA plus meta-GGA static" | ||
static1: Maker | None = field(default_factory=MatPesGGAStaticMaker) | ||
static2: Maker = field( | ||
default_factory=lambda: MatPesMetaGGAStaticMaker( | ||
# could copy CHGCAR from GGA to meta-GGA directory too but is redundant | ||
# since VASP can reconstruct it from WAVECAR | ||
copy_vasp_kwargs={"additional_vasp_files": ("WAVECAR",)} | ||
) | ||
) | ||
|
||
def make(self, structure: Structure, prev_vasp_dir: str | Path | None = None): | ||
""" | ||
Create a flow with two chained statics. | ||
Parameters | ||
---------- | ||
structure : .Structure | ||
A pymatgen structure object. | ||
prev_vasp_dir : str or Path or None | ||
A previous VASP calculation directory to copy output files from. | ||
Returns | ||
------- | ||
Flow | ||
A flow containing two statics. | ||
""" | ||
static1 = self.static1.make(structure, prev_vasp_dir=prev_vasp_dir) | ||
static2 = self.static2.make(structure, prev_vasp_dir=static1.output.dir_name) | ||
return Flow([static1, static2], output=static2.output, name=self.name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
""" | ||
Module defining MatPES job makers. | ||
In case of questions, contact @janosh or @shyuep. | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass, field | ||
from typing import TYPE_CHECKING | ||
|
||
from atomate2.vasp.jobs.base import BaseVaspMaker | ||
from atomate2.vasp.sets.matpes import ( | ||
MatPesGGAStaticSetGenerator, | ||
MatPesMetaGGAStaticSetGenerator, | ||
) | ||
|
||
if TYPE_CHECKING: | ||
from atomate2.vasp.sets.base import VaspInputGenerator | ||
|
||
|
||
@dataclass | ||
class MatPesGGAStaticMaker(BaseVaspMaker): | ||
""" | ||
Maker to create VASP static job using r2SCAN by default. | ||
Parameters | ||
---------- | ||
name : str | ||
The job name. | ||
input_set_generator : .VaspInputGenerator | ||
A generator used to make the input set. | ||
write_input_set_kwargs : dict | ||
Keyword arguments that will get passed to :obj:`.write_vasp_input_set`. | ||
copy_vasp_kwargs : dict | ||
Keyword arguments that will get passed to :obj:`.copy_vasp_outputs`. | ||
run_vasp_kwargs : dict | ||
Keyword arguments that will get passed to :obj:`.run_vasp`. | ||
task_document_kwargs : dict | ||
Keyword arguments that will get passed to :obj:`.TaskDoc.from_directory`. | ||
stop_children_kwargs : dict | ||
Keyword arguments that will get passed to :obj:`.should_stop_children`. | ||
write_additional_data : dict | ||
Additional data to write to the current directory. Given as a dict of | ||
{filename: data}. Note that if using FireWorks, dictionary keys cannot contain | ||
the "." character which is typically used to denote file extensions. To avoid | ||
this, use the ":" character, which will automatically be converted to ".". E.g. | ||
``{"my_file:txt": "contents of the file"}``. | ||
""" | ||
|
||
name: str = "MatPES GGA static" | ||
input_set_generator: VaspInputGenerator = field( | ||
default_factory=MatPesGGAStaticSetGenerator | ||
) | ||
inherit_incar: bool = False | ||
|
||
|
||
@dataclass | ||
class MatPesMetaGGAStaticMaker(BaseVaspMaker): | ||
""" | ||
Maker to create VASP static job using r2SCAN by default. | ||
Parameters | ||
---------- | ||
name : str | ||
The job name. | ||
input_set_generator : .VaspInputGenerator | ||
A generator used to make the input set. | ||
write_input_set_kwargs : dict | ||
Keyword arguments that will get passed to :obj:`.write_vasp_input_set`. | ||
copy_vasp_kwargs : dict | ||
Keyword arguments that will get passed to :obj:`.copy_vasp_outputs`. | ||
run_vasp_kwargs : dict | ||
Keyword arguments that will get passed to :obj:`.run_vasp`. | ||
task_document_kwargs : dict | ||
Keyword arguments that will get passed to :obj:`.TaskDoc.from_directory`. | ||
stop_children_kwargs : dict | ||
Keyword arguments that will get passed to :obj:`.should_stop_children`. | ||
write_additional_data : dict | ||
Additional data to write to the current directory. Given as a dict of | ||
{filename: data}. Note that if using FireWorks, dictionary keys cannot contain | ||
the "." character which is typically used to denote file extensions. To avoid | ||
this, use the ":" character, which will automatically be converted to ".". E.g. | ||
``{"my_file:txt": "contents of the file"}``. | ||
""" | ||
|
||
name: str = "MatPES meta-GGA static" | ||
input_set_generator: VaspInputGenerator = field( | ||
default_factory=MatPesMetaGGAStaticSetGenerator | ||
) | ||
inherit_incar: bool = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
""" | ||
Module defining MatPES input set generators. | ||
In case of questions, contact @janosh or @shyuep. | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass, field | ||
from typing import TYPE_CHECKING | ||
|
||
from monty.serialization import loadfn | ||
from pkg_resources import resource_filename | ||
|
||
from atomate2.vasp.sets.core import StaticSetGenerator | ||
|
||
if TYPE_CHECKING: | ||
from pymatgen.core import Structure | ||
from pymatgen.io.vasp import Outcar, Vasprun | ||
|
||
|
||
# POTCAR section comes from PARENT but atomate2 does not support inheritance yet | ||
_BASE_MATPES_PBE_STATIC_SET_NO_POTCAR = loadfn( | ||
resource_filename("pymatgen.io.vasp", "MatPESStaticSet.yaml") | ||
) | ||
_BASE_PBE54_SET = loadfn(resource_filename("pymatgen.io.vasp", "PBE54Base.yaml")) | ||
_BASE_MATPES_PBE_STATIC_SET = { | ||
**_BASE_PBE54_SET, | ||
**_BASE_MATPES_PBE_STATIC_SET_NO_POTCAR, | ||
} | ||
|
||
|
||
@dataclass | ||
class MatPesGGAStaticSetGenerator(StaticSetGenerator): | ||
"""Class to generate MP-compatible VASP GGA static input sets.""" | ||
|
||
config_dict: dict = field(default_factory=lambda: _BASE_MATPES_PBE_STATIC_SET) | ||
auto_ismear: bool = False | ||
auto_kspacing: bool = True | ||
user_incar_settings: dict = field( | ||
# ensure _set_kspacing doesn't override input set ISMEAR | ||
default_factory=lambda: {"ISMEAR": 0, "SIGMA": 0.05} | ||
) | ||
|
||
|
||
@dataclass | ||
class MatPesMetaGGAStaticSetGenerator(StaticSetGenerator): | ||
"""Class to generate MP-compatible VASP GGA static input sets.""" | ||
|
||
config_dict: dict = field(default_factory=lambda: _BASE_MATPES_PBE_STATIC_SET) | ||
auto_ismear: bool = False | ||
auto_kspacing: bool = True | ||
user_incar_settings: dict = field( | ||
# ensure _set_kspacing doesn't override input set ISMEAR | ||
default_factory=lambda: {"ISMEAR": 0, "SIGMA": 0.05} | ||
) | ||
|
||
def get_incar_updates( | ||
self, | ||
structure: Structure, | ||
prev_incar: dict = None, | ||
bandgap: float = None, | ||
vasprun: Vasprun = None, | ||
outcar: Outcar = None, | ||
) -> dict: | ||
""" | ||
Get updates to the INCAR for this calculation type. | ||
Parameters | ||
---------- | ||
structure | ||
A structure. | ||
prev_incar | ||
An incar from a previous calculation. | ||
bandgap | ||
The band gap. | ||
vasprun | ||
A vasprun from a previous calculation. | ||
outcar | ||
An outcar from a previous calculation. | ||
Returns | ||
------- | ||
dict | ||
A dictionary of updates to apply. | ||
""" | ||
return {"METAGGA": "R2SCAN", "ALGO": "ALL", "GGA": None} # unset GGA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/inputs/INCAR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
ALGO = Normal | ||
EDIFF = 1e-05 | ||
ENAUG = 1360 | ||
ENCUT = 680 | ||
GGA = Pe | ||
ISMEAR = 0 | ||
ISPIN = 2 | ||
KSPACING = 0.22 | ||
LAECHG = True | ||
LASPH = True | ||
LCHARG = True | ||
LMAXMIX = 6 | ||
LMIXTAU = True | ||
LORBIT = 11 | ||
LREAL = False | ||
LWAVE = False | ||
NELM = 200 | ||
NSW = 0 | ||
PREC = Accurate | ||
SIGMA = 0.05 |
10 changes: 10 additions & 0 deletions
10
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/inputs/POSCAR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Si2 | ||
1.0 | ||
3.3488982826904379 0.0000000000000000 1.9334873250000004 | ||
1.1162994275634794 3.1573715802591895 1.9334873250000004 | ||
0.0000000000000000 0.0000000000000000 3.8669746500000000 | ||
Si | ||
2 | ||
direct | ||
0.2500000000000000 0.2500000000000000 0.2500000000000000 Si | ||
0.0000000000000000 0.0000000000000000 0.0000000000000000 Si |
1 change: 1 addition & 0 deletions
1
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/inputs/POTCAR.spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Si |
Binary file added
BIN
+162 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/CONTCAR.gz
Binary file not shown.
Binary file added
BIN
+15.8 KB
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/DOSCAR.gz
Binary file not shown.
Binary file added
BIN
+4.71 KB
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/EIGENVAL.gz
Binary file not shown.
Binary file added
BIN
+321 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/IBZKPT.gz
Binary file not shown.
Binary file added
BIN
+196 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/INCAR.gz
Binary file not shown.
Binary file added
BIN
+201 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/INCAR.orig.gz
Binary file not shown.
Binary file added
BIN
+497 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/OSZICAR.gz
Binary file not shown.
Binary file added
BIN
+22 KB
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/OUTCAR.gz
Binary file not shown.
Binary file added
BIN
+138 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/PCDAT.gz
Binary file not shown.
Binary file added
BIN
+143 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/POSCAR.gz
Binary file not shown.
Binary file added
BIN
+148 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/POSCAR.orig.gz
Binary file not shown.
Binary file added
BIN
+29.2 KB
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/PROCAR.gz
Binary file not shown.
Binary file added
BIN
+27 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/REPORT.gz
Binary file not shown.
Binary file added
BIN
+28 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/WAVECAR.gz
Binary file not shown.
Binary file added
BIN
+152 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/XDATCAR.gz
Binary file not shown.
Binary file added
BIN
+332 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/custodian.json.gz
Binary file not shown.
Empty file.
Binary file added
BIN
+1.52 KB
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/vasp.out.gz
Binary file not shown.
Binary file added
BIN
+43.9 KB
tests/test_data/vasp/matpes_pbe_r2scan_flow/pbe_static/outputs/vasprun.xml.gz
Binary file not shown.
20 changes: 20 additions & 0 deletions
20
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/inputs/INCAR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
ALGO = All | ||
EDIFF = 1e-05 | ||
ENAUG = 1360.0 | ||
ENCUT = 680 | ||
ISMEAR = 0 | ||
ISPIN = 2 | ||
KSPACING = 0.28754316109307704 | ||
LAECHG = True | ||
LASPH = True | ||
LCHARG = True | ||
LMAXMIX = 6 | ||
LMIXTAU = True | ||
LORBIT = 11 | ||
LREAL = False | ||
LWAVE = False | ||
METAGGA = R2scan | ||
NELM = 200 | ||
NSW = 0 | ||
PREC = Accurate | ||
SIGMA = 0.05 |
10 changes: 10 additions & 0 deletions
10
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/inputs/POSCAR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Si2 | ||
1.0 | ||
3.3488982826904379 0.0000000000000000 1.9334873250000004 | ||
1.1162994275634794 3.1573715802591895 1.9334873250000004 | ||
0.0000000000000000 0.0000000000000000 3.8669746500000000 | ||
Si | ||
2 | ||
direct | ||
0.2500000000000000 0.2500000000000000 0.2500000000000000 Si | ||
0.0000000000000000 0.0000000000000000 0.0000000000000000 Si |
1 change: 1 addition & 0 deletions
1
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/inputs/POTCAR.spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Si |
Binary file added
BIN
+162 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/CONTCAR.gz
Binary file not shown.
Binary file added
BIN
+15.7 KB
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/DOSCAR.gz
Binary file not shown.
Binary file added
BIN
+2.09 KB
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/EIGENVAL.gz
Binary file not shown.
Binary file added
BIN
+215 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/IBZKPT.gz
Binary file not shown.
Binary file added
BIN
+216 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/INCAR.gz
Binary file not shown.
Binary file added
BIN
+221 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/INCAR.orig.gz
Binary file not shown.
Binary file added
BIN
+539 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/OSZICAR.gz
Binary file not shown.
Binary file added
BIN
+19.8 KB
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/OUTCAR.gz
Binary file not shown.
Binary file added
BIN
+138 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/PCDAT.gz
Binary file not shown.
Binary file added
BIN
+143 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/POSCAR.gz
Binary file not shown.
Binary file added
BIN
+148 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/POSCAR.orig.gz
Binary file not shown.
Binary file added
BIN
+12.7 KB
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/PROCAR.gz
Binary file not shown.
Binary file added
BIN
+27 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/REPORT.gz
Binary file not shown.
Binary file added
BIN
+28 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/WAVECAR.gz
Binary file not shown.
Binary file added
BIN
+152 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/XDATCAR.gz
Binary file not shown.
Binary file added
BIN
+332 Bytes
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/custodian.json.gz
Binary file not shown.
Empty file.
Binary file added
BIN
+2.07 KB
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/vasp.out.gz
Binary file not shown.
Binary file added
BIN
+30.5 KB
tests/test_data/vasp/matpes_pbe_r2scan_flow/r2scan_static/outputs/vasprun.xml.gz
Binary file not shown.
Oops, something went wrong.