-
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
Add support for vaspout.h5, improvements to potcar handling #3680
base: master
Are you sure you want to change the base?
Add support for vaspout.h5, improvements to potcar handling #3680
Conversation
…tcar class, standardize potcar checking
Signed-off-by: Aaron Kaplan <33381112+esoteric-ephemera@users.noreply.github.com>
there's going to be a new |
Signed-off-by: Aaron Kaplan <33381112+esoteric-ephemera@users.noreply.github.com>
Important Auto Review SkippedDraft detected. Please check the settings in the CodeRabbit UI or the To trigger a single review, invoke the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
This isn't super urgent for release. What I'd like to do is ensure that this works across a wider variety of vaspout's, and make sure that all fields currently included in the vaspout are being mapped correctly to the PMG object Rn, it doesn't seems like vaspout.h5 has the same level of detail as vasprun.xml so figuring out a way to handle that would also be good |
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.
Following features can be included to extract information from one-shot band-structure calculation.
pymatgen/io/vasp/outputs.py
Outdated
|
||
|
||
@requires(h5py is not None, "h5py must be installed to read vaspout.h5") | ||
class Vaspout(Vasprun): |
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.
You can add following parameter and attributes to the class.
dos_kpoints_opt
eigenvalues_kpoints_opt
projectors_kpoints_opt
It will be useful in case of one-shot calculation of bandstructure. Particularly, it is useful while doing HSE calculations (ref), which requires adding the kpoints with fake weights for hartree-fock calculations(ref). One-shot calculations reduces the two step calculations to one-step with two kpoints file, i.e.,KPOINTS
andKPOINTS_OPT
.
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.
Yeah I'll get on this next, will also bring the PR up to date with #3509
pymatgen/io/vasp/outputs.py
Outdated
self._parse(parse_dos, parse_eigen, parse_projected_eigen) | ||
|
||
@classmethod | ||
def _parse_hdf5_value(cls, val: Any) -> Any: |
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.
Instead of parsing the whole vaspout.h5
at once and creating a dictionary. The required information can be parsed directly using the full string as follows.
- To extract the ENCUT from the input/incar we can use
np.float64(h5_file['input/incar/ENCUT'])
ornp.float64(h5_file['input']['incar']['ENCUT'])
- To extract array like data, use
np.array(h5_file[...])
, etc
This will not require lot of memory. Only the data needed will be accessed instead of storing the whole file as dictionary in memory. What do you think?
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.
Essentially all attributes of the HDF5 file are accessed by the Vaspout
object so I think it's more natural just to read the whole file in as a python dict. This also makes the code cleaner/more consistent than an approach which cherry picks different attr's with different types
Thanks for this PR @esoteric-ephemera. Do you happen to know if magnetic moments are now stored in the vaspout.h5? Previously these were not available in the vasprun.xml, although perhaps they have since been added and we haven't noticed. I do see a |
Hi @mkhorton, yes both the magnetic moments and charges are stored in vaspout.h5, and thankfully to normal floating point precision I need to revisit this PR soon - will try to this week or next |
e3fbc67
to
41e6d99
Compare
Signed-off-by: Aaron Kaplan <33381112+esoteric-ephemera@users.noreply.github.com>
Summary
The vaspout.h5 file appears to be a replacement for / supplement to the vasprun.xml file, and has been available in certain VASP versions >= 6. This PR aims to add support for parsing this file.
However the vaspout.h5 file appears to be still in development. For example, no electronic self-consistency info is included in it as of 11 April, 2024, but there is a PR on VASP's py4vasp GH to add OSZICAR info to vaspout.h5
Major changes:
pymatgen.io.vasp.outputs.Vaspout
. This subclassesVasprun
in the spirit that the two should contain roughly the same information now..from_str
method topymatgen.io.vasp.inputs.Potcar
(needed because vaspout.h5 stores the complete potcar as a str)store_potcar
, to enable/disable storing the full POTCAR or its just specionic_step
now hassite_properties
with the s, p, d,...-resolved andtot
charge / magnetization, if applicable. This is the same format asOutcar.charge
andOutcar.magnetization
, but added as a site property at each ionic step instead of a top-level attr for only the final structureSome related changes for VASP I/O
spec
attr toPotcarSingle
andPotcar
. This standardizes the POTCAR spec attr added to vasprun.xml and vaspout.h5 objectsfrom_spec
method toPotcar
, which attempts to generate a POTCAR with a consistent functional just from the spec. Note that multiple matches are possible, this only takes the first consistent match.Todos