Skip to content

Commit 68d6d2c

Browse files
clean up docstr, ensure all thermo stuff uses mixed GGA_GGA_U_R2SCAN hull as default
1 parent 3032b80 commit 68d6d2c

2 files changed

Lines changed: 45 additions & 7 deletions

File tree

mp_api/client/mprester.py

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
from mp_api.client.core.client import QueryBuilderWithCache
5959
from mp_api.client.core.schemas import _DictLikeAccess
6060

61-
DEFAULT_THERMOTYPE_CRITERIA = {"thermo_types": ["GGA_GGA+U_R2SCAN"]}
61+
DEFAULT_THERMOTYPE = ThermoType("GGA_GGA+U_R2SCAN")
62+
DEFAULT_THERMOTYPE_CRITERIA = {"thermo_types": [DEFAULT_THERMOTYPE.value]}
6263

6364
RESTER_LAYOUT = {
6465
"molecules/core": LazyImport(
@@ -1069,8 +1070,8 @@ def get_entries_in_chemsys(
10691070
(i.e., all LixOy, FexOy, LixFey, LixFeyOz, Li, Fe and O phases). Extremely
10701071
useful for creating phase diagrams of entire chemical systems.
10711072
1072-
Note that by default this returns mixed GGA/GGA+U entries. For others,
1073-
pass GGA/GGA+U/R2SCAN, or R2SCAN as thermo_types in additional_criteria.
1073+
Note that by default this returns mixed GGA/GGA+U/r2SCAN entries. For others,
1074+
pass GGA/GGA+U, or R2SCAN as thermo_types in additional_criteria.
10741075
10751076
Args:
10761077
elements (str or [str]): Parent chemical system string comprising element
@@ -1594,8 +1595,26 @@ def _get_cohesive_energy(
15941595
def get_stability(
15951596
self,
15961597
entries: list[ComputedEntry | ComputedStructureEntry | PDEntry],
1597-
thermo_type: str | ThermoType = ThermoType.GGA_GGA_U,
1598+
thermo_type: str | ThermoType = DEFAULT_THERMOTYPE,
15981599
) -> list[dict[str, Any]] | None:
1600+
"""Get the energy above hull of a list of entries.
1601+
1602+
Args:
1603+
entries (list of ComputedEntry or ComputedStructureEntry or PDEntry) :
1604+
List of entries with energy and composition information to compute
1605+
hull energies.
1606+
thermo_type (str or ThermoType) : The hull type to use.
1607+
Defaults to ThermoType.GGA_GGA_U_R2SCAN.
1608+
1609+
Returns:
1610+
list of dict:
1611+
{
1612+
"e_above_hull": float, # energy above the hull
1613+
"composition": dict[str,float], # composition as dict
1614+
"energy": float, # energy with mixing / corrections
1615+
"entry_id": str, # optional identifier
1616+
}
1617+
"""
15991618
chemsys: set[SpeciesLike] = {
16001619
ele for entry in entries for ele in entry.composition.elements
16011620
}
@@ -1659,8 +1678,29 @@ def get_oxygen_evolution(
16591678
self,
16601679
material_id: str | MPID | AlphaID,
16611680
working_ion: str | Element,
1662-
thermo_type: str | ThermoType = ThermoType.GGA_GGA_U,
1681+
thermo_type: str | ThermoType = DEFAULT_THERMOTYPE,
16631682
) -> dict[str, np.ndarray]:
1683+
"""Get the amount of O2 evolved at a range of temperatures.
1684+
1685+
Args:
1686+
material_id (str, MPID, or AlphaID) : identifier of the material to compute
1687+
working_ion (str or Element) : The working ion of the battery material
1688+
thermo_type (str or ThermoType) : The hull type to use.
1689+
Defaults to ThermoType.GGA_GGA_U_R2SCAN.
1690+
1691+
Returns:
1692+
dict of str to np.ndarray :
1693+
{
1694+
"mu": np.ndarray[float], # the chemical potential in eV/atom
1695+
"reaction": np.ndarray[str], # the redox reaction
1696+
"evolution": np.ndarray[float], # the number of O2 evolved in the redox, per formula unit
1697+
"temperature": np.ndarray[float], # the temperature in K
1698+
}
1699+
1700+
Raises:
1701+
ValueError : If no insertion electrode data for the combination of material_id
1702+
and working_ion could be found, or if the entry contains no oxygen.
1703+
"""
16641704
working_ion = (
16651705
Element[working_ion] if isinstance(working_ion, str) else working_ion
16661706
)

mp_api/client/routes/materials/thermo.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,6 @@ def get_phase_diagram_from_chemsys(
192192
Arguments:
193193
chemsys (str): A chemical system (e.g. Li-Fe-O)
194194
thermo_type (ThermoType): The thermo type for the phase diagram.
195-
Defaults to ThermoType.GGA_GGA_U.
196-
197195
198196
Returns:
199197
(PhaseDiagram): Pymatgen phase diagram object.

0 commit comments

Comments
 (0)