@@ -932,28 +932,30 @@ class MPScanRelaxSet(DictSet):
932
932
CONFIG = _load_yaml_config ("MPSCANRelaxSet" )
933
933
_valid_potcars = ("PBE_52" , "PBE_54" )
934
934
935
- def __init__ (self , structure : Structure , bandgap = 0 , ** kwargs ):
935
+ def __init__ (self , structure : Structure , bandgap : float = 0 , bandgap_tol : float = 1e-4 , ** kwargs ) -> None :
936
936
"""
937
937
Args:
938
938
structure (Structure): Input structure.
939
- bandgap (int): Bandgap of the structure in eV. The bandgap is used to
940
- compute the appropriate k-point density and determine the
941
- smearing settings.
942
-
943
- Metallic systems (default, bandgap = 0) use a KSPACING value of 0.22
944
- and Methfessel-Paxton order 2 smearing (ISMEAR=2, SIGMA=0.2).
945
-
946
- Non-metallic systems (bandgap > 0) use the tetrahedron smearing
947
- method (ISMEAR=-5, SIGMA=0.05). The KSPACING value is
948
- calculated from the bandgap via Eqs. 25 and 29 of Wisesa, McGill,
949
- and Mueller [1] (see References). Note that if 'user_incar_settings'
950
- or 'user_kpoints_settings' override KSPACING, the calculation from
951
- bandgap is not performed.
952
-
939
+ bandgap (float): Bandgap of the structure in eV. The bandgap is used to
940
+ compute the appropriate k-point density and determine the
941
+ smearing settings.
942
+
943
+ Metallic systems (default, bandgap = 0) use a KSPACING value of 0.22
944
+ and Methfessel-Paxton order 2 smearing (ISMEAR=2, SIGMA=0.2).
945
+
946
+ Non-metallic systems (bandgap > 0) use the tetrahedron smearing
947
+ method (ISMEAR=-5, SIGMA=0.05). The KSPACING value is
948
+ calculated from the bandgap via Eqs. 25 and 29 of Wisesa, McGill,
949
+ and Mueller [1] (see References). Note that if 'user_incar_settings'
950
+ or 'user_kpoints_settings' override KSPACING, the calculation from
951
+ bandgap is not performed.
952
+ bandgap_tol (float): Tolerance for determining if a system is metallic.
953
+ If the bandgap is less than this value, the system is considered
954
+ metallic. Defaults to 1e-4 (eV).
953
955
vdw (str): set "rVV10" to enable SCAN+rVV10, which is a versatile
954
- van der Waals density functional by combing the SCAN functional
955
- with the rVV10 non-local correlation functional. rvv10 is the only
956
- dispersion correction available for SCAN at this time.
956
+ van der Waals density functional by combing the SCAN functional
957
+ with the rVV10 non-local correlation functional. rvv10 is the only
958
+ dispersion correction available for SCAN at this time.
957
959
**kwargs: Same as those supported by DictSet.
958
960
959
961
References:
@@ -966,33 +968,21 @@ def __init__(self, structure: Structure, bandgap=0, **kwargs):
966
968
super ().__init__ (structure , MPScanRelaxSet .CONFIG , ** kwargs )
967
969
self .bandgap = bandgap
968
970
self .kwargs = kwargs
971
+ self .bandgap_tol = bandgap_tol
969
972
970
- updates = {}
973
+ updates : dict [ str , float ] = {}
971
974
# select the KSPACING and smearing parameters based on the bandgap
972
975
if self .bandgap < 1e-4 :
973
- updates ["KSPACING" ] = 0.22
974
- updates ["SIGMA" ] = 0.2
975
- updates ["ISMEAR" ] = 2
976
+ updates .update (KSPACING = 0.22 , SIGMA = 0.2 , ISMEAR = 2 )
976
977
else :
977
978
rmin = 25.22 - 2.87 * bandgap # Eq. 25
978
979
kspacing = 2 * np .pi * 1.0265 / (rmin - 1.0183 ) # Eq. 29
979
980
# cap the KSPACING at a max of 0.44, per internal benchmarking
980
- if 0.22 < kspacing < 0.44 :
981
- updates ["KSPACING" ] = kspacing
982
- else :
983
- updates ["KSPACING" ] = 0.44
984
- updates ["ISMEAR" ] = - 5
985
- updates ["SIGMA" ] = 0.05
981
+ updates .update (KSPACING = kspacing if 0.22 < kspacing < 0.44 else 0.44 , SIGMA = 0.05 , ISMEAR = - 5 )
986
982
987
983
# Don't overwrite things the user has supplied
988
- if self .user_incar_settings .get ("KSPACING" ):
989
- del updates ["KSPACING" ]
990
-
991
- if self .user_incar_settings .get ("ISMEAR" ):
992
- del updates ["ISMEAR" ]
993
-
994
- if self .user_incar_settings .get ("SIGMA" ):
995
- del updates ["SIGMA" ]
984
+ for key in self .user_incar_settings :
985
+ updates .pop (key , None )
996
986
997
987
if self .vdw and self .vdw != "rvv10" :
998
988
warnings .warn ("Use of van der waals functionals other than rVV10 with SCAN is not supported at this time. " )
0 commit comments