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

BUG: KeyError: 'efermi' in lobster example from documentation #680

Closed
JonathanSchmidt1 opened this issue Jan 16, 2024 · 3 comments · Fixed by #682
Closed

BUG: KeyError: 'efermi' in lobster example from documentation #680

JonathanSchmidt1 opened this issue Jan 16, 2024 · 3 comments · Fixed by #682

Comments

@JonathanSchmidt1
Copy link
Contributor

Describe the bug
Running the plotting part from the lobster example in the documentation

for number, (key, cohp) in enumerate(
    result["output"]["lobsterpy_data"]["cohp_plot_data"].items()
):
    plotter = CohpPlotter()
    cohp = Cohp.from_dict(cohp)
    plotter.add_cohp(key, cohp)
    plotter.save_plot(f"plots_all_bonds{number}.pdf")

resulted in the error

Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
  File "/home/sjonathan/anaconda3/envs/fireworks_mp/lib/python3.11/site-packages/pymatgen/electronic_structure/cohp.py", line 190, in from_dict
    dct["efermi"],
    ~~~^^^^^^^^^^
KeyError: 'efermi'

I assume this is because:

result["output"]["lobsterpy_data"]["cohp_plot_data"].keys()
dict_keys(['data'])

adding ['data'] to the line to arrive at result["output"]["lobsterpy_data"]["cohp_plot_data"]['data']
produces plots although I don't know whether the plots are correct.

To Reproduce
I ran the example through fireworks.
https://materialsproject.github.io/atomate2/user/codes/vasp.html#lobster
and then tried to run the given code to plot the results.

Expected behavior
Expected plots instead of error message.

@JaGeo
Copy link
Member

JaGeo commented Jan 16, 2024

@naik-aakash , could you check? I think this might be related to the schema updates. Thanks!

@JaGeo
Copy link
Member

JaGeo commented Jan 16, 2024

Thanks for reporting, @JonathanSchmidt1 .

@naik-aakash
Copy link
Contributor

@naik-aakash , could you check? I think this might be related to the schema updates. Thanks!

Yes, indeed due to added models in updates this error got introduced. Will fix the documentation. Got overlooked!

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

Successfully merging a pull request may close this issue.

3 participants