Chempots#
- class Chempots(chempots_dict, ndecimals=None)[source]#
Bases:
MSONableClass to handle set of chemical potentials. Behaves like a python dictionary. The dictionary needs to be set with element symbols as keys and chemical potentials as values.
- Parameters:
chempots_dict (dict) – Dictionary of chemical potentials in the format {el:value}.
ndecimals (int) – Round the chemical potentials to this number of decimals. If None the numbers are left untouched.
Methods
Json-serializable dict representation of a Chempots object.
Constructor of Chempots object from dictionary representation.
Construct a Chempots object from a dictionary in the format {Element:value}.
Get Chempots object with chemical potentials converted to absolute values (mu + mu_ref).
Get Chempots object with chemical potentials converted to referenced values (mu - mu_ref).
loadLoad an instance from a JSON file written by
save().saveSerialize the instance to JSON on disk, pickling fields if needed.
to_jsonReturns a json string representation of the MSONable object.
Convert the Chempots object to a dictionary in the format {Element:value}.
unsafe_hashReturn a hash of the current object.
validate_monty_v1Pydantic validator with correct signature for pydantic v1.x.
validate_monty_v2Pydantic validator with correct signature for pydantic v2.x.
Attributes
REDIRECTDictionary with chemical potentials
- as_dict()[source]#
Json-serializable dict representation of a Chempots object.
- Returns:
d – Json-serializable dict of a Chempots object.
- Return type:
dict
- static from_dict(d)[source]#
Constructor of Chempots object from dictionary representation.
- Parameters:
d (dict)
- Returns:
chempots – Chempots object.
- Return type:
- static from_pmg_elements(d)[source]#
Construct a Chempots object from a dictionary in the format {Element:value}. Useful to interface with pymatgen which uses Element class to address elements instead of just their symbols.
- Parameters:
d (dict) – Dictionary in the format {Element:value}.
- Returns:
chempots – Chempots object.
- Return type:
- get_absolute(mu_refs)[source]#
Get Chempots object with chemical potentials converted to absolute values (mu + mu_ref).
- get_referenced(mu_refs)[source]#
Get Chempots object with chemical potentials converted to referenced values (mu - mu_ref).
- property mu#
Dictionary with chemical potentials