StabilityDiagram#
- class StabilityDiagram(phase_diagram=None, size=1)[source]#
Bases:
objectClass with tools to add features to default PD plots generated by Pymatgen.
- Parameters:
phase_diagram (PhaseDiagram) – Pymatgen PhaseDiagram object.
size (float) – Multiplier for the size of the objects added in the plot.
Methods
Add line of constant chemical potential (at a given composition) to the plot.
Add heatmap that shows the value of the last chemical potential based on the values of the other two "free" chemical potentials and the composition of interest.
Add points to plot representing reservoirs.
Add reservoirs as points on the stability diagram.
Function that expresses line of constant chemical potential of a given composition.
Method to get stability diagram with 'get_chempot_range_map_plot' method in pymatgen.
- add_constant_chempot_line(comp, variable_element, chempots_ref, **kwargs)[source]#
Add line of constant chemical potential (at a given composition) to the plot. Only works for 3 component PD.
- Parameters:
comp (str or Composition) – Composition of the phase.
variable_element (str) – Element chosen as indipendent variable.
chempots_ref (dict) – Dictionary with fixed chemical potentials (values relative to reference phase). The format is {Element:chempot}.
**kwargs – kwargs passed to Matplotlib plot function.
- Returns:
plt – Matplotlib object.
- Return type:
matlotlib
- add_heatmap(comp, elements, cbar_label='$\\Delta \\mu_{O}$', cbar_values=True, **kwargs)[source]#
Add heatmap that shows the value of the last chemical potential based on the values of the other two “free” chemical potentials and the composition of interest. Currently works only for 3 component PDs.
- Parameters:
comp (str or Composition) – Composition of interest to compute the chemical potential.
elements (list) – List of strings with elements with free chemical potentials.
cbar_label (str) – String with label of the colormap. The default is ‘’.
cbar_values (tuple or bool) – Show max e min chempot values on colorbar. If tuple the values are used, if not the minimum chempot and 0 are used. The default is True.
**kwargs (dict) – kwargs for “pcolormesh” function.
- Returns:
plt – Matplotlib object.
- Return type:
matplotlib
- add_points(points, size=1, label_size=1, color=[], edgecolor='k', label_color='k', linewidths=3, **kwargs)[source]#
Add points to plot representing reservoirs.
- Parameters:
points (dict) – Dictionary with points labels as keys and tuples or list with coordinates as values.
size (float) – Float multiplier for points size. Default is 1, which would yield a default size of 450*self.size
label_size (float) – Float multiplier for labels size. Default is 1, which would yield a default size of 30*self.size
color (str) – Color of filling of points
edgecolor (str) – Color of point edge
label_color (str) – Color of labels
linewidths (int) – line width of point edge
kwargs (dict) – kwargs to pass to matplotlib scatter function.
- Returns:
plt – Matplotlib object.
- Return type:
matplotlib
- add_reservoirs(reservoirs, elements, size=1, label_size=1, color=[], edgecolor='k', label_color='k', linewidths=3, **kwargs)[source]#
Add reservoirs as points on the stability diagram.
- Parameters:
reservoirs (Reservoirs) – Reservoirs object.
elements (list) – List with strings of the elements to be used as free variables.
size (float) – Float multiplier for points size. Default is 1, which would yield a default size of 450*self.size
label_size (float) – Float multiplier for labels size. Default is 1, which would yield a default size of 30*self.size
color (str) – Color of filling of points
edgecolor (str) – Color of point edge
label_color (str) – Color of labels
linewidths (3) – line width of point edge
kwargs (dict) – kwargs to pass to matplotlib scatter function.
- Returns:
plt – Matplotlib object.
- Return type:
matplotlib
- constant_chempot_line(mu, comp, variable_element, chempots_ref)[source]#
Function that expresses line of constant chemical potential of a given composition. Only works for 3-component PD.
- Parameters:
mu (float) – Indipendent variable of chemical potential.
comp (str or Composition) – Composition of the phase.
variable_element (Pymatgen Element object) – Element chosen as indipendent variable.
chempots_ref (dict) – Dictionary with fixed chemical potentials (values relative to reference phase). The format is {Element:chempot}.
- Returns:
chempot – Chemical potential in eV.
- Return type:
float
- get_plot(elements, figsize=None)[source]#
Method to get stability diagram with ‘get_chempot_range_map_plot’ method in pymatgen.
- Parameters:
elements (list) – List with strings of the elements to be used as free variables.
figsize (tuple) – New size in inches.
- Returns:
plt – Matplotlib object.
- Return type:
matplotlib