-
Notifications
You must be signed in to change notification settings - Fork 864
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
KeyError of elemental references in pre-computed phase diagram #2809
Conversation
… pre-computed data
… pre-computed data
@peikai, I appreciate you making this PR. I just patched the API client to temporarily resolve this issue yesterday as we were having plotting issues on the front-end with the pre-computed data. I also found an additional change that needs to be made to for some ternary compounds. Namely, @janosh, this relates to the emmet issue I tagged you in regarding |
@peikai Thanks for this PR. Do we really need |
… pre-computed data
for more information, see https://pre-commit.ci
@munrojm Thanks for the information. The updated mp-api works. And this PR would fix the issue in pymatgen. |
fix mypy errors
When I try to plot a pre-computed phase diagrams that are retrieved via get_phase_diagram_from_chemsys() method,
a KeyError raises as shown below, which arises from the inconsistence on object stored in el_refs dictionary, i.e., the keys stored in phaseDiagram.el_refs are str object (dict_keys(['O', 'Fe', 'Li'])), instead of the Element object (dict_keys([Element O, Element Fe, Element Li])).
The pre-computed phase diagrams in database might not be updated conveniently. So, I add some codes in pymatgen.analysis.phase_diagram.PhaseDiagram class, to update keys in elemental reference dictionary to Element object, in case it loads a pre-computed phase diagram. A corresponding test unit is also added to check the keys in el_refs dictionary,
KeyError message: