-
Notifications
You must be signed in to change notification settings - Fork 874
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
Update POTCAR summary stats to include 6.4 POTCARs and add dev_script
utils for future updates
#3370
Conversation
pymatgen/io/vasp/inputs.py
Outdated
def _gen_potcar_summary_stats(): | ||
""" | ||
This function solely intended to be used for PMG development to regenerate the | ||
potcar_summary_stats.json.gz file used to validate POTCARs | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect! This is great to have. Even though it's marked as private, we should add a test for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a Test_gen_potcar_summary_stats
to tests/io/vasp/test_inputs.py
. Requires generating a library of fake POTCARs, which are in tests/fake_POTCAR_library
. Code to generate this library from a real library of POTCARs is in dev_scripts/potcar_scrambler.py
pymatgen/io/vasp/inputs.py
Outdated
@@ -2280,6 +2283,43 @@ def __repr__(self) -> str: | |||
return f"{cls_name}({symbol=}, {functional=}, {TITEL=}, {VRHFIN=}, {n_valence_elec=:.0f})" | |||
|
|||
|
|||
def _gen_potcar_summary_stats(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine here, but noting there is also a top-level dev_scripts
folder (largely undocumented). On balance it's probably better here for discoverability for anyone curious how this file was generated.
Minor comments: the bare return
is unnecessary, and monty.serialization.dumpfn
can be used directly with dumpfn(new_summary_stats, "filename.json.gz")
which is a convenience function we use a lot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Much better way of doing this. For placement, you and @janosh probably have a better sense of where this belongs. _gen_potcar_summary_stats
is a "destructive" function, in that it overwrites the file that's distributed with PMG. dev_scripts
might then be a better place for it
…TCARs from existing POTCARs by randomizing the data contained in them, dev_scripts/potcar_scrambler.py; (3) unit test for pymatgen.io.vasp.inputs._gen_potcar_summary_stats by generating summary stats for a library of fake POTCARs and then checking that the fake set passes PotcarSingle.is_valid with overriden stats
…p") with os.makedirs(exist_ok=True)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice work, thanks @esoteric-ephemera! 👍
dev_script
utils for future updates
Hi. I think Lines 95 to 119 in 44bf383
|
Ah crap! |
Not the first time don’t worry! I once added a catch-all to package all .json, .yaml files by default but this was vetoed for reasons I forget, but perhaps worth reconsidering |
….package_data` (#3372) * fix bare URLS they don't work in https://pymatgen.org/CHANGES.html * add pymatgen/io/vasp/potcar_summary_stats.json.gz to setup.package_data thanks #3370 (comment)
I think it's worth a try. @shyuep Any concerns? If we get false positives, we can always revert the change. |
My concern is that data files should be few and far between and EXPLICIT. |
Exactly, which is why the ones we deliberately place in the pymatgen pkg dir should be there for a good reason and hence also be included in the PyPI release. At least that's the case right now as you can see from d8151e5 passing. |
Yes, that is why it should be explicitly specified. For the same reason, you do not usually do |
The biggest reason not to do |
There are reasons. Say someone decides to add a |
I don't merge very big files into |
You don't != Someone else don't. Anyway, we don't add data files all the time. So just leave it as is. I don;'t want to go round and round on an issue that has occurred once in two years. |
Major changes:
pymatgen.io.vasp.inputs._gen_potcar_summary_stats
dev_scripts/potcar_scrambler.py