How to calculate the formation energy of ABO3

I tried to calculate the formation energy of ABO3 perovskite from the total energy listed in the materials project, but the calculated results do not match the values in the database.

For example, in the case of LaNiO3 (mp-19339), the total energy is -66.26 eV = -6.626 eV/atom, and the composition elements La, Ni and O are -4.9275 eV/atom, -5.78 eV/atom and -4.9483 eV/atom respectively, so should be able to be calculated as
(-6.626 * 5 + 4.9275 + 5.78 + 4.9483 * 3) / 5 = -1.51552 eV/atom

However, on the materials project, the formation energy of LaNiO3 is -2.469 eV/atom.

Please tell me about this difference.

Hi @piglet, check out my answer from this matsci post and see if the explanation there remedies the discrepancy you’re seeing.

Thank you for your response.
I checked the link and generally understood it.
However, I am not sure how the formation energy of -2.469 eV/atom for LaNiO3 on the materials project was calculated and using which calculation method.

If you use the same code I shared in that answer, but change the first three lines of the code to reflect the MPID you’re interested in, mp-19339:

mpids = ["mp-19339"]
elemental_to_mpid = {"Ni": "mp-23", "O": "mp-723285", "La": "mp-26"}
mpids += list(elemental_to_mpid.values())

you should get

corrected_formation_enthalpies= {
  'mp-19339': {
    'R2SCAN': -2.5277649440000003,
    'GGA_GGA+U_R2SCAN': -2.4691230895000005,
    'GGA_GGA+U': -2.47246809625
    }
}

hence the -2.469 eV/atom value, which is the mixed GGA+U / r2SCAN formation enthalpy.

Resolved!
Much appreciated.