diff --git a/mp_api/client/mprester.py b/mp_api/client/mprester.py index 146a4fe1..ece9d7bc 100644 --- a/mp_api/client/mprester.py +++ b/mp_api/client/mprester.py @@ -58,7 +58,7 @@ from mp_api.client.core.client import _DictLikeAccess -DEFAULT_THERMOTYPE_CRITERIA = {"thermo_types": ["GGA_GGA+U"]} +DEFAULT_THERMOTYPE_CRITERIA = {"thermo_types": ["GGA_GGA+U_R2SCAN"]} RESTER_LAYOUT = { "molecules/core": LazyImport( @@ -1032,7 +1032,7 @@ def get_entries_in_chemsys( compatible_only: bool = True, property_data: list[str] | None = None, conventional_unit_cell: bool = False, - additional_criteria: dict = DEFAULT_THERMOTYPE_CRITERIA, + additional_criteria: dict | None = None, **kwargs, ) -> list[ComputedStructureEntry] | list[GibbsComputedStructureEntry]: """Helper method to get a list of ComputedEntries in a chemical system. @@ -1091,6 +1091,17 @@ def get_entries_in_chemsys( for els in itertools.combinations(elements_set, i + 1) ] + if additional_criteria is None: + warnings.warn( + "The default thermo type when retrieving entries has been changed from " + "the mixed/corrected PBE GGA and GGA+U hull (`thermo_type = GGA_GGA+U`) " + "to the joint PBE GGA / GGA+U / r2SCAN hull (`thermo_type = GGA_GGA+U_R2SCAN`). " + "To use the older behavior, call `get_entries_in_chemsys` with " + '`additional_criteria = {"thermo_types": ["GGA_GGA+U"]}`', + category=MPRestWarning, + stacklevel=2, + ) + entries = self.get_entries( all_chemsyses, compatible_only=compatible_only, diff --git a/tests/client/test_mprester.py b/tests/client/test_mprester.py index 38efd6e0..fd23b5c4 100644 --- a/tests/client/test_mprester.py +++ b/tests/client/test_mprester.py @@ -260,7 +260,10 @@ def test_get_entries(self, mpr): def test_get_entries_in_chemsys(self, mpr): syms = ["Li", "Fe", "O"] syms2 = "Li-Fe-O" - entries = mpr.get_entries_in_chemsys(syms) + with pytest.warns( + MPRestWarning, match="The default thermo type when retrieving entries" + ): + entries = mpr.get_entries_in_chemsys(syms) entries2 = mpr.get_entries_in_chemsys(syms2) elements = {Element(sym) for sym in syms} for e in entries: @@ -325,7 +328,9 @@ def test_get_pourbaix_entries(self, mpr): reason="`pip install mpcontribs-client` to use pourbaix functionality.", ) def test_get_ion_entries(self, mpr): - entries = mpr.get_entries_in_chemsys("Ti-O-H") + entries = mpr.get_entries_in_chemsys( + "Ti-O-H", additional_criteria={"thermo_types": ["GGA_GGA+U"]} + ) pd = PhaseDiagram(entries) ion_entry_data = mpr.get_ion_reference_data_for_chemsys("Ti-O-H") ion_entries = mpr.get_ion_entries(pd, ion_entry_data) @@ -337,7 +342,9 @@ def test_get_ion_entries(self, mpr): assert len(bi_v_entry_data) == len(bi_data + v_data) # test an incomplete phase diagram - entries = mpr.get_entries_in_chemsys("Ti-O") + entries = mpr.get_entries_in_chemsys( + "Ti-O", additional_criteria={"thermo_types": ["GGA_GGA+U"]} + ) pd = PhaseDiagram(entries) with pytest.raises(ValueError, match="The phase diagram chemical system"): mpr.get_ion_entries(pd) @@ -351,7 +358,8 @@ def test_get_ion_entries(self, mpr): itertools.chain.from_iterable(i.elements for i in ion_ref_comps) ) ion_ref_entries = mpr.get_entries_in_chemsys( - [*map(str, ion_ref_elts), "O", "H"] + [*map(str, ion_ref_elts), "O", "H"], + additional_criteria={"thermo_types": ["GGA_GGA+U"]}, ) mpc = MaterialsProjectAqueousCompatibility() ion_ref_entries = mpc.process_entries(ion_ref_entries)