Chempots#

class Chempots(chempots_dict, ndecimals=None)[source]#

Bases: MSONable

Class 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

as_dict

Json-serializable dict representation of a Chempots object.

copy

from_dict

Constructor of Chempots object from dictionary representation.

from_pmg_elements

Construct a Chempots object from a dictionary in the format {Element:value}.

get_absolute

Get Chempots object with chemical potentials converted to absolute values (mu + mu_ref).

get_referenced

Get Chempots object with chemical potentials converted to referenced values (mu - mu_ref).

items

keys

load

Load an instance from a JSON file written by save().

save

Serialize the instance to JSON on disk, pickling fields if needed.

to_json

Returns a json string representation of the MSONable object.

to_pmg_elements

Convert the Chempots object to a dictionary in the format {Element:value}.

unsafe_hash

Return a hash of the current object.

update

validate_monty_v1

Pydantic validator with correct signature for pydantic v1.x.

validate_monty_v2

Pydantic validator with correct signature for pydantic v2.x.

values

Attributes

REDIRECT

mu

Dictionary 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

copy()[source]#
static from_dict(d)[source]#

Constructor of Chempots object from dictionary representation.

Parameters:

d (dict)

Returns:

chempots – Chempots object.

Return type:

Chempots

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:

Chempots

get_absolute(mu_refs)[source]#

Get Chempots object with chemical potentials converted to absolute values (mu + mu_ref).

Parameters:

mu_refs (dict or Chempots) – Chempots object or just dictionary with elemental chemical potentials (mu0).

Returns:

chempots – Chempots values converted to absolute (mu + mu_ref).

Return type:

Chempots

get_referenced(mu_refs)[source]#

Get Chempots object with chemical potentials converted to referenced values (mu - mu_ref).

Parameters:

mu_refs (dict or Chempots) – Chempots object or just dictionary with elemental chemical potentials (mu0).

Returns:

chempots – Chempots values converted to referenced (mu - mu_ref).

Return type:

Chempots

items()[source]#
keys()[source]#
property mu#

Dictionary with chemical potentials

to_pmg_elements()[source]#

Convert the Chempots object to a dictionary in the format {Element:value}. Useful to interface with pymatgen which uses Element class to address elements instead of just their symbols.

Returns:

d – Dictionary in the format {Element:value}

Return type:

dict

update(other)[source]#
values()[source]#