@@ -54,7 +54,8 @@ def __init__(
54
54
compat_1 : Compatibility | None = MaterialsProject2020Compatibility (), # noqa: B008
55
55
compat_2 : Compatibility | None = None ,
56
56
fuzzy_matching : bool = True ,
57
- ):
57
+ check_potcar : bool = True ,
58
+ ) -> None :
58
59
"""
59
60
Instantiate the mixing scheme. The init method creates a generator class that
60
61
contains relevant settings (e.g., StructureMatcher instance, Compatibility settings
@@ -93,29 +94,28 @@ def __init__(
93
94
space group are all identical. If there are multiple materials of run_type_2
94
95
that satisfy these criteria, the one with lowest energy is considered to
95
96
match.
97
+ check_potcar: Whether to perform additional checks to ensure that the POTCARs
98
+ used for the run_type_1 and run_type_2 calculations are the same. This is
99
+ useful for ensuring that the mixing scheme is not used on calculations that
100
+ used different POTCARs, which can lead to unphysical results. Defaults to True.
101
+ Has no effect if neither compat_1 nor compat_2 have a check_potcar attribute.
96
102
"""
97
103
self .name = "MP DFT mixing scheme"
98
104
self .structure_matcher = structure_matcher or StructureMatcher ()
99
105
if run_type_1 == run_type_2 :
100
- raise ValueError (
101
- f"You specified the same run_type { run_type_1 } for both run_type_1 and run_type_2. "
102
- "The mixing scheme is meaningless unless run_type_1 and run_type_2 are different"
103
- )
106
+ raise ValueError (f"run_type_1={ run_type_2 = } . The mixing scheme is meaningless unless run_types different" )
104
107
self .run_type_1 = run_type_1
105
108
self .run_type_2 = run_type_2
106
- if self .run_type_1 == "GGA(+U)" :
107
- self .valid_rtypes_1 = ["GGA" , "GGA+U" ]
108
- else :
109
- self .valid_rtypes_1 = [self .run_type_1 ]
110
-
111
- if self .run_type_2 == "GGA(+U)" :
112
- self .valid_rtypes_2 = ["GGA" , "GGA+U" ]
113
- else :
114
- self .valid_rtypes_2 = [self .run_type_2 ]
109
+ self .valid_rtypes_1 = ["GGA" , "GGA+U" ] if self .run_type_1 == "GGA(+U)" else [self .run_type_1 ]
110
+ self .valid_rtypes_2 = ["GGA" , "GGA+U" ] if self .run_type_2 == "GGA(+U)" else [self .run_type_2 ]
115
111
116
112
self .compat_1 = compat_1
117
113
self .compat_2 = compat_2
118
114
self .fuzzy_matching = fuzzy_matching
115
+ self .check_potcar = check_potcar
116
+ for compat in (self .compat_1 , self .compat_2 ):
117
+ if hasattr (compat , "check_potcar" ):
118
+ compat .check_potcar = check_potcar # type: ignore[union-attr]
119
119
120
120
def process_entries (
121
121
self ,
0 commit comments