MP2020 anion correction dropped for mixed-anion compounds (oxynitrides)

Dear Materials Project,

I have been looking in to oxynitrides lately (especially Zr-N-O systems), and I have come across a bug in the anion correction which are applied via pymatgen to your PBE data.

An example is the system Zr-O-N. Here, for Zr-O systems, O is correctly assigned the anion correction determined by Wang et al. and likewise N-corrections are assigned to systems of Zr-N. The problem arises when both N and O are anions in a system. Here only O is detected as an anion by pymatgen (i have been using pymatgen version 2026.5.4), and therefor, only the O atom receives an anion correction in an Zr-O-N system.

This is for example evident for Zr2ON2, which on the Materials Project website, is found to be metastable - which it infarct will not be if N is additionally assigned the anion correction (as it should). You can for instance compute the mixing energy of Zr2ON2 form Zr3N4 and ZrO2 with and without the MP2020 corrections. These energies should be the same, given that both O and N are anions in all mixed compounds (the anion corrections should cancel and be equivalent to uncorrected PBE).

Note that the error is largest when adding a small amount of O to an Zr-N system, as this strips the N-correction, while only applying it to O.

I have been able to resolve the issue locally, by use of pymatgens “Composition.oxi_state_guesses”, and then just running the ComputedStructureEntry though the standard MaterialsProject2020Compatibility class.

Thanks for your attention, and for your great database.

Best regards,
Mathias Nissen