File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22from pathlib import Path
33
44from emmet .core .settings import EmmetSettings
5+ from emmet .core .types .enums import ThermoType
56from pydantic import Field , field_validator
67from pydantic_settings import BaseSettings , SettingsConfigDict
78from pymatgen .core import _load_pmg_settings
89
910from mp_api .client import __file__ as root_dir
1011
12+ DEFAULT_THERMOTYPE = ThermoType ("GGA_GGA+U_R2SCAN" )
13+ DEFAULT_THERMOTYPE_CRITERIA = {"thermo_types" : [DEFAULT_THERMOTYPE .value ]}
14+
1115PMG_SETTINGS = _load_pmg_settings ()
1216_NUM_PARALLEL_REQUESTS = min (PMG_SETTINGS .get ("MPRESTER_NUM_PARALLEL_REQUESTS" , 4 ), 4 )
1317_MAX_RETRIES = min (PMG_SETTINGS .get ("MPRESTER_MAX_RETRIES" , 3 ), 3 )
Original file line number Diff line number Diff line change 3232 MPRestWarning ,
3333 _emit_status_warning ,
3434)
35- from mp_api .client .core .settings import MAPI_CLIENT_SETTINGS
35+ from mp_api .client .core .settings import (
36+ DEFAULT_THERMOTYPE ,
37+ DEFAULT_THERMOTYPE_CRITERIA ,
38+ MAPI_CLIENT_SETTINGS ,
39+ )
3640from mp_api .client .core .utils import LazyImport , load_json , validate_ids
3741from mp_api .client .routes import GENERIC_RESTERS
3842from mp_api .client .routes .materials import MATERIALS_RESTERS
5862 from mp_api .client .core .client import QueryBuilderWithCache
5963 from mp_api .client .core .schemas import _DictLikeAccess
6064
61- DEFAULT_THERMOTYPE = ThermoType ("GGA_GGA+U_R2SCAN" )
62- DEFAULT_THERMOTYPE_CRITERIA = {"thermo_types" : [DEFAULT_THERMOTYPE .value ]}
6365
6466RESTER_LAYOUT = {
6567 "molecules/core" : LazyImport (
Original file line number Diff line number Diff line change 1313
1414from mp_api .client .core import BaseRester
1515from mp_api .client .core .exceptions import MPRestError
16+ from mp_api .client .core .settings import DEFAULT_THERMOTYPE
1617from mp_api .client .core .utils import validate_ids
1718
1819if TYPE_CHECKING :
@@ -185,13 +186,14 @@ def search(
185186 )
186187
187188 def get_phase_diagram_from_chemsys (
188- self , chemsys : str , thermo_type : ThermoType | str
189+ self , chemsys : str , thermo_type : ThermoType | str = DEFAULT_THERMOTYPE
189190 ) -> PhaseDiagram :
190191 """Get a pre-computed phase diagram for a given chemsys.
191192
192193 Arguments:
193194 chemsys (str): A chemical system (e.g. Li-Fe-O)
194195 thermo_type (ThermoType): The thermo type for the phase diagram.
196+ Defaults to ThermoType.GGA_GGA_U_R2SCAN.
195197
196198 Returns:
197199 (PhaseDiagram): Pymatgen phase diagram object.
You can’t perform that action at this time.
0 commit comments