Skip to content

Commit a49f43b

Browse files
author
Shyue Ping Ong
committed
Simplified logic of functional checking.
1 parent 9895455 commit a49f43b

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

pymatgen/io/vasp/sets.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,15 +1242,13 @@ def __init__(
12421242
self,
12431243
structure: Structure,
12441244
xc_functional: Literal["R2SCAN", "PBE", "PBE+U"] = "PBE",
1245-
user_potcar_functional="PBE_54",
12461245
prev_incar=None,
12471246
**kwargs: Any,
12481247
):
12491248
"""
12501249
Args:
12511250
structure (Structure): Structure for static calculation.
12521251
xc_functional ('R2SCAN'|'PBE'): Exchange-correlation functional to use. Defaults to 'PBE'.
1253-
user_potcar_functional: Choice of VASP POTCAR functional and version. Defaults to 'PBE_54'.
12541252
prev_incar (Incar|str): Incar file from previous run. Default settings of MatPESStaticSet
12551253
are prioritized over inputs from previous runs.
12561254
**kwargs: Passed to DictSet.
@@ -1260,21 +1258,15 @@ def __init__(
12601258
if xc_functional.upper() == "R2SCAN":
12611259
self._config_dict["INCAR"]["METAGGA"] = "R2SCAN"
12621260
self._config_dict["INCAR"]["ALGO"] = "ALL"
1263-
del self._config_dict["INCAR"]["GGA"]
1261+
self._config_dict["INCAR"].pop("GGA", None)
12641262
elif xc_functional.upper() == "PBE+U":
12651263
self._config_dict["INCAR"]["LDAU"] = True
12661264
elif xc_functional.upper() != "PBE":
1267-
raise ValueError(
1268-
f"{xc_functional} is not supported."
1269-
" The supported exchange-correlation functionals are PBE, PBE+U and R2SCAN."
1270-
)
1271-
if user_potcar_functional.upper() != "PBE_54":
1265+
raise ValueError(f"{xc_functional} is not supported. Supported xc functionals are PBE, PBE+U and R2SCAN.")
1266+
if kwargs.get("user_potcar_functional", "PBE_54") != "PBE_54":
12721267
warnings.warn(
1273-
f"POTCAR version ({user_potcar_functional}) is inconsistent with the recommended PBE_54.", UserWarning
1268+
f"POTCAR ({kwargs['user_potcar_functional']}) is inconsistent with the recommended PBE_54.", UserWarning
12741269
)
1275-
1276-
self.user_potcar_functional = user_potcar_functional.upper()
1277-
12781270
self.kwargs = kwargs
12791271
self.xc_functional = xc_functional
12801272
self.prev_incar = prev_incar or {}

0 commit comments

Comments
 (0)