What do the entries “unit_cell_formul” and “final_energy_per_atom” from the old version correspond to in the new version? Have they been removed in the new version, and what data should I use to replace them?
Hi @lw-good, if you’re using the summary
endpoint, the replacements would be (for mp-149
as an example):
from mp_api.client import MPRester
with MPRester("your_api_key") as mpr:
summary_doc = mpr.materials.summary.search(material_ids=["mp-149"])[0]
unit_cell_formula = summary_doc.structure.to_primitive().formula
final_energy_per_atom = summary_doc.energy_per_atom
For the tasks
endpoint, you would use
unit_cell_formula = task_doc.output.structure.to_primitive().formula
final_energy_per_atom = task_doc.output.energy_per_atom
2 Likes
Thank you very much for your answer. I will use your method to extract it.
Dear Aaron_Kaplan,
I encountered a new issue where the results for “energy_per_atom” differ significantly when extracted from the “summary” and “tasks” endpoints. For example, the value for Li is -8.91 in “summary” but -1.27 in “tasks”. Why does this discrepancy occur?
The task that is used for the energy does not always have the same MP ID as the material. So for fcc Li, mp-51:
with MPRester() as mpr:
summary_doc = mpr.materials.summary.search(material_ids=["mp-51"])[0]
for prop in summary_doc.origins:
print(prop.name,prop.task_id)
You should get something like:
structure mp-1943879
energy mp-1943879
magnetism mp-1943879
which tells you that the structure, final energy, and magnetic moments are all taken from task mp-1943879