@@ -1844,10 +1844,10 @@ def test_fuzzy_matching(self, ms_complete):
1844
1844
with pytest .raises (CompatibilityError , match = "ground state" ):
1845
1845
compat .get_adjustments (entry , mixing_state )
1846
1846
elif entry .entry_id == "r2scan-3" :
1847
- with pytest .raises (CompatibilityError , match = "and no R2SCAN ground state" ):
1847
+ with pytest .raises (CompatibilityError , match = "and no r2SCAN ground state" ):
1848
1848
compat .get_adjustments (entry , mixing_state )
1849
1849
elif entry .entry_id in ["gga-2" , "gga-5" , "gga-6" , "gga-7" ]:
1850
- with pytest .raises (CompatibilityError , match = "there is a matching R2SCAN " ):
1850
+ with pytest .raises (CompatibilityError , match = "there is a matching r2SCAN " ):
1851
1851
compat .get_adjustments (entry , mixing_state )
1852
1852
elif entry .parameters ["run_type" ] == "GGA" :
1853
1853
assert not compat .get_adjustments (entry , mixing_state )
@@ -1861,7 +1861,7 @@ def test_fuzzy_matching(self, ms_complete):
1861
1861
if entry .parameters ["run_type" ] == "GGA" :
1862
1862
assert entry .correction == 0
1863
1863
elif entry .entry_id in ["r2scan-2" , "r2scan-7" ]:
1864
- assert "Replace R2SCAN energy with GGA" in entry .energy_adjustments [0 ].description
1864
+ assert "Replace r2SCAN energy with GGA" in entry .energy_adjustments [0 ].description
1865
1865
else :
1866
1866
assert "onto the GGA(+U) hull" in entry .energy_adjustments [0 ].description
1867
1867
@@ -1906,7 +1906,7 @@ def test_compat_args(self, ms_complete):
1906
1906
):
1907
1907
compat .get_adjustments (entry , state_data )
1908
1908
else :
1909
- with pytest .raises (CompatibilityError , match = "there is a matching R2SCAN " ):
1909
+ with pytest .raises (CompatibilityError , match = "there is a matching r2SCAN " ):
1910
1910
assert not compat .get_adjustments (entry , state_data )
1911
1911
1912
1912
for entry in ms_complete .scan_entries :
@@ -1952,7 +1952,7 @@ def test_multiple_matching_structures(self, mixing_scheme_no_compat, ms_complete
1952
1952
):
1953
1953
mixing_scheme_no_compat .get_adjustments (entry , ms_complete_duplicate_structs .state_data )
1954
1954
else :
1955
- with pytest .raises (CompatibilityError , match = "there is a matching R2SCAN " ):
1955
+ with pytest .raises (CompatibilityError , match = "there is a matching r2SCAN " ):
1956
1956
mixing_scheme_no_compat .get_adjustments (entry , ms_complete_duplicate_structs .state_data )
1957
1957
1958
1958
# process_entries should discard all GGA entries and return all R2SCAN
@@ -1996,10 +1996,10 @@ def test_alternate_structure_matcher(self, ms_complete):
1996
1996
):
1997
1997
compat .get_adjustments (entry , ms_complete .state_data )
1998
1998
else :
1999
- with pytest .raises (CompatibilityError , match = "there is a matching R2SCAN " ):
1999
+ with pytest .raises (CompatibilityError , match = "there is a matching r2SCAN " ):
2000
2000
compat .get_adjustments (entry , ms_complete .state_data )
2001
2001
2002
- # process_entries should discard all GGA entries except gga-6 and return all R2SCAN
2002
+ # process_entries should discard all GGA entries except gga-6 and return all r2SCAN
2003
2003
# entries unmodified. gga-6 should be corrected to the R2SCAN hull
2004
2004
entries = compat .process_entries (ms_complete .all_entries )
2005
2005
assert len (entries ) == 8
@@ -2014,6 +2014,14 @@ def test_processing_entries_inplace(self):
2014
2014
MaterialsProjectDFTMixingScheme ().process_entries (entries , inplace = False )
2015
2015
assert all (e .correction == e_copy .correction for e , e_copy in zip (entries , entries_copy , strict = True ))
2016
2016
2017
+ def test_run_type_variations (self ):
2018
+ """Test that entries with run_type 'r2SCAN' would not be ignored in mixing scheme correction."""
2019
+ scheme = MaterialsProjectDFTMixingScheme (run_type_1 = "GGA(+U)" , run_type_2 = "r2SCAN" )
2020
+ assert scheme .valid_rtypes_2 == ["r2SCAN" , "R2SCAN" ]
2021
+ """Test that 'r2SCAN' as an input run_type is not case-sensitive."""
2022
+ scheme = MaterialsProjectDFTMixingScheme (run_type_1 = "GGA(+U)" , run_type_2 = "R2SCAN" )
2023
+ assert scheme .valid_rtypes_2 == ["r2SCAN" , "R2SCAN" ]
2024
+
2017
2025
def test_check_potcar (self , ms_complete ):
2018
2026
"""Entries with invalid or missing POTCAR raise error by default but should be ignored if
2019
2027
check_potcar=False in MaterialsProjectDFTMixingScheme.
@@ -2058,7 +2066,7 @@ def test_state_complete_entries(self, mixing_scheme_no_compat, ms_complete):
2058
2066
):
2059
2067
mixing_scheme_no_compat .get_adjustments (entry , ms_complete .state_data )
2060
2068
else :
2061
- with pytest .raises (CompatibilityError , match = "there is a matching R2SCAN " ):
2069
+ with pytest .raises (CompatibilityError , match = "there is a matching r2SCAN " ):
2062
2070
mixing_scheme_no_compat .get_adjustments (entry , ms_complete .state_data )
2063
2071
2064
2072
# process_entries should discard all GGA entries and return all R2SCAN
@@ -2153,7 +2161,7 @@ def test_state_gga_1_scan_plus_novel(self, mixing_scheme_no_compat, ms_gga_1_sca
2153
2161
assert mixing_scheme_no_compat .get_adjustments (entry , ms_gga_1_scan_novel .state_data ) == []
2154
2162
2155
2163
for entry in ms_gga_1_scan_novel .scan_entries :
2156
- with pytest .raises (CompatibilityError , match = "no R2SCAN ground states at this composition" ):
2164
+ with pytest .raises (CompatibilityError , match = "no r2SCAN ground states at this composition" ):
2157
2165
mixing_scheme_no_compat .get_adjustments (entry , ms_gga_1_scan_novel .state_data )
2158
2166
2159
2167
entries = mixing_scheme_no_compat .process_entries (ms_gga_1_scan_novel .all_entries )
@@ -2190,7 +2198,7 @@ def test_state_gga_2_scan_same(self, mixing_scheme_no_compat, ms_gga_2_scan_same
2190
2198
):
2191
2199
mixing_scheme_no_compat .get_adjustments (entry , ms_gga_2_scan_same .state_data )
2192
2200
elif entry .entry_id == "gga-6" :
2193
- with pytest .raises (CompatibilityError , match = "there is a matching R2SCAN " ):
2201
+ with pytest .raises (CompatibilityError , match = "there is a matching r2SCAN " ):
2194
2202
mixing_scheme_no_compat .get_adjustments (entry , ms_gga_2_scan_same .state_data )
2195
2203
else :
2196
2204
assert mixing_scheme_no_compat .get_adjustments (entry , ms_gga_2_scan_same .state_data ) == []
@@ -2239,7 +2247,7 @@ def test_state_gga_2_scan_diff_match(self, mixing_scheme_no_compat, ms_gga_2_sca
2239
2247
):
2240
2248
mixing_scheme_no_compat .get_adjustments (entry , ms_gga_2_scan_diff_match .state_data )
2241
2249
elif entry .entry_id == "gga-7" :
2242
- with pytest .raises (CompatibilityError , match = "there is a matching R2SCAN " ):
2250
+ with pytest .raises (CompatibilityError , match = "there is a matching r2SCAN " ):
2243
2251
mixing_scheme_no_compat .get_adjustments (entry , ms_gga_2_scan_diff_match .state_data )
2244
2252
else :
2245
2253
assert mixing_scheme_no_compat .get_adjustments (entry , ms_gga_2_scan_diff_match .state_data ) == []
@@ -2273,7 +2281,7 @@ def test_state_gga_2_scan_diff_nomatch(self, mixing_scheme_no_compat, ms_gga_2_s
2273
2281
if entry .entry_id == "r2scan-8" :
2274
2282
# there is no matching GGA structure for r2scan-8, so there's no way
2275
2283
# to adjust its energy onto the GGA hull.
2276
- with pytest .raises (CompatibilityError , match = "entry and no R2SCAN ground state" ):
2284
+ with pytest .raises (CompatibilityError , match = "entry and no r2SCAN ground state" ):
2277
2285
mixing_scheme_no_compat .get_adjustments (entry , ms_gga_2_scan_diff_no_match .state_data )
2278
2286
elif entry .entry_id == "r2scan-4" :
2279
2287
# r2scan-4 energy is -7 eV/atom. Needs to be adjusted to -6 eV/atom (3 atoms)
@@ -2366,7 +2374,7 @@ def test_state_all_gga_scan_gs(self, mixing_scheme_no_compat, ms_all_gga_scan_gs
2366
2374
2367
2375
for entry in entries :
2368
2376
if entry .parameters ["run_type" ] == "GGA" :
2369
- assert "onto the R2SCAN hull" in entry .energy_adjustments [0 ].description
2377
+ assert "onto the r2SCAN hull" in entry .energy_adjustments [0 ].description
2370
2378
assert_allclose (pd_mixed .get_e_above_hull (entry ), gga_hull_e [entry .entry_id ])
2371
2379
else :
2372
2380
assert entry .correction == 0
@@ -2408,7 +2416,7 @@ def test_state_novel_scan_comp(self, mixing_scheme_no_compat, ms_all_gga_scan_gs
2408
2416
2409
2417
for entry in entries :
2410
2418
if entry .parameters ["run_type" ] == "GGA" :
2411
- assert "onto the R2SCAN hull" in entry .energy_adjustments [0 ].description
2419
+ assert "onto the r2SCAN hull" in entry .energy_adjustments [0 ].description
2412
2420
assert_allclose (pd_mixed .get_e_above_hull (entry ), gga_hull_e [entry .entry_id ])
2413
2421
else :
2414
2422
assert entry .correction == 0
0 commit comments