fix(vasp): improve robustness of OUTCAR ML parsing for cell data extraction #883
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses an issue where VASP machine learning AIMD simulations were not extracting the expected number of structures from OUTCAR files when using dpdata. The problem was caused by fragile cell data extraction logic that could fail with slight variations in OUTCAR format.
Problem
Users reported that when parsing ML AIMD OUTCAR files, dpdata would extract fewer structures than expected, particularly when encountering lines with "VOLUME and BASIS-vectors are now included." instead of the standard "VOLUME and BASIS-vectors are now :". The original parsing logic was not robust to format variations and could fail when cell data lines were malformed.
Solution
The fix improves the robustness of cell data extraction in the
analyze_block
function withindpdata/vasp/outcar.py
:Example
Testing
The changes maintain full backward compatibility while making the parser more resilient to format variations that can occur in different VASP versions or configurations.
Fixes #522.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.