Hi Lauren,
I think you are asking two questions here: the first is regarding the mass balance for the available redox reactions (involving H+, e-, and O2), and the second question is regarding the mass balance in a multi-element Pourbaix diagram?
In response to the first question: The Materials Project actually uses a different method to construct Pourbaix Diagrams than is traditionally done. There are two ways to construct a Pourbaix Diagram. In one approach, you can use the Nernst Equation to compute phase boundaries between solid-aqueous stability regions, for example, as discussed below in [1]. Another way is one would make a dense E-pH grid, and evaluate the all available redox reactions at each grid point and find the lowest Gibbs free-energy phase, and then add the boundary lines; for example as done in [2,3].
The Pourbaix code implemented in Pymatgen and used on the Materials Project actually uses a different approach. This is done by constructing ‘Pourbaix free-energy planes’, made by a Legendre Transform of the Gibbs free energy to the E and p H axes, and taking the lower concave envelope of the resulting free-energy planes. This approach was developed in the Ceder Group about 10 years ago, by Denis Kramer and later implemented into the Materials Project by Sai Jayaraman, but the method was actually never published until literally last week [4]. You can find the equation for the Pourbaix Potential on Lines 59-62 of the Pourbaix_diagram.py code in pymatgen, or in the Methods section of [4]. In the Legendre transformed Pourbaix Potential, redox reactions are evaluated implicitly, and so it is unnecessary to formulate any redox balances between the metal and H2O.
In response to your second question, I think you are asking about the normalization of metal species in a multi-element Pourbaix Diagram? This is indeed a very confusing matter, and the documentation on the MP is not very valuable.
First, it is important to consider the boundary conditions of the thermodynamic analysis that is done on a Pourbaix Diagram. In the Legendre transform approach, the thermodynamic boundary conditions are not defined around the full aqueous system including precipitates, but only around the metal-containing solute phases in water (See Figure 1 of the ChemRxiv [5]). The resulting thermodynamic potential corresponds to the free-energy of an aqueous ion precursor or metal oxide precipitate being acted upon by an open external water reservoir at a given p H, redox potential, and dissolved metal ion concentration.
For a multielement system, the Pourbaix diagram has a metal-composition inside the boundary conditions , and the dissolved metal ion concentration outside of the boundary conditions. The Pourbaix diagram shows what would be the stable species inside the boundary conditions.
In the multielemental Pourbaix diagram construction, the user specifies the metal M1:M2 ratio composition inside the boundary conditions. The Pourbaix diagram tells you if that metal composition would be stable, given the external applied E, pH, and [M1], [M2], etc concentrations.
The Pourbaix free-energy plane in a multicomponent Pourbaix diagram actually also has not been published yet, although we are writing up a paper that includes this derivation now and should be submitted in a couple of months. Essentially though, if you imagine Pourbaix planes for each individual phase, the multicomponent Pourbaix plane is a linear interpolation between multiple pure-phase planes. For example, Ψ(AO + 0.5 BO2) = Ψ(AO) + 0.5 Ψ(BO2) / NormalizationConstant. The coefficient weights for the interpolation are the user-specified metal composition inside the boundary conditions.
As Joseph described previously, for each M1:M2 ratio there is an enormous combinatorial problem of what possible phases there are. Joseph and Arunima Singh developed a nice algorithm to construct all the weights for the multielemental Pourbaix planes [3].
Please feel free to ask any other questions you may have. I will try to update the Pourbaix documentation on the MP when I have time.
[1] https://onlinelibrary.wiley.com/doi/abs/10.1002/9780470872864.ch7
[2] https://journals.aps.org/prb/abstract/10.1103/PhysRevB.92.245126
[3] https://pubs.acs.org/doi/abs/10.1021/acs.chemmater.7b03980
[4] https://www.nature.com/articles/s41467-019-08494-6
[5] https://chemrxiv.org/articles/Non-Equilibrium_Crystallization_Pathways_of_Manganese_Oxides_in_Aqueous_Solution/6300959/1?file=11537984 Figure 1 shows the relevant boundary conditions, although this was removed from [4] by the referees, heh.