materialsproject / emmet

Be a master builder of databases of material properties. Avoid the Kragle.
https://materialsproject.github.io/emmet/
Other
49 stars 63 forks source link

Bug: Wrong `run_type` report on r2SCAN run #960

Closed Andrew-S-Rosen closed 2 weeks ago

Andrew-S-Rosen commented 4 months ago

Problem

from emmet.core.tasks import TaskDoc
task_doc = TaskDoc.from_directory(".")
print(task_doc.entry.parameters["run_type"]) # prints GGA even though it's an r2SCAN run

We can strip back a few layers to find the root cause of the problem:

from pymatgen.io.vasp.outputs import Vasprun
from emmet.core.vasp.calculation import CalculationInput
from emmet.core.vasp.calc_types import run_type

vr = Vasprun("vasprun.xml.gz")
doc = CalculationInput.from_vasprun(vr)
print(run_type(doc.parameters)) # prints GGA

So, the source of our problems here is an incorrect parse on the vasprun.xml.gz parameters. Going one step deeper, we can see

vr.parameters["METAGGA"] # raises a KeyError

So, this is actually a Pymatgen issue.... reporting upstream.

vasprun.xml.gz OUTCAR.gz POSCAR.gz INCAR.gz CONTCAR.gz Feel free to email me for the POTCAR.

Proposed Solution

TBD.

Alternatives

No response

Andrew-S-Rosen commented 4 months ago

I'm reopening this because Pymatgen is technically doing what it's told. The METAGGA (and other fields, like ALGO) are missing entirely from the <parameters> block of the vasprun.xml file even though they are present in the <incar> section. Pymatgen then doesn't report "METAGGA" in its parameters attribute of the vasprun.xml file because it doesn't exist. This can be problematic when generating an entry because the run_type will be wrong, which then also means that using things like the MP compatibility schemes will be wrong. I'm not sure the best way to address this one...

I suppose we can just hope this was fixed in newer versions? 😅

esoteric-ephemera commented 4 months ago

Thanks @Andrew-S-Rosen! I'll get in touch with some of the VASP devs to ask about this

My guess is that we should, on the pymatgen side, splice these together - basically when one tag is set in vasprun.incar, apply that tag also to vasprun.parameters.

You can tell that the parameters are basically VASP's defaults / what VASP actually uses internally, since GGA is set to "--", and IALGO is specified instead of ALGO (like you noted)

There's currently no page on the VASP manual for vasprun.xml, so I'm guessing this will be deprecated in favor of the hdf5 file in coming releases

Andrew-S-Rosen commented 4 months ago

There's currently no page on the VASP manual for vasprun.xml, so I'm guessing this will be deprecated in favor of the hdf5 file in coming releases

Oh this is going to be interesting. 😅