Discrepancy Between Directly Downloaded Structure and POSCAR File Coordinates

Dear community,

I have a question regarding handling structure data. Using mp-149 as an example, if I download the CHGCAR and POSCAR as shown below, the two Si atoms are located at (0,0,0) and (0.75 ,0.75, 0.75), and their coordinates fit well with the charge density when visualized. Also, these coordinates match those displayed on the mp-api homepage visualization (https://next-gen.materialsproject.org/materials/mp-149?material_ids=mp-149).

[Code]
chgcar, task_doc = mpr.get_charge_density_from_material_id(“mp-149”, inc_task_doc=True)
poscar = task_doc.orig_inputs.poscar

However, If I download the structure data of mp-149 directly as shown below, I get two Si atoms with coordinates at (0.125, 0.125, 0.125) and (0.875, 0.875, 0.875).

[Code]
structure = mpr.get_structure_by_material_id(“mp-149”)

What could have caused this incosistency? Since I want to process charge density data along with atomic positions, the coordinates should match those used for the VASP calculation, and translated atomic coordinates could introduce big errors. I checked with pymatgen to see if niggli reduction caused this situation, but neither set of coordinates results from a conversion of the other.

I would greatly appreciate it if someone could answer my questions.
Thank you

Junkil Park

Hey @Junkil_Park, because multiple “tasks” (individual calculations) build a material document, different tasks can be used to generate the charge density than those that were used to optimize the structure.

You don’t need the task doc to get the structure associated with the CHGCAR, since this is stored as chgcar.poscar.structure

You can roughly see the inconsistency by looking at the origins field of a materials summary doc:

summary_doc = mpr.materials.summary.search(material_ids=["mp-149"],fields=["origins"])[0]
print(summary_doc.origins)
>>> [PropertyOrigin(name='structure', task_id=MPID(mp-1947498), last_updated=datetime.datetime(2021, 3, 5, 11, 47, 3, 84000)), PropertyOrigin(name='energy', task_id=MPID(mp-1947498), last_updated=datetime.datetime(2024, 9, 27, 22, 28, 10, 276000)), PropertyOrigin(name='magnetism', task_id=MPID(mp-1947498), last_updated=datetime.datetime(2021, 3, 5, 11, 47, 3, 84000)), PropertyOrigin(name='dielectric', task_id=MPID(mp-2683297), last_updated=datetime.datetime(2018, 12, 19, 21, 45, 41, 99000)), PropertyOrigin(name='absorption', task_id=MPID(mp-2683297), last_updated=datetime.datetime(2024, 9, 30, 17, 43, 15, 99000))]

In this case, the task that is returned with the CHGCAR, task_doc.task_id = mp-2291052, is different than the task used to return the structure, mp-1947498

2 Likes

Dear Aaron,

Thanks for your quick response. Now I understood that there can be multiple tasks even for the same structure, and that the task used for charge density calculation and structure preparation can be different. I appreciate your help!!

One question I have is whether there is way I can obtain the energy (or other properties) of the structure used for charge density calculation. I understand that MP provides various calculated properties, including energy, but if these were performed with different task_ids from charge density calculation (as in the case of mp-149), these data would be not correct for the structure in POSCAR used for the charge density calculation.

I appreciate your help, and will be looking for your reply.

Best,
Junkil Park

@Aaron_Kaplan

Also, I would greatly appreciate any advice you could offer on Charge density visualization for Materials Project materials. I’ve spent almost an entire week working on it, but have been unable to figure it out… Again, I deeply appreciate your consideration.

Best,
Junkil Park

Hi @Junkil_Park, if you want the energy of the structure used to generate the CHGCAR, you can use task_doc.output.energy

1 Like