Plotting a pourbaix diagram using the Materials Project API

If you use this infrastructure, please consider citing the following work:

K. A. Persson, B. Waldwick, P. Lazic and G. Ceder, Phys. Rev. B, 2012, 85, 235438.

A. K. Singh, L. Zhou, A. Shinde, S. K. Suram, J. H. Montoya, D. Winston, J. M. Gregoire and K. A. Persson, Chem. Mater., 2017, DOI: acs.chemmater.7b03980.

Notebook Author: Joseph Montoya


The Materials Project REST interface includes functionality to construct pourbaix diagrams from computed entries. Note that the Pourbaix infrastructure is still undergoing revision, but now includes a simplified interface that enables MP and pymatgen users to fetch entries that have been processed according to the Materials Project Aqueous Compatibility scheme. Thus, users can reproduce web Pourbaix diagrams in two or three steps in pymatgen.

To retrieve entries necessary to construct a Pourbaix Diagram use MPRester.get_pourbaix_entries(LIST_OF_ENTRIES) with a list of entries comprising your chemical system. It is not necessary to include 'O' and 'H' in your list, as they are added automatically. This function also contains all of necessary preprocessing to ensure the PourbaixEntries are compatible with the pymatgen PourbaixDiagram constructor.

Pourbaix diagrams can be constructed using PourbaixDiagram(RETRIEVED_ENTRIES) as below. Note that a comp_dict keyword argument may also be supplied to the PourbaixDiagram constructor if a fixed composition for a multi-element pourbaix diagram is desired.

The PourbaixAnalyzer includes a number of useful functions for determining stable species and stability of entries relative to a given pourbaix facet (i.e. as a function of pH and V).

This suggests that CuO, for example, has a large driving force for decomposition at neutral pH and mildly reducing conditions.

To see this in more detail, we can plot the pourbaix diagram. The PourbaixPlotter object is also initialized using an instance of the PourbaixDiagram object.

The PourbaixPlotter object can also plot the relative stability of an entry across the pourbaix diagram. To do this, use the PourbaixPlotter.plot_entry_stability method.

Plotting k-nary systems

Pymatgen also supports binary/ternary pourbaix diagrams with fixed compositions of the non-H or O elements. This is achieved by finding all possible combinations of entries that fulfill the composition constraint and treating them as individual entries in pourbaix space. Note that you can supply a composition dictionary and to further tune the pourbaix diagram.

Note that the filter_solids keyword argument in the PourbaixDiagram instantiation above tells the constructor whether to filter solids by phase stability on the compositional phase diagram. Note that Pourbaix Diagrams generated with and without this argument may look significantly different in the OER and HER regions, since highly oxidized materials (e. g. Bi$_2$O$_5$) or highly reduced materials (e. g. most hydrides) may not be stable on the compositional phase diagram. The filtering process significantly reduces the time it takes to generate all of the combined entries for a binary or ternary pourbaix diagram though, so it may be prudent to use in those cases.

Getting the heatmaps for a solid entry in these cases is a bit more involved, because many of the regions of the pourbaix diagram include multiphase entries. Here's an example for this case.