Skip to content

Commit

Permalink
Revise regex pattern of tests, replacing 'R2SCAN' with 'r2SCAN', acco…
Browse files Browse the repository at this point in the history
…rding to the updated mixing scheme class
  • Loading branch information
peikai committed Jan 20, 2025
1 parent b998556 commit 0a47653
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/entries/test_mixing_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -1844,10 +1844,10 @@ def test_fuzzy_matching(self, ms_complete):
with pytest.raises(CompatibilityError, match="ground state"):
compat.get_adjustments(entry, mixing_state)
elif entry.entry_id == "r2scan-3":
with pytest.raises(CompatibilityError, match="and no R2SCAN ground state"):
with pytest.raises(CompatibilityError, match="and no r2SCAN ground state"):
compat.get_adjustments(entry, mixing_state)
elif entry.entry_id in ["gga-2", "gga-5", "gga-6", "gga-7"]:
with pytest.raises(CompatibilityError, match="there is a matching R2SCAN"):
with pytest.raises(CompatibilityError, match="there is a matching r2SCAN"):
compat.get_adjustments(entry, mixing_state)
elif entry.parameters["run_type"] == "GGA":
assert not compat.get_adjustments(entry, mixing_state)
Expand Down Expand Up @@ -1999,7 +1999,7 @@ def test_alternate_structure_matcher(self, ms_complete):
with pytest.raises(CompatibilityError, match="there is a matching R2SCAN"):
compat.get_adjustments(entry, ms_complete.state_data)

# process_entries should discard all GGA entries except gga-6 and return all R2SCAN
# process_entries should discard all GGA entries except gga-6 and return all r2SCAN
# entries unmodified. gga-6 should be corrected to the R2SCAN hull
entries = compat.process_entries(ms_complete.all_entries)
assert len(entries) == 8
Expand All @@ -2018,7 +2018,7 @@ def test_run_type_variations(self):
"""Test that entries with a run_type of either 'r2SCAN' or 'R2SCAN' could be valid for mixing scheme correction"""
scheme = MaterialsProjectDFTMixingScheme(run_type_1="GGA(+U)", run_type_2="r2SCAN")
assert scheme.valid_rtypes_2 == ["r2SCAN", "R2SCAN"]
scheme = MaterialsProjectDFTMixingScheme(run_type_1="r2SCAN", run_type_2="GGA(+U)")
scheme = MaterialsProjectDFTMixingScheme(run_type_1="GGA(+U)", run_type_2="R2SCAN")
assert scheme.valid_rtypes_1 == ["r2SCAN", "R2SCAN"]

def test_check_potcar(self, ms_complete):
Expand Down Expand Up @@ -2160,7 +2160,7 @@ def test_state_gga_1_scan_plus_novel(self, mixing_scheme_no_compat, ms_gga_1_sca
assert mixing_scheme_no_compat.get_adjustments(entry, ms_gga_1_scan_novel.state_data) == []

for entry in ms_gga_1_scan_novel.scan_entries:
with pytest.raises(CompatibilityError, match="no R2SCAN ground states at this composition"):
with pytest.raises(CompatibilityError, match="no r2SCAN ground states at this composition"):
mixing_scheme_no_compat.get_adjustments(entry, ms_gga_1_scan_novel.state_data)

entries = mixing_scheme_no_compat.process_entries(ms_gga_1_scan_novel.all_entries)
Expand Down Expand Up @@ -2246,7 +2246,7 @@ def test_state_gga_2_scan_diff_match(self, mixing_scheme_no_compat, ms_gga_2_sca
):
mixing_scheme_no_compat.get_adjustments(entry, ms_gga_2_scan_diff_match.state_data)
elif entry.entry_id == "gga-7":
with pytest.raises(CompatibilityError, match="there is a matching R2SCAN"):
with pytest.raises(CompatibilityError, match="there is a matching r2SCAN"):
mixing_scheme_no_compat.get_adjustments(entry, ms_gga_2_scan_diff_match.state_data)
else:
assert mixing_scheme_no_compat.get_adjustments(entry, ms_gga_2_scan_diff_match.state_data) == []
Expand Down Expand Up @@ -2280,7 +2280,7 @@ def test_state_gga_2_scan_diff_nomatch(self, mixing_scheme_no_compat, ms_gga_2_s
if entry.entry_id == "r2scan-8":
# there is no matching GGA structure for r2scan-8, so there's no way
# to adjust its energy onto the GGA hull.
with pytest.raises(CompatibilityError, match="entry and no R2SCAN ground state"):
with pytest.raises(CompatibilityError, match="entry and no r2SCAN ground state"):
mixing_scheme_no_compat.get_adjustments(entry, ms_gga_2_scan_diff_no_match.state_data)
elif entry.entry_id == "r2scan-4":
# r2scan-4 energy is -7 eV/atom. Needs to be adjusted to -6 eV/atom (3 atoms)
Expand Down Expand Up @@ -2373,7 +2373,7 @@ def test_state_all_gga_scan_gs(self, mixing_scheme_no_compat, ms_all_gga_scan_gs

for entry in entries:
if entry.parameters["run_type"] == "GGA":
assert "onto the R2SCAN hull" in entry.energy_adjustments[0].description
assert "onto the r2SCAN hull" in entry.energy_adjustments[0].description
assert_allclose(pd_mixed.get_e_above_hull(entry), gga_hull_e[entry.entry_id])
else:
assert entry.correction == 0
Expand Down Expand Up @@ -2415,7 +2415,7 @@ def test_state_novel_scan_comp(self, mixing_scheme_no_compat, ms_all_gga_scan_gs

for entry in entries:
if entry.parameters["run_type"] == "GGA":
assert "onto the R2SCAN hull" in entry.energy_adjustments[0].description
assert "onto the r2SCAN hull" in entry.energy_adjustments[0].description
assert_allclose(pd_mixed.get_e_above_hull(entry), gga_hull_e[entry.entry_id])
else:
assert entry.correction == 0
Expand Down

0 comments on commit 0a47653

Please sign in to comment.