Pourbaix digram entry with a wrong composition

Hi,

I recently encountered a problem that the pourbaix diagram sometimes includes the multientry with a different composition than the one initially used to generate the pourbaix diagram. This only occurs for some initial compositions. What could be the reason for this?

Also, in the example shown in the attached screenshot, the multientry includes both Fe(s) and Fe[+2] at the same time. It looks unphysical, but could this be a bug in the code?

Thank you

1 Like

Hi Johan - appreciate the detailed example - could you paste the code as text, just so I can be sure Iā€™m copying it exactly?

Here it is.

ELEMENTS_HO = {Element("H"), Element("O")}
chem_sys = 'Fe-Ir-Li-Si-V'
pourbaix_entries = mpr.get_pourbaix_entries(chemsys=chem_sys)
pourbaix_elem = [Element(elem) for elem in chem_sys.split('-')]

conc_dict = {}
for elem in pourbaix_elem:
    conc_dict[elem.symbol] = 1e-6

comp_dict = Composition({Element('Fe'): 1, Element('Ir'): 1, 
             Element('Li'): 2, Element('Si'): 1, Element('V'): 2, }).fractional_composition
print(comp_dict)

pbx = PourbaixDiagram(pourbaix_entries, comp_dict=comp_dict, conc_dict = conc_dict)
pbx_comp = Composition(pbx._elt_comp).fractional_composition
print(pbx_comp)
for multientry in pbx.all_entries:
    entry_pbx_comp = Composition(
        {elt: coeff for elt, coeff in multientry.composition.items() if elt not in ELEMENTS_HO}
    ).fractional_composition
    if entry_pbx_comp != pbx_comp:
        print(multientry)
        print(entry_pbx_comp)
        exit()

Thank you!