@@ -394,7 +394,7 @@ def __post_init__(self):
394
394
)
395
395
396
396
if self .vdw :
397
- vdw_par = loadfn (str ( MODULE_DIR / "vdW_parameters.yaml" ) )
397
+ vdw_par = loadfn (MODULE_DIR / "vdW_parameters.yaml" )
398
398
try :
399
399
self ._config_dict ["INCAR" ].update (vdw_par [self .vdw ])
400
400
except KeyError :
@@ -1684,12 +1684,15 @@ def __post_init__(self):
1684
1684
"""Perform inputset validation."""
1685
1685
super ().__post_init__ ()
1686
1686
1687
- self .mode = self .mode .lower ()
1687
+ mode = self .mode = self .mode .lower ()
1688
1688
1689
- if self .mode not in ["line" , "uniform" , "boltztrap" ]:
1690
- raise ValueError ("Supported modes for NonSCF runs are 'line', 'uniform' and 'boltztrap!" )
1689
+ valid_modes = ("line" , "uniform" , "boltztrap" )
1690
+ if mode not in valid_modes :
1691
+ raise ValueError (
1692
+ f"Invalid { mode = } . Supported modes for NonSCF runs are { ', ' .join (map (repr , valid_modes ))} "
1693
+ )
1691
1694
1692
- if (self . mode . lower () != "uniform" or self .nedos < 2000 ) and self .optics :
1695
+ if (mode != "uniform" or self .nedos < 2000 ) and self .optics :
1693
1696
warnings .warn ("It is recommended to use Uniform mode with a high NEDOS for optics calculations." )
1694
1697
1695
1698
if self .standardize :
@@ -2018,10 +2021,10 @@ class MVLGWSet(DictSet):
2018
2021
def __post_init__ (self ):
2019
2022
"""Validate input settings."""
2020
2023
super ().__post_init__ ()
2021
- self .mode = self .mode .upper ()
2024
+ self .mode = mode = self .mode .upper ()
2022
2025
2023
- if self . mode not in MVLGWSet .SUPPORTED_MODES :
2024
- raise ValueError (f"{ self . mode } not one of the support modes : { MVLGWSet .SUPPORTED_MODES } " )
2026
+ if mode not in MVLGWSet .SUPPORTED_MODES :
2027
+ raise ValueError (f"Invalid { mode = } , supported modes are { ', ' . join ( map ( repr , MVLGWSet .SUPPORTED_MODES )) } " )
2025
2028
2026
2029
@property
2027
2030
def kpoints_updates (self ) -> dict :
@@ -2259,7 +2262,7 @@ def __init__(self, structures, unset_encut=False, **kwargs):
2259
2262
**kwargs: Other kwargs supported by DictSet.
2260
2263
"""
2261
2264
if len (structures ) < 3 :
2262
- raise ValueError ("You need at least 3 structures for an NEB. " )
2265
+ raise ValueError (f "You need at least 3 structures for an NEB, got { len ( structures ) } " )
2263
2266
kwargs ["sort_structure" ] = False
2264
2267
super ().__init__ (structures [0 ], MITRelaxSet .CONFIG , ** kwargs )
2265
2268
self .structures = self ._process_structures (structures )
0 commit comments