Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Materials Project GGA and meta-GGA workflows #504

Merged
merged 162 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from 127 commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
0d30189
Initial attempt at MP workflows
Andrew-S-Rosen Jun 2, 2023
892c911
First attempt
Andrew-S-Rosen Jun 2, 2023
2dab928
Remove MAGMOM.yaml
Andrew-S-Rosen Jun 2, 2023
230e504
drop added **kwargs from RelaxSetGenerator.get_incar_updates() since …
janosh Jun 2, 2023
56b0fa2
black .
Andrew-S-Rosen Jun 2, 2023
aceeb11
Merge remote-tracking branch 'origin/materialsproject' into materials…
Andrew-S-Rosen Jun 2, 2023
a7a3b8f
Remove unused function
Andrew-S-Rosen Jun 2, 2023
7e47522
Fix __all__
Andrew-S-Rosen Jun 2, 2023
c08f549
Remove sets/mp.py
Andrew-S-Rosen Jun 2, 2023
18c0d20
Fix ISMEAR and SIGMA
Andrew-S-Rosen Jun 2, 2023
0003b28
Fix imports
Andrew-S-Rosen Jun 2, 2023
01f2000
More robust KSPACING
Andrew-S-Rosen Jun 2, 2023
9323435
Fix linting
Andrew-S-Rosen Jun 2, 2023
1fcff17
Fix linting
Andrew-S-Rosen Jun 2, 2023
6692dfe
fix ruff
janosh Jun 2, 2023
5927eed
mv tests/vasp/flows/test_phonon{,s}.py to match module names vasp/job…
janosh Jun 2, 2023
493b4c6
fix self.input_set_generator.config_dict["user_incar_settings"].update()
janosh Jun 2, 2023
cea4d28
rename prerelax_maker to pre_relax_maker
janosh Jun 2, 2023
4eb86b5
fix MPRelaxR2SCANGenerator arg type
janosh Jun 2, 2023
c7bcb82
fix passing bandgap estimate for kspacing from MPPreRelaxMaker to MPR…
janosh Jun 2, 2023
c98cf7c
add module tests/vasp/flows/test_mp.py for soon-to-come MP workflow t…
janosh Jun 2, 2023
cbab233
add BaseVaspMaker.make() return type and doc str
janosh Jun 3, 2023
9374e93
add bandgap_tol: float = 1e-4 to MPRelaxMaker.make()
janosh Jun 3, 2023
d9bfa2c
Copy CHGCAR etc.
Andrew-S-Rosen Jun 4, 2023
e033dc0
Update class name
Andrew-S-Rosen Jun 4, 2023
a9355b6
Fix tests
Andrew-S-Rosen Jun 4, 2023
d470fd7
Address Ryan's comments
Andrew-S-Rosen Jun 4, 2023
01b8571
Add missing type hints
Andrew-S-Rosen Jun 4, 2023
8b25884
Fix docstring
Andrew-S-Rosen Jun 4, 2023
c49668e
Fix docstring
Andrew-S-Rosen Jun 4, 2023
bffeac0
fix bad return value in doc str (my bad)
janosh Jun 4, 2023
090b658
Make clearer the naming convention
Andrew-S-Rosen Jun 4, 2023
1d7f5dc
Merge remote-tracking branch 'origin/materialsproject' into materials…
Andrew-S-Rosen Jun 4, 2023
66fdd09
Fix bad variable name
Andrew-S-Rosen Jun 4, 2023
79d6a45
Remove optional static at the end
Andrew-S-Rosen Jun 4, 2023
c03293b
refactor _get_kspacing_params, more specific bandgap_tol doc str
janosh Jun 4, 2023
ad0a4da
Don't make the pre-relax optional
Andrew-S-Rosen Jun 4, 2023
ad59343
Merge remote-tracking branch 'origin/materialsproject' into materials…
Andrew-S-Rosen Jun 4, 2023
b216ad0
Clarify docstring
Andrew-S-Rosen Jun 4, 2023
cffe86a
Remove unused variables
Andrew-S-Rosen Jun 4, 2023
93d329b
Add _self_maxtau fix
Andrew-S-Rosen Jun 4, 2023
34c2f79
Add LMAXTAU comment
Andrew-S-Rosen Jun 4, 2023
ab7f6a6
update MPMetaGGARelax doc str
janosh Jun 4, 2023
0fde3e8
Better handling of LMAXMIX/LMAXTAU
Andrew-S-Rosen Jun 4, 2023
d6bd319
Merge remote-tracking branch 'origin/materialsproject' into materials…
Andrew-S-Rosen Jun 4, 2023
16839ba
Fix bad var name
Andrew-S-Rosen Jun 4, 2023
ee39939
Fix LMAXTAU
Andrew-S-Rosen Jun 4, 2023
0c5284a
`black .`
Andrew-S-Rosen Jun 4, 2023
6d69c76
Fix LMAXTAU
Andrew-S-Rosen Jun 4, 2023
e849100
remove unneeded .keys()
janosh Jun 4, 2023
2d46dfd
Fix comment
Andrew-S-Rosen Jun 4, 2023
8917966
Merge remote-tracking branch 'origin/materialsproject' into materials…
Andrew-S-Rosen Jun 4, 2023
5a5eb3f
flash out tests some more, still very limited
janosh Jun 4, 2023
7f37252
Fix LMAXMIX
Andrew-S-Rosen Jun 4, 2023
a793115
Merge remote-tracking branch 'origin/materialsproject' into materials…
Andrew-S-Rosen Jun 4, 2023
6f66544
Add an LMAXTAU fix
Andrew-S-Rosen Jun 5, 2023
7239463
Add efermi fix
Andrew-S-Rosen Jun 5, 2023
e362ee9
Fix vasp_min_version
Andrew-S-Rosen Jun 5, 2023
f5e649f
Add EFERMI support
Andrew-S-Rosen Jun 5, 2023
9ed3b51
Modify base EFERMI parameter
Andrew-S-Rosen Jun 5, 2023
9e075b0
Better handling of EFERMI
Andrew-S-Rosen Jun 5, 2023
49f241a
EFERMI fix
Andrew-S-Rosen Jun 5, 2023
7132f47
Fix EFERMI
Andrew-S-Rosen Jun 5, 2023
8f97d1a
Add comments + `black`
Andrew-S-Rosen Jun 5, 2023
3c1caf1
Fix YAML reading
Andrew-S-Rosen Jun 6, 2023
8236e6b
Remove efermi
Andrew-S-Rosen Jun 8, 2023
123f246
Merge branch 'main' into materialsproject
Andrew-S-Rosen Jun 8, 2023
7d4b098
Fix lint
Andrew-S-Rosen Jun 8, 2023
c28bea7
Merge remote-tracking branch 'origin/materialsproject' into materials…
Andrew-S-Rosen Jun 8, 2023
24a867b
Fix MP Static calc
Andrew-S-Rosen Jun 9, 2023
21406c2
Update naming
Andrew-S-Rosen Jun 9, 2023
0b2be02
Update naming
Andrew-S-Rosen Jun 9, 2023
45114d4
Merge branch 'main' into materialsproject
Andrew-S-Rosen Jun 10, 2023
0f5e393
type mock_vasp fixture
janosh Jun 23, 2023
dd673cf
Merge branch 'main' into materialsproject
Andrew-S-Rosen Jun 29, 2023
16aaddc
fix outdated vasp.jobs.mp.__all__ export
janosh Jul 4, 2023
4ba3bb5
fix typo in ConfigurationCoordinateMaker name
janosh Jul 4, 2023
cfa7630
fix mypy
janosh Jul 4, 2023
3877a3c
fix typo in test comment
janosh Jul 4, 2023
ffcc281
add test_mp_relax()
janosh Jul 4, 2023
e044a91
Merge branch 'main' into materialsproject
Andrew-S-Rosen Jul 4, 2023
c148ddb
implement copy_vasp_files = ("WAVECAR", "CHGCAR") and drop initial_st…
janosh Jul 8, 2023
c776a69
Merge branch 'main' into materialsproject
Andrew-S-Rosen Jul 10, 2023
7fad0dc
@utf code review suggestions
janosh Jul 13, 2023
1bc848b
add MP GGA double relax maker
janosh Jul 13, 2023
b9d6b89
fix tests/vasp/flows/test_mp.py (only missing ref files now)
janosh Jul 13, 2023
b471a14
fix kspacing not clamped to <0.44 MPMetaGGARelaxGenerator.get_incar_u…
janosh Jul 21, 2023
d46c759
set auto_ismear=False in MPMetaGGAStaticMaker to always run with ISMEAR
janosh Jul 21, 2023
6e070db
revert k_spacing to kspacing
janosh Jul 21, 2023
8dd8a92
fix MPMetaGGARelaxGenerator + MPGGARelaxGenerator missing @dataclass
janosh Jul 24, 2023
debc4ef
set auto_ismear=False in all MP Makers
janosh Jul 24, 2023
d220c82
fix set ISMEAR=0 if bandgap > self.bandgap_tol
janosh Jul 24, 2023
75c43ba
fix internal error in YLM3LOOKUP by deleting _set_lmaxtau()
janosh Jul 24, 2023
fc07bfd
Fixed r2SCAN jobs and flows
Jul 26, 2023
10e97ad
Update r2SCAN MP set to use LELF = False by default
esoteric-ephemera Aug 7, 2023
468840b
pre-commit run --all-files
janosh Aug 8, 2023
8cd3b96
fix RuntimeError: dictionary changed size during iteration
janosh Aug 8, 2023
dae945a
Merge branch 'main' into materialsproject
janosh Aug 8, 2023
21b26ee
add test_mp_meta_gga_relax()
janosh Aug 9, 2023
2d2445c
add test_mp_meta_gga_relax() reference files
janosh Aug 9, 2023
e799d89
Update BaseMPGGASet.yaml to use PBE_54 PSPs
esoteric-ephemera Aug 9, 2023
7338279
refactor _set_u_params
janosh Aug 9, 2023
3f78de8
delete useless test files
janosh Aug 9, 2023
3c4e630
change BaseMPGGASet.yaml POTCAR W_pv to W_sv
janosh Aug 10, 2023
48a09bb
add POTCARS Am At Cf Cm Fr Po Ra Rn to BaseMPGGASet.yaml (all the one…
janosh Aug 10, 2023
c98fe98
set "GGA": None in MPMetaGGARelaxGenerator.get_incar_updates
janosh Aug 14, 2023
aa59b6a
Merge branch 'main' into materialsproject
janosh Aug 14, 2023
86c2543
test_mp_meta_gga_relax use correct Si input structure
janosh Aug 17, 2023
876ff08
check_poscar() print paths and contents of inconsistent POSCARs
janosh Aug 17, 2023
1f130fc
update reference files
janosh Aug 17, 2023
2493567
add copy_vasp_files to MP[Meta]GGARelax doc str
janosh Aug 17, 2023
46d661f
rename MP[Meta]GGARelax->MP[Meta]GGADoubleRelaxStatic,
janosh Aug 17, 2023
1793bc3
rename MP[Meta]GGARelax{''->Set}Generator
janosh Aug 17, 2023
25f4c5d
add bandgap_tol bandgap_override to MPMetaGGARelaxSetGenerator doc str
janosh Aug 17, 2023
950a4c5
Update MP flows
esoteric-ephemera Aug 17, 2023
15e301b
Update BaseMPR2SCANRelaxSet.yaml
esoteric-ephemera Aug 17, 2023
dd4e551
Update MP flows
esoteric-ephemera Aug 18, 2023
ba9c1dc
Update MP jobs
esoteric-ephemera Aug 21, 2023
208d92f
Update MP flow
esoteric-ephemera Aug 23, 2023
b99e47b
Update mp flow
esoteric-ephemera Aug 23, 2023
4bf816a
fix kspacing falsely jumps from 0.44 (expected) to 0.22 when bandgap …
janosh Aug 31, 2023
9121371
Merge branch 'main' into materialsproject
janosh Sep 1, 2023
4a2c5f4
fix typo (inital->initial)_relax_maker
janosh Sep 1, 2023
c8e10e2
improve check_kpoints() inconsistent err msg
janosh Sep 1, 2023
233b976
add tests/vasp/jobs/test_mp.py
janosh Sep 1, 2023
7cbe666
define MP(Meta)GGADoubleRelaxMaker in src/atomate2/vasp/flows/mp.py
janosh Sep 1, 2023
5aa9b24
add MPMetaGGAStaticSetGenerator to have all combinations of PBE/r2SCA…
janosh Sep 2, 2023
5240c01
clean up MP jobs and flows following @utf's advice
janosh Sep 2, 2023
d43f4cb
fix MPMetaGGAStaticMaker set generator
janosh Sep 3, 2023
de7b3f6
add new field auto_kspacing: bool | float = False to VaspInputGenerator
janosh Sep 3, 2023
f19c2fc
set auto_kspacing = True in all MP set generators
janosh Sep 3, 2023
5349665
fix MPMetaGGARelaxSetGenerator parent class
janosh Sep 3, 2023
f35f554
check_incar improve err msg on inconsistent ref and user file
janosh Sep 3, 2023
4a0c4c0
more work jobs/test_mp.py (almost working)
janosh Sep 3, 2023
d9a7481
add support contact info to mp module doc strings
janosh Sep 11, 2023
74bf189
tweak err msg on inconsistent INCARs/KPOINTS/KSPACING
janosh Sep 11, 2023
dd20718
fix test_mp_meta_gga_relax() ref_paths keys
janosh Sep 11, 2023
f91a9d3
fix typo: LCHARGE->LCHARG
janosh Sep 11, 2023
1fe3138
move MP Maker tests tests/vasp/(flows->jobs)/test_mp.py
janosh Sep 18, 2023
b323cc0
fix wrong flow called in test_mp_meta_gga_relax()
janosh Sep 25, 2023
6896146
fix MPPreRelaxMaker: use MPMetaGGARelaxSetGenerator for kspacing (was…
janosh Sep 25, 2023
3499f87
MPMetaGGADoubleRelaxMaker use MPPreRelaxMaker as relax_maker1
janosh Sep 25, 2023
3dbbcaa
mv tests/test_data/vasp/Si_mp_(metagga->meta_gga)_relax
janosh Sep 26, 2023
506535b
add unit test reference files for MP GGA workflow
janosh Sep 26, 2023
13044ab
fix casing in MPGGARelaxMaker.name
janosh Sep 26, 2023
32e89cf
add test_mp_gga_relax() in tests/vasp/flows/test_mp.py
janosh Sep 26, 2023
a13d0f2
fix DoubleRelaxMaker if relax_maker1 is None
janosh Sep 27, 2023
0b0bdc8
rename relax_job to relax_flow (since it's a double relax)
janosh Sep 27, 2023
2783dfa
fix MPGGAStaticMaker.name casing
janosh Sep 27, 2023
57df7ed
add test_mp_gga_relax_maker
janosh Sep 27, 2023
075075d
add test_mp_gga_double_relax
janosh Sep 27, 2023
33b0f68
rm tests/test_data/**/FW.json.gz
janosh Sep 27, 2023
ecd2052
rename MP(Meta)GGADoubleRelaxStatic to MPMetaGGADoubleRelaxStaticMaker
janosh Sep 27, 2023
b0e06be
add Atomate2Settings.VASP_INHERIT_INCAR
janosh Sep 27, 2023
2177b0f
add VaspInputGenerator keyword inherit_incar: bool = None
janosh Sep 27, 2023
7ad43d6
fix MPGGAStaticMaker using wrong set generator
janosh Sep 27, 2023
0943466
fix missing incar updates in MP set generators
janosh Sep 27, 2023
a1132e2
fix MP jobs tests
janosh Sep 27, 2023
36c2529
revert BaseMPGGASet.yaml to POTCAR_FUNCTIONAL: PBE (from PBE_54)
janosh Sep 28, 2023
a3f2d87
change VASP_INHERIT_INCAR default to True
janosh Sep 29, 2023
a3c6fb3
add inherit_incar to VaspInputGenerator doc str
janosh Sep 29, 2023
1a6882c
set inherit_incar = False on all MP sets
janosh Sep 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/atomate2/common/flows/defect.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ConfigurationCoordinateMaker(Maker):

relax_maker: Maker
static_maker: Maker
name: str = "config. coordinate"
name: str = "config coordinate"
distortions: tuple[float, ...] = DEFAULT_DISTORTIONS

def make(
Expand Down
2 changes: 1 addition & 1 deletion src/atomate2/common/jobs/defect.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def get_supercell_from_prv_calc(
Output containing the supercell transformation and the dir_name
"""
sc_structure = structure_from_prv(prv_calc_dir)
(sc_mat_prv, _) = get_matched_structure_mapping(
sc_mat_prv, _ = get_matched_structure_mapping(
uc_struct=uc_structure, sc_struct=sc_structure
)

Expand Down
15 changes: 11 additions & 4 deletions src/atomate2/vasp/flows/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
if TYPE_CHECKING:
from pathlib import Path

from jobflow import Job
from pymatgen.core.structure import Structure

from atomate2.vasp.jobs.base import BaseVaspMaker
Expand Down Expand Up @@ -56,7 +57,7 @@ class DoubleRelaxMaker(Maker):
"""

name: str = "double relax"
relax_maker1: BaseVaspMaker = field(default_factory=RelaxMaker)
relax_maker1: BaseVaspMaker | None = field(default_factory=RelaxMaker)
relax_maker2: BaseVaspMaker = field(default_factory=RelaxMaker)

def make(self, structure: Structure, prev_vasp_dir: str | Path | None = None):
Expand All @@ -75,8 +76,14 @@ def make(self, structure: Structure, prev_vasp_dir: str | Path | None = None):
Flow
A flow containing two relaxations.
"""
relax1 = self.relax_maker1.make(structure, prev_vasp_dir=prev_vasp_dir)
relax1.name += " 1"
jobs: list[Job] = []
if self.relax_maker1:
# Run a pre-relaxation
relax1 = self.relax_maker1.make(structure, prev_vasp_dir=prev_vasp_dir)
relax1.name += " 1"
jobs += [relax1]
structure = relax1.output.structure
prev_vasp_dir = relax1.output.dir_name

relax2 = self.relax_maker2.make(
relax1.output.structure, prev_vasp_dir=relax1.output.dir_name
Expand Down Expand Up @@ -352,7 +359,7 @@ class HSELineModeBandStructureMaker(LineModeBandStructureMaker):
@dataclass
class RelaxBandStructureMaker(Maker):
"""
Make to create a flow with a relaxation and then band structure calculations.
Maker to create a flow with a relaxation and then band structure calculations.

By default, this workflow generates relaxations using the :obj:`.DoubleRelaxMaker`.

Expand Down
6 changes: 2 additions & 4 deletions src/atomate2/vasp/flows/defect.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@
user_kpoints_settings=SPECIAL_KPOINT
),
task_document_kwargs={"store_volumetric_data": ["locpot"]},
copy_vasp_kwargs={
"additional_vasp_files": ("WAVECAR",),
},
copy_vasp_kwargs={"additional_vasp_files": ("WAVECAR",)},
),
)
GRID_KEYS = ["NGX", "NGY", "NGZ", "NGXF", "NGYF", "NGZF"]
Expand Down Expand Up @@ -251,7 +249,7 @@ class ConfigurationCoordinateMaker(defect_flows.ConfigurationCoordinateMaker):
static_maker: BaseVaspMaker = field(
default_factory=lambda: StaticMaker(input_set_generator=DEFECT_STATIC_GENERATOR)
)
name: str = "config. coordinate"
name: str = "config coordinate"


@dataclass
Expand Down
224 changes: 224 additions & 0 deletions src/atomate2/vasp/flows/mp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
"""
Module defining flows for Materials Project workflows.

Reference: https://doi.org/10.1103/PhysRevMaterials.6.013801
"""

from __future__ import annotations

from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Sequence

from jobflow import Flow, Maker

from atomate2.vasp.flows.core import DoubleRelaxMaker
from atomate2.vasp.jobs.mp import (
MPGGARelaxMaker,
MPGGAStaticMaker,
MPMetaGGARelaxMaker,
MPMetaGGAStaticMaker,
)

if TYPE_CHECKING:
from pathlib import Path

from jobflow import Job
from pymatgen.core.structure import Structure

from atomate2.vasp.jobs.base import BaseVaspMaker


@dataclass
class MPGGADoubleRelaxMaker(DoubleRelaxMaker):
"""MP GGA double relaxation workflow.

Parameters
----------
name : str
Name of the flows produced by this maker.
pre_relax_maker : .BaseVaspMaker
Maker to generate the first relaxation.
relax_maker : .BaseVaspMaker
Maker to generate the second relaxation.
copy_vasp_files : Sequence[str] or None
VASP files to copy from the previous calculation directory.
"""

name: str = "MP GGA double relax"
pre_relax_maker: BaseVaspMaker | None = field(default_factory=MPGGARelaxMaker)
relax_maker: BaseVaspMaker = field(default_factory=MPGGARelaxMaker)
copy_vasp_files: Sequence[str] | None = ("WAVECAR", "CHGCAR")

def __post_init__(self):
"""Set the copy_vasp_kwargs for the relax_maker."""
self.relax_maker.copy_vasp_kwargs.setdefault(
"additional_vasp_files", self.copy_vasp_files
)


@dataclass
class MPMetaGGADoubleRelaxMaker(DoubleRelaxMaker):
"""MP meta-GGA double relaxation workflow.

Parameters
----------
name : str
Name of the flows produced by this maker.
pre_relax_maker : .BaseVaspMaker
Maker to generate the first relaxation.
relax_maker : .BaseVaspMaker
Maker to generate the second relaxation.
copy_vasp_files : Sequence[str] or None
VASP files to copy from the previous calculation directory.
"""

name: str = "MP GGA double relax"
pre_relax_maker: BaseVaspMaker | None = field(default_factory=MPMetaGGARelaxMaker)
relax_maker: BaseVaspMaker = field(default_factory=MPMetaGGARelaxMaker)
copy_vasp_files: Sequence[str] | None = ("WAVECAR", "CHGCAR")

def __post_init__(self):
"""Set the copy_vasp_kwargs for the relax_maker."""
self.relax_maker.copy_vasp_kwargs.setdefault(
"additional_vasp_files", self.copy_vasp_files
)


@dataclass
class MPGGADoubleRelaxStatic(Maker):
"""
Maker to perform a VASP GGA relaxation workflow with MP settings.

Parameters
----------
name : str
Name of the flows produced by this maker.
pre_relax_maker : .BaseVaspMaker
Maker to generate the first relaxation.
relax_maker : .BaseVaspMaker
Maker to generate the second relaxation.
static_maker : .BaseVaspMaker
Maker to generate the static calculation before the relaxation.
copy_vasp_files : Sequence[str] or None
VASP files to copy from the previous calculation directory.
"""

name: str = "MP GGA relax"
relax_maker: BaseVaspMaker = field(default_factory=MPGGADoubleRelaxMaker)
static_maker: BaseVaspMaker | None = field(default_factory=MPGGAStaticMaker)
copy_vasp_files: Sequence[str] | None = ("WAVECAR", "CHGCAR")
GGA_plus_U: bool = False

def make(self, structure: Structure, prev_vasp_dir: str | Path | None = None):
"""
1, 2 or 3-step flow with optional pre-relax and final static jobs.

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 the MP relaxation workflow.
"""
self.relax_maker.copy_vasp_kwargs.setdefault(
"additional_vasp_files", self.copy_vasp_files
)
jobs: list[Job] = []

self.relax_maker.copy_vasp_kwargs = {
"additional_vasp_files": self.copy_vasp_files
}
relax_job = self.relax_maker.make(
structure=structure, prev_vasp_dir=prev_vasp_dir
)
output = relax_job.output
jobs += [relax_job]

if self.static_maker:
# Run a static calculation
self.static_maker.copy_vasp_kwargs = {
"additional_vasp_files": self.copy_vasp_files
}

static_job = self.static_maker.make(
structure=output.structure, prev_vasp_dir=output.dir_name
)
output = static_job.output
jobs += [static_job]

return Flow(jobs, output, name=self.name)


@dataclass
class MPMetaGGADoubleRelaxStatic(MPGGADoubleRelaxMaker):
"""
1, 2 or 3-step flow with optional pre-relax and final static jobs.

Parameters
----------
name : str
Name of the flows produced by this maker.
pre_relax_maker : .BaseVaspMaker
Maker to generate the first relaxation.
relax_maker : .BaseVaspMaker
Maker to generate the second relaxation.
static_maker : .BaseVaspMaker
Maker to generate the static calculation before the relaxation.
copy_vasp_files : Sequence[str] or None
VASP files to copy from the previous calculation directory.
"""

name: str = "MP Meta-GGA relax"
relax_maker: BaseVaspMaker = field(default_factory=MPMetaGGADoubleRelaxMaker)
static_maker: BaseVaspMaker | None = field(default_factory=MPMetaGGAStaticMaker)
copy_vasp_files: Sequence[str] | None = ("WAVECAR", "CHGCAR")

def make(self, structure: Structure, prev_vasp_dir: str | Path | None = None):
"""
Create a 2-step flow with a cheap pre-relaxation followed by a high-quality one.

An optional static calculation can be performed before the relaxation.

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 the MP relaxation workflow.
"""
self.relax_maker.copy_vasp_kwargs.setdefault(
"additional_vasp_files", self.copy_vasp_files
)
jobs: list[Job] = []

self.relax_maker.copy_vasp_kwargs = {
"additional_vasp_files": self.copy_vasp_files
}
relax_job = self.relax_maker.make(
structure=structure, prev_vasp_dir=prev_vasp_dir
)
output = relax_job.output
jobs += [relax_job]

if self.static_maker:
# Run a static calculation (typically r2SCAN)
self.static_maker.copy_vasp_kwargs = {
"additional_vasp_files": self.copy_vasp_files
}
static_job = self.static_maker.make(
structure=output.structure, prev_vasp_dir=output.dir_name
)
output = static_job.output
jobs += [static_job]

return Flow(jobs, output=output, name=self.name)
9 changes: 8 additions & 1 deletion src/atomate2/vasp/jobs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ class BaseVaspMaker(Maker):
write_additional_data: dict = field(default_factory=dict)

@vasp_job
def make(self, structure: Structure, prev_vasp_dir: str | Path | None = None):
def make(
self, structure: Structure, prev_vasp_dir: str | Path | None = None
) -> Response:
"""
Run a VASP calculation.

Expand All @@ -193,6 +195,11 @@ def make(self, structure: Structure, prev_vasp_dir: str | Path | None = None):
A pymatgen structure object.
prev_vasp_dir : str or Path or None
A previous VASP calculation directory to copy output files from.

Returns
-------
Response: A response object containing the output, detours and stop
commands of the VASP run.
"""
# copy previous inputs
from_prev = prev_vasp_dir is not None
Expand Down
2 changes: 1 addition & 1 deletion src/atomate2/vasp/jobs/defect.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def calculate_finite_diff(
):
"""Run a post-processing VASP job for the finite difference overlap.

Reads the WAVECAR file and computs the desired quantities. This can be used in
Reads the WAVECAR file and computes the desired quantities. This can be used in
cases where data from the same calculation is used multiple times.

Since all of the standard outputs are presumably already stored in the database,
Expand Down
Loading