Wrong name of Pourbaix Entry

The ion entry of Sn was in a wrong name:
the ion entry with composition Sn1 O2 H1 has name SnOH2[+1]
the ion entry with composition H1 Sn1 O2 has name SnOH2[-1]
As printed out, the number of O and H are opposite

mpr = MPRester()
entries = mpr.get_pourbaix_entries([ "Sn"])
for entry in entries:
    print(entry.name,entry.composition )

The output is:
Sn[+2] Sn1
SnOH[+1] Sn1 O1 H1
SnOH2[+1] Sn1 O2 H1
SnO3[-2] Sn1 O3
SnOH2[-1] H1 Sn1 O2
Sn[+4] Sn1

Tagging @rkingsbury here to see if he can help.

To materials project staff, this may be a general problem because I find the same mistake for Cu-O-H ion:
image

Hmm this looks concerning, thanks for pointing out @yuxin-chang . This looks like a bug in Ion.reduced_formula (which I think may be the same as one that I recently identified for other reasons).

This issue (I think) is here.

@property
    def reduced_formula(self) -> str:
        """Returns a reduced formula string with appended charge. The
        charge is placed in brackets with the sign preceding the magnitude, e.g.,
        'Ca[+2]'. Uncharged species have "(aq)" appended, e.g. "O2(aq)".
        """
        reduced_formula = super().reduced_formula
        charge = self._charge / self.get_reduced_composition_and_factor()[1]
        chg_str = charge_string(charge)
        return reduced_formula + chg_str

Ion should be using its own reduced_formula, not the one inherited from Composition.

@yuxin-chang would you mind opening an Issue in pymatgen? This is on my radar to investigate but I won’t get to it for a week or so.

Thank you for the investigation. I opened the issue in pymatgen: Wrong name of Pourbaix Entry · Issue #3349 · materialsproject/pymatgen · GitHub