pymatgen.phasediagram.analyzer module

class PDAnalyzer(pd)[source]

Bases: object

A class for performing analyses on Phase Diagrams.

The algorithm is based on the work in the following papers:

  1. S. P. Ong, L. Wang, B. Kang, and G. Ceder, Li-Fe-P-O2 Phase Diagram from First Principles Calculations. Chem. Mater., 2008, 20(5), 1798-1807. doi:10.1021/cm702327g
  2. S. P. Ong, A. Jain, G. Hautier, B. Kang, G. Ceder, Thermal stabilities of delithiated olivine MPO4 (M=Fe, Mn) cathodes investigated using first principles calculations. Electrochem. Comm., 2010, 12(3), 427-430. doi:10.1016/j.elecom.2010.01.010

Initializes analyzer with a PhaseDiagram.

Parameters:pd – Phase Diagram to analyze.
get_chempot_range_map(elements, referenced=True, joggle=True)[source]

Returns a chemical potential range map for each stable entry.

  • elements – Sequence of elements to be considered as independent variables. E.g., if you want to show the stability ranges of all Li-Co-O phases wrt to uLi and uO, you will supply [Element(“Li”), Element(“O”)]
  • referenced – If True, gives the results with a reference being the energy of the elemental phase. If False, gives absolute values.
  • joggle (boolean) – Whether to joggle the input to avoid precision errors.

[simplices]}. The list of simplices are the sides of the N-1 dim polytope bounding the allowable chemical potential range of each entry.

Return type:

Returns a dict of the form {entry

get_chempot_range_stability_phase(target_comp, open_elt)[source]

returns a set of chemical potentials correspoding to the max and min chemical potential of the open element for a given composition. It is quite common to have for instance a ternary oxide (e.g., ABO3) for which you want to know what are the A and B chemical potential leading to the highest and lowest oxygen chemical potential (reducing and oxidizing conditions). This is useful for defect computations.

  • target_comp – A Composition object
  • open_elt – Element that you want to constrain to be max or min

(mu_min,mu_max)}: Chemical potentials are given in “absolute” values (i.e., not referenced to 0)

Return type:


get_critical_compositions(comp1, comp2)[source]

Get the critical compositions along the tieline between two compositions. I.e. where the decomposition products change. The endpoints are also returned. :param comp1, comp2: compositions that define the tieline :type comp1, comp2: Composition

list of critical compositions. All are of
the form x * comp1 + (1-x) * comp2
Return type:[(Composition)]
get_decomp_and_e_above_hull(entry, allow_negative=False)[source]

Provides the decomposition and energy above convex hull for an entry. Due to caching, can be much faster if entries with the same composition are processed together.

  • entry – A PDEntry like object
  • allow_negative – Whether to allow negative e_above_hulls. Used to calculate equilibrium reaction energies. Defaults to False.

(decomp, energy above convex hull) Stable entries should have energy above hull of 0. The decomposition is provided as a dict of {Entry: amount}.


Provides the decomposition at a particular composition.

Parameters:comp – A composition
Return type:Decomposition as a dict of {Entry

Provides the energy above convex hull for an entry

Parameters:entry – A PDEntry like object
Returns:Energy above convex hull of entry. Stable entries should have energy above hull of 0.
get_element_profile(element, comp, comp_tol=1e-05)[source]

Provides the element evolution data for a composition. For example, can be used to analyze Li conversion voltages by varying uLi and looking at the phases formed. Also can be used to analyze O2 evolution by varying uO2.

  • element – An element. Must be in the phase diagram.
  • comp – A Composition
  • comp_tol – The tolerance to use when calculating decompositions. Phases with amounts less than this tolerance are excluded. Defaults to 1e-5.

[ {‘chempot’: -10.487582010000001, ‘evolution’: -2.0, ‘reaction’: Reaction Object], ...]

Return type:

Evolution data as a list of dictionaries of the following format


Provides the reaction energy of a stable entry from the neighboring equilibrium stable entries (also known as the inverse distance to hull).

Parameters:entry – A PDEntry like object
Returns:Equilibrium reaction energy of entry. Stable entries should have equilibrium reaction energy <= 0.
get_facet_chempots(*args, **kwargs)
Parameters:comp (Composition) – Input composition
Returns:Energy of lowest energy equilibrium at desired composition. Not normalized by atoms, i.e. E(Li4O2) = 2 * E(Li2O)

Get the critical chemical potentials for an element in the Phase Diagram.

Parameters:element – An element. Has to be in the PD in the first place.
Returns:A sorted sequence of critical chemical potentials, from less negative to more negative.
getmu_vertices_stability_phase(target_comp, dep_elt, tol_en=0.01)[source]

returns a set of chemical potentials corresponding to the vertices of the simplex in the chemical potential phase diagram. The simplex is built using all elements in the target_composition except dep_elt. The chemical potential of dep_elt is computed from the target composition energy. This method is useful to get the limiting conditions for defects computations for instance.

  • target_comp – A Composition object
  • dep_elt – the element for which the chemical potential is computed from the energy of
  • stable phase at the target composition (the) –
  • tol_en – a tolerance on the energy to set

mu}]: An array of conditions on simplex vertices for which each element has a chemical potential set to a given value. “absolute” values (i.e., not referenced to element energies)

Return type:


numerical_tol = 1e-08