reservoirs#

Collection of chemical potential sets

Classes

PressureReservoirs(res_dict[, temperature, ...])

Subclass of Reservoirs which contains temperature information.

Reservoirs(res_dict[, phase_diagram, ...])

Class to handle dictionaries of chemical potentials.

class PressureReservoirs(res_dict, temperature=None, phase_diagram=None, mu_refs=None, are_chempots_delta=False)[source]#

Bases: Reservoirs

Subclass of Reservoirs which contains temperature information. Useful for partial pressure analysis.

Class to handle dictionaries of chemical potentials. Works almost completely like a python dictionary.

Parameters:
  • res_dict (dict) – Dictionary with reservoir names as key and dictionaries of chemical potentials as values.

  • phase_diagram (PhaseDiagram) – PhaseDiagram object, useful to convert absolute chempots in referenced chempots.

  • mu_refs (dict) – Dictionary with chemical potentials of reference elements ({Element:chempot}). If the PhaseDiagram is provided mu_refs is taken from the mu_refs attribute.

  • are_chempots_delta (bool) – Set this variable to True if chempots in dictionary are referenced values.

as_dict()[source]#

Json-serializable dict representation of a PressureReservoirs object. The Pymatgen element is expressed with the symbol of the element.

Returns:

d – Json-serializable dict of a PressureReservoirs object.

Return type:

dict

classmethod from_dict(d)[source]#

Constructor of PressureReservoirs object from dictionary representation.

Parameters:

d (dict)

Return type:

PressureReservoirs object.

static from_json(path_or_string)[source]#

Build PressureReservoirs object from json file or string.

Parameters:

path_or_string (str) – If an existing path to a file is given the object is constructed reading the json file. Otherwise it will be read as a string.

Return type:

PressureReservoir object.

class Reservoirs(res_dict, phase_diagram=None, mu_refs=None, are_chempots_delta=False)[source]#

Bases: MSONable

Class to handle dictionaries of chemical potentials. Works almost completely like a python dictionary.

Parameters:
  • res_dict (dict) – Dictionary with reservoir names as key and dictionaries of chemical potentials as values.

  • phase_diagram (PhaseDiagram) – PhaseDiagram object, useful to convert absolute chempots in referenced chempots.

  • mu_refs (dict) – Dictionary with chemical potentials of reference elements ({Element:chempot}). If the PhaseDiagram is provided mu_refs is taken from the mu_refs attribute.

  • are_chempots_delta (bool) – Set this variable to True if chempots in dictionary are referenced values.

property are_chempots_delta#
as_dict()[source]#

Json-serializable dict representation of a Reservoirs object.

Returns:

d – Json-serializable dict of a Reservoirs object.

Return type:

dict

copy()[source]#
filter_reservoirs(inplace=False, elements=None)[source]#

Get new Reservoir object filtering the chempots dictionary.

Parameters:
  • inplace (bool) – Apply changes to current Reservoirs object.

  • elements (list) – List of element symbols.

Returns:

res – Reservoirs object.

Return type:

Reservoirs

classmethod from_dict(d)[source]#

Constructor of Reservoirs object from dictionary representation.

Parameters:

d (dict) – Json-serializable dict of a Reservoirs object.

Returns:

reservoirs – Reservoirs object.

Return type:

Reservoirs

static from_json(path_or_string)[source]#

Build Reservoirs object from json file or string.

Parameters:

path_or_string (str) – If an existing path to a file is given the object is constructed reading the json file. Otherwise it will be read as a string.

Return type:

Reservoir object.

get_absolute_res_dict()[source]#

Return values of chempots from referenced to absolute

get_dataframe(format_symbols=False, format_compositions=False, all_math=False, ndecimals=None)[source]#

Get DataFrame object of the dictionary of reservoirs.

Parameters:
  • format_symbols (bool) – Format labels of element chempots in latex math format.

  • format_compositions (bool) – Get Latex format of compositions.

  • all_math (bool) – Get all characters in composition written in latex’s math format.

  • ndecimals (int) – Number of decimals to round the chemical potentials, if None the numbers are not changed.

Returns:

df – DataFrame object.

Return type:

DataFrame

get_latex_table(ndecimals=1)[source]#

Get string with formatted latex table of chemical potentials.

get_plot(elements, size=1, **kwargs)[source]#

Plot the stability diagram with the reservoir points.

Parameters:
  • elements (list) – List of strings with element symbols on the diagram axis.

  • size (float) – Size of the points. The default is 1.

  • **kwargs (dict) – Kwargs for the add_reservoirs function.

Return type:

Matplotlib object.

get_referenced_res_dict()[source]#

Return values of chempots from absolute to referenced

items()[source]#
keys()[source]#
set_to_absolute()[source]#

Set reservoir dictionary to absolute values of chempots.

set_to_referenced()[source]#

Set reservoir dictionary to referenced values of chempots.

to_json(path, cls=<class 'monty.json.MontyEncoder'>)[source]#

Save Reservoirs object as json string or file

Parameters:
  • path (str) – Path to the destination file. If None a string is exported.

  • cls (cls) – Encoder class for json.dump. The default is MontyEncoder.

Returns:

d – If path is not set a string is returned.

Return type:

str

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