Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

el_refs serialized as strings #576

Open
jmmshn opened this issue Oct 27, 2022 · 5 comments
Open

el_refs serialized as strings #576

jmmshn opened this issue Oct 27, 2022 · 5 comments
Labels

Comments

@jmmshn
Copy link
Contributor

jmmshn commented Oct 27, 2022

phase_diagram: PhaseDiagram = Field(
..., description="Phase diagram for the chemical system.",
)

When these PhaseDiagramDocuments are pulled from the DB and deserialized the keys for el_refs are string but the pymatgen code uses Element the entries time. I can't find if a conversion occurred in emmet.

pd = loadfn("/Users/shen9/Desktop/pd_doc.json") # taken from DB
pd["phase_diagram"].el_refs.keys()
# gives dict_keys(['O', 'Ge', 'Co', 'Li'])

@kim-jiyoon reported this. @munrojm and @mkhorton can you please have a look? This is to get the conversion documents on the new site.

@munrojm
Copy link
Member

munrojm commented Oct 27, 2022

Yup! Will take a look at this.

@munrojm
Copy link
Member

munrojm commented Jan 19, 2023

@janosh, this seems to stem from the fact that computed_data can be passed when constructing a PhaseDiagram object, which contains the el_refs dictionary. If its keys are strings instead of Element objects it appears to make a fuss when de-serializing with monty, or when trying to plot with PDPlotter. It might be best to have it check and ensure Element object keys on construction in pymatgen?

@munrojm
Copy link
Member

munrojm commented Jan 20, 2023

Also, qhull_data is assumed to be a numpy array, and causes similar issues for ternary+ plots. For now, I am manually patching in the API client. https://github.com/materialsproject/api/blob/ece1b3effeebae208a16d98776a3bb555ec8e459/mp_api/client/routes/thermo.py#L181

@janosh
Copy link
Member

janosh commented Jan 20, 2023

Was I tagged by accident?

@munrojm
Copy link
Member

munrojm commented Jan 20, 2023

@janosh No, this just relates to a pymatgen issue I was about to open. We can discuss outside of this thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants