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

VaspInputSet.write_input: Improve error message #3999

Merged
merged 2 commits into from
Aug 15, 2024

Conversation

yantar92
Copy link
Contributor

Summary

This is a small patch improving error message when writing VASP input without VASP installation.
The original message thrown by Potcar constructor is very generic and sounds like VASP must be installed:

pymatgen.io.vasp.inputs.PMG_VASP_PSP_DIR_Error: No POTCAR for H with functional='PBE' found. Please set the PMG_VASP_PSP_DIR in .pmgrc.yaml.

The new message highlights the existance of potcar_spec argument:

ValueError: PMG_VASP_PSP_DIR is not set.  Please set the PMG_VASP_PSP_DIR in .pmgrc.yaml or use potcar_spec=True argument.

Checklist

(used pre-commit hook)

  • Google format doc strings added. Check with ruff.
  • Type annotations included. Check with mypy.
  • Tests added for new features/fixes.
  • If applicable, new classes/functions/modules have duecredit @due.dcite decorators to reference relevant papers by DOI (example)

@shyuep shyuep enabled auto-merge (squash) August 14, 2024 15:40
@shyuep
Copy link
Member

shyuep commented Aug 14, 2024

Pls fix the ruff errors. Thanks.

* src/pymatgen/io/vasp/inputs.py (PotcarSingle.from_symbol_and_functional):
Raise custom PMG_VASP_PSP_DIR_Error when PMG_VASP_PSP_DIR is not configured.

(PMG_VASP_PSP_DIR_Error): New error inheriting from ValueError.

* src/pymatgen/io/vasp/sets.py (VaspInputSet.write_input):
When PMG_VASP_PSP_DIR_Error provide a more helpful message advicing
that potcar_spec argument can be used.  The idea is to provide
instructions for users with no VASP license who are also not aware
about potcar_spec argument.
auto-merge was automatically disabled August 14, 2024 15:51

Head branch was pushed to by a user without write access

@yantar92
Copy link
Contributor Author

Done. (I am not sure why local pre-commit did not identify problems)

@shyuep shyuep merged commit 1a4c538 into materialsproject:master Aug 15, 2024
33 checks passed
@shyuep
Copy link
Member

shyuep commented Aug 15, 2024

Thanks!

@janosh janosh added io Input/output functionality vasp Vienna Ab initio Simulation Package ux User experience labels Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
io Input/output functionality ux User experience vasp Vienna Ab initio Simulation Package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants