Skip to content

Commit 6f280a9

Browse files
hongyi-zhaojanosh
andauthored
Add VASP setting for the dftd4 vdW functional and extend PBE_64 support. (materialsproject#3967)
* Add VASP setting for the dftd4 vdW functional and extend PBE_64 support - Add IVDW: 13 for dftd4 in vdW_parameters.yaml - Support PBE_64 functional in MPScanRelaxSet, MVLRelax52Set, MVLScanRelaxSet, and LobsterSet - Update documentation and error messages to include PBE_64 - Add warning for LobsterSet when using PBE_64 POTCARs with PBE_54 basis functions - Update relevant test cases to accommodate PBE_64 support * Update the warning message of LobsterSet to include PBE_52 POTCARs as well. --------- Co-authored-by: Janosh Riebesell <[email protected]>
1 parent 76706f9 commit 6f280a9

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

src/pymatgen/io/vasp/sets.py

+17-10
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class VaspInputSet(InputGenerator, abc.ABC):
145145
atomic species are grouped together.
146146
user_potcar_functional (str): Functional to use. Default (None) is to use the
147147
functional in the config dictionary. Valid values: "PBE", "PBE_52",
148-
"PBE_54", "LDA", "LDA_52", "LDA_54", "PW91", "LDA_US", "PW91_US".
148+
"PBE_54", "PBE_64", "LDA", "LDA_52", "LDA_54", "PW91", "LDA_US", "PW91_US".
149149
force_gamma (bool): Force gamma centered kpoint generation. Default (False) is
150150
to use the Automatic Density kpoint scheme, which will use the Gamma
151151
centered generation scheme for hexagonal cells, and Monkhorst-Pack otherwise.
@@ -1281,7 +1281,7 @@ class MPScanRelaxSet(VaspInputSet):
12811281
12821282
2. Meta-GGA calculations require POTCAR files that include
12831283
information on the kinetic energy density of the core-electrons,
1284-
i.e. "PBE_52" or "PBE_54". Make sure the POTCARs include the
1284+
i.e. "PBE_52", "PBE_54" or "PBE_64". Make sure the POTCARs include the
12851285
following lines (see VASP wiki for more details):
12861286
12871287
$ grep kinetic POTCAR
@@ -1322,7 +1322,7 @@ class MPScanRelaxSet(VaspInputSet):
13221322
user_potcar_functional: UserPotcarFunctional = "PBE_54"
13231323
auto_ismear: bool = True
13241324
CONFIG = _load_yaml_config("MPSCANRelaxSet")
1325-
_valid_potcars: Sequence[str] | None = ("PBE_52", "PBE_54")
1325+
_valid_potcars: Sequence[str] | None = ("PBE_52", "PBE_54", "PBE_64")
13261326

13271327
def __post_init__(self) -> None:
13281328
super().__post_init__()
@@ -2295,13 +2295,13 @@ class MVLRelax52Set(VaspInputSet):
22952295
22962296
Args:
22972297
structure (Structure): input structure.
2298-
user_potcar_functional (str): choose from "PBE_52" and "PBE_54".
2298+
user_potcar_functional (str): choose from "PBE_52", "PBE_54" and "PBE_64".
22992299
**kwargs: Other kwargs supported by VaspInputSet.
23002300
"""
23012301

23022302
user_potcar_functional: UserPotcarFunctional = "PBE_52"
23032303
CONFIG = _load_yaml_config("MVLRelax52Set")
2304-
_valid_potcars: Sequence[str] | None = ("PBE_52", "PBE_54")
2304+
_valid_potcars: Sequence[str] | None = ("PBE_52", "PBE_54", "PBE_64")
23052305

23062306

23072307
class MITNEBSet(VaspInputSet):
@@ -2635,7 +2635,7 @@ class MVLScanRelaxSet(VaspInputSet):
26352635
26362636
2. Meta-GGA calculations require POTCAR files that include
26372637
information on the kinetic energy density of the core-electrons,
2638-
i.e. "PBE_52" or "PBE_54". Make sure the POTCAR including the
2638+
i.e. "PBE_52", "PBE_54" or "PBE_64". Make sure the POTCAR including the
26392639
following lines (see VASP wiki for more details):
26402640
26412641
$ grep kinetic POTCAR
@@ -2652,13 +2652,13 @@ class MVLScanRelaxSet(VaspInputSet):
26522652
"""
26532653

26542654
user_potcar_functional: UserPotcarFunctional = "PBE_52"
2655-
_valid_potcars: Sequence[str] | None = ("PBE_52", "PBE_54")
2655+
_valid_potcars: Sequence[str] | None = ("PBE_52", "PBE_54", "PBE_64")
26562656
CONFIG = MPRelaxSet.CONFIG
26572657

26582658
def __post_init__(self) -> None:
26592659
super().__post_init__()
2660-
if self.user_potcar_functional not in {"PBE_52", "PBE_54"}:
2661-
raise ValueError("SCAN calculations require PBE_52 or PBE_54!")
2660+
if self.user_potcar_functional not in {"PBE_52", "PBE_54", "PBE_64"}:
2661+
raise ValueError("SCAN calculations require PBE_52, PBE_54, or PBE_64!")
26622662

26632663
@property
26642664
def incar_updates(self) -> dict[str, Any]:
@@ -2708,12 +2708,19 @@ class LobsterSet(VaspInputSet):
27082708
user_potcar_functional: UserPotcarFunctional = "PBE_54"
27092709

27102710
CONFIG = MPRelaxSet.CONFIG
2711-
_valid_potcars: Sequence[str] | None = ("PBE_52", "PBE_54")
2711+
_valid_potcars: Sequence[str] | None = ("PBE_52", "PBE_54", "PBE_64")
27122712

27132713
def __post_init__(self) -> None:
27142714
super().__post_init__()
27152715
warnings.warn("Make sure that all parameters are okay! This is a brand new implementation.")
27162716

2717+
if self.user_potcar_functional in ["PBE_52", "PBE_64"]:
2718+
warnings.warn(
2719+
f"Using {self.user_potcar_functional} POTCARs with basis functions generated for PBE_54 POTCARs. "
2720+
"Basis functions for elements with obsoleted, updated or newly added POTCARs in "
2721+
f"{self.user_potcar_functional} will not be available and may cause errors or inaccuracies.",
2722+
BadInputSetWarning,
2723+
)
27172724
if self.isym not in {-1, 0}:
27182725
raise ValueError("Lobster cannot digest WAVEFUNCTIONS with symmetry. isym must be -1 or 0")
27192726
if self.ismear not in {-5, 0}:

src/pymatgen/io/vasp/vdW_parameters.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ dftd3:
55
IVDW: 11
66
dftd3-bj:
77
IVDW: 12
8+
dftd4:
9+
IVDW: 13
810
ts:
911
IVDW: 2
1012
ts-hirshfeld:

tests/io/vasp/test_sets.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def test_sets_changed(self):
119119
"PBE64Base.yaml": "3434c918c17706feae397d0852f2224e771db94d7e4c988039e8658e66d87494",
120120
"MPRelaxSet.yaml": "c9b0a519588fb3709509a9f9964632692584905e2961a0fe2e5f657561913083",
121121
"MITRelaxSet.yaml": "0b4bec619fa860dac648584853c3b3d5407e4148a85d0e95024fbd1dc315669d",
122-
"vdW_parameters.yaml": "977c226a1b44831382e772a464aecb7f6297c98d7efc9190f8c18e0b73be2666",
122+
"vdW_parameters.yaml": "7d2599a855533865335a313c043b6f89e03fc2633c88b6bc721723d94cc862bd",
123123
"MatPESStaticSet.yaml": "4ec60ad4bbbb9a756f1b3fea8ca4eab8fc767d8f6a67332e7af3908c910fd7c5",
124124
"MPAbsorptionSet.yaml": "e49cd0ab87864f1c244e9b5ceb4703243116ec1fbb8958a374ddff07f7a5625c",
125125
"PBE54Base.yaml": "cdffe123eca8b19354554b60a7f8de9b8776caac9e1da2bd2a0516b7bfac8634",
@@ -1676,7 +1676,7 @@ def test_potcar(self):
16761676
assert input_set.potcar.functional == "PBE_52"
16771677

16781678
with pytest.raises(
1679-
ValueError, match=r"Invalid user_potcar_functional='PBE', must be one of \('PBE_52', 'PBE_54'\)"
1679+
ValueError, match=r"Invalid user_potcar_functional='PBE', must be one of \('PBE_52', 'PBE_54', 'PBE_64'\)"
16801680
):
16811681
MVLScanRelaxSet(self.struct, user_potcar_functional="PBE")
16821682

@@ -1687,7 +1687,7 @@ def test_potcar(self):
16871687
# assert test_potcar_set_1.potcar.functional == "PBE_54"
16881688
#
16891689
# with pytest.raises(
1690-
# ValueError, match=r"Invalid user_potcar_functional='PBE', must be one of \('PBE_52', 'PBE_54'\)"
1690+
# ValueError, match=r"Invalid user_potcar_functional='PBE', must be one of \('PBE_52', 'PBE_54', 'PBE_64'\)"
16911691
# ):
16921692
# self.set(self.struct, user_potcar_functional="PBE")
16931693
#
@@ -1806,7 +1806,7 @@ def test_potcar(self):
18061806
assert input_set.potcar.functional == "PBE_54"
18071807

18081808
with pytest.raises(
1809-
ValueError, match=r"Invalid user_potcar_functional='PBE', must be one of \('PBE_52', 'PBE_54'\)"
1809+
ValueError, match=r"Invalid user_potcar_functional='PBE', must be one of \('PBE_52', 'PBE_54', 'PBE_64'\)"
18101810
):
18111811
MPScanRelaxSet(self.struct, user_potcar_functional="PBE")
18121812

@@ -1976,7 +1976,7 @@ def test_potcar(self):
19761976
assert test_potcar_set_1.potcar.functional == "PBE_52"
19771977

19781978
with pytest.raises(
1979-
ValueError, match=r"Invalid user_potcar_functional='PBE', must be one of \('PBE_52', 'PBE_54'\)"
1979+
ValueError, match=r"Invalid user_potcar_functional='PBE', must be one of \('PBE_52', 'PBE_54', 'PBE_64'\)"
19801980
):
19811981
self.set(self.struct, user_potcar_functional="PBE")
19821982

0 commit comments

Comments
 (0)