pymatgen icon indicating copy to clipboard operation
pymatgen copied to clipboard

Add support for vaspout.h5, improvements to potcar handling

Open esoteric-ephemera opened this issue 11 months ago • 5 comments

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:

  • Add support for parsing vaspout.h5 through pymatgen.io.vasp.outputs.Vaspout. This subclasses Vasprun in the spirit that the two should contain roughly the same information now.
  • Add .from_str method to pymatgen.io.vasp.inputs.Potcar (needed because vaspout.h5 stores the complete potcar as a str)
    • To avoid issues of copyright, there's a kwarg, store_potcar, to enable/disable storing the full POTCAR or its just spec
  • The structure at each ionic_step now has site_properties with the s, p, d,...-resolved and tot charge / magnetization, if applicable. This is the same format as Outcar.charge and Outcar.magnetization, but added as a site property at each ionic step instead of a top-level attr for only the final structure

Some related changes for VASP I/O

  • Add spec attr to PotcarSingle and Potcar. This standardizes the POTCAR spec attr added to vasprun.xml and vaspout.h5 objects
  • Add from_spec method to Potcar, 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

  • Some information currently contained in vasprun.xml appears not to be available in vaspout.h5. That might change in the near future, or I may be mistaken
  • Support for selective dynamics (if applicable)
  • Various TODO's sprinkled through current code
  • Tests

esoteric-ephemera avatar Mar 09 '24 00:03 esoteric-ephemera

there's going to be a new pmg release soon to close #3744. do we want to get this in before that? let us know if others can help with this PR

janosh avatar Apr 11 '24 08:04 janosh

[!IMPORTANT]

Auto Review Skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Apr 11 '24 15:04 coderabbitai[bot]

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

esoteric-ephemera avatar Apr 11 '24 15:04 esoteric-ephemera

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 MAGDIPOLOUT key.

mkhorton avatar Jun 09 '24 03:06 mkhorton

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

esoteric-ephemera avatar Jun 10 '24 15:06 esoteric-ephemera