@@ -1201,13 +1201,15 @@ def from_prev_calc(cls, prev_calc_dir, **kwargs):
1201
1201
class MatPESStaticSet (DictSet ):
1202
1202
"""Creates input files for a MatPES static calculation.
1203
1203
1204
- The goal of MatPES is to generate PES data. This is a distinctly different from the objectives of the MP static
1205
- calculations, which aims to obtain accurate energies and electronic structure (DOS) primarily. For PES data,
1206
- force accuracy (and to some extent, stress accuracy) is of paramount importance.
1207
-
1208
- It should be noted that the default POTCAR versions have been updated to PBE_54, rather than the old PBE set used
1209
- in the MPStaticSet. However, **U values** are still based on PBE. The implicit assumption here is that the PBE_54
1210
- and PBE POTCARs are sufficiently similar that the U values fitted to the old PBE functional still applies.
1204
+ The goal of MatPES is to generate potential energy surface data. This is a distinctly different
1205
+ from the objectives of the MP static calculations, which aims to obtain primarily accurate
1206
+ energies and also electronic structure (DOS). For PES data, force accuracy (and to some extent,
1207
+ stress accuracy) is of paramount importance.
1208
+
1209
+ The default POTCAR versions have been updated to PBE_54 from the old PBE set used in the
1210
+ MPStaticSet. However, **U values** are still based on PBE. The implicit assumption here is that
1211
+ the PBE_54 and PBE POTCARs are sufficiently similar that the U values fitted to the old PBE
1212
+ functional still applies.
1211
1213
"""
1212
1214
1213
1215
CONFIG = _load_yaml_config ("MatPESStaticSet" )
@@ -1242,31 +1244,35 @@ def __init__(
1242
1244
self ,
1243
1245
structure : Structure ,
1244
1246
xc_functional : Literal ["R2SCAN" , "PBE" , "PBE+U" ] = "PBE" ,
1245
- prev_incar = None ,
1247
+ prev_incar : Incar | dict | None = None ,
1246
1248
** kwargs : Any ,
1247
- ):
1249
+ ) -> None :
1248
1250
"""
1249
1251
Args:
1250
1252
structure (Structure): Structure for static calculation.
1251
1253
xc_functional ('R2SCAN'|'PBE'): Exchange-correlation functional to use. Defaults to 'PBE'.
1252
- prev_incar (Incar|str ): Incar file from previous run. Default settings of MatPESStaticSet
1253
- are prioritized over inputs from previous runs.
1254
+ prev_incar (Incar | dict ): Incar file from previous run. Default settings of MatPESStaticSet
1255
+ are prioritized over inputs from previous runs. Defaults to None.
1254
1256
**kwargs: Passed to DictSet.
1255
1257
"""
1258
+ valid_xc_functionals = ("R2SCAN" , "PBE" , "PBE+U" )
1259
+ if xc_functional .upper () not in valid_xc_functionals :
1260
+ raise ValueError (
1261
+ f"Unrecognized { xc_functional = } . Supported exchange-correlation functionals are { valid_xc_functionals } "
1262
+ )
1263
+
1256
1264
super ().__init__ (structure , MatPESStaticSet .CONFIG , ** kwargs )
1257
1265
1258
1266
if xc_functional .upper () == "R2SCAN" :
1259
1267
self ._config_dict ["INCAR" ]["METAGGA" ] = "R2SCAN"
1260
1268
self ._config_dict ["INCAR" ]["ALGO" ] = "ALL"
1261
1269
self ._config_dict ["INCAR" ].pop ("GGA" , None )
1262
- elif xc_functional .upper () == "PBE +U" :
1270
+ if xc_functional .upper (). endswith ( " +U") :
1263
1271
self ._config_dict ["INCAR" ]["LDAU" ] = True
1264
- elif xc_functional .upper () != "PBE" :
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" :
1267
- warnings .warn (
1268
- f"POTCAR ({ kwargs ['user_potcar_functional' ]} ) is inconsistent with the recommended PBE_54." , UserWarning
1269
- )
1272
+ user_potcar_functional = kwargs .get ("user_potcar_functional" , "PBE_54" )
1273
+ if user_potcar_functional .upper () != "PBE_54" :
1274
+ warnings .warn (f"{ user_potcar_functional = } is inconsistent with the recommended PBE_54." , UserWarning )
1275
+
1270
1276
self .kwargs = kwargs
1271
1277
self .xc_functional = xc_functional
1272
1278
self .prev_incar = prev_incar or {}
@@ -1276,9 +1282,8 @@ def incar(self) -> Incar:
1276
1282
"""Incar"""
1277
1283
incar = super ().incar
1278
1284
1279
- for p in MatPESStaticSet .INHERITED_INCAR_PARAMS :
1280
- if p in self .prev_incar :
1281
- incar [p ] = self .prev_incar [p ]
1285
+ for key in set (self .INHERITED_INCAR_PARAMS ) & set (self .prev_incar ):
1286
+ incar [key ] = self .prev_incar [key ]
1282
1287
return incar
1283
1288
1284
1289
@classmethod
0 commit comments