Skip to content

fix(vasp): collect OUTCAR files from multiple directories#1034

Open
njzjz-bot wants to merge 3 commits into
deepmodeling:masterfrom
njzjz-bot:fix/issue-894
Open

fix(vasp): collect OUTCAR files from multiple directories#1034
njzjz-bot wants to merge 3 commits into
deepmodeling:masterfrom
njzjz-bot:fix/issue-894

Conversation

@njzjz-bot

@njzjz-bot njzjz-bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #894.

Recursively discover and deterministically parse standard-named OUTCAR files for MultiSystems conversion.

Tests: Relevant VASP/MultiSystems tests plus CLI deepmd/npy conversion.

Why existing tests missed it: Tests covered single-file LabeledSystem parsing and other multi-mode backends, never VASP default multi-directory discovery.

Coding agent: Codex
Codex version: codex-cli 0.144.4
Model: gpt-5.6-sol
Reasoning effort: xhigh

Summary by CodeRabbit

  • New Features
    • Added support for loading multiple VASP OUTCAR calculations from a directory, including nested subdirectories.
    • Discovered OUTCAR files are processed in a consistent order.
  • Tests
    • Added coverage confirming that multiple nested calculations are loaded correctly, with each calculation represented as a separate system.

Discover canonically named OUTCAR files recursively so the multi-system CLI path can combine one-calculation-per-directory VASP datasets. Add a regression covering nested single-frame calculations.

Coding-Agent: Codex
Codex-Version: codex-cli 0.144.4
Model: gpt-5.6-sol
Reasoning-Effort: xhigh
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@njzjz, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8899d238-040f-4305-a676-421f3c8ba3bf

📥 Commits

Reviewing files that changed from the base of the PR and between 12f6f2e and 42450f9.

📒 Files selected for processing (1)
  • tests/test_vasp_outcar.py
📝 Walkthrough

Walkthrough

VASP OUTCAR format loading now recursively discovers and sorts nested OUTCAR paths for MultiSystems. A test creates two nested calculations, loads both files, and verifies that two one-frame systems are returned.

Changes

VASP multi-system loading

Layer / File(s) Summary
Recursive OUTCAR discovery
dpdata/plugins/vasp.py
VASPOutcarFormat.from_multi_systems recursively finds files named OUTCAR and returns their sorted paths.
Multi-system loading validation
tests/test_vasp_outcar.py
The test loads two nested OUTCAR files and verifies that both resulting systems contain one frame.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MultiSystems
  participant VASPOutcarFormat
  participant Filesystem
  MultiSystems->>VASPOutcarFormat: from_multi_systems(directory)
  VASPOutcarFormat->>Filesystem: os.walk(directory)
  Filesystem-->>VASPOutcarFormat: nested OUTCAR paths
  VASPOutcarFormat-->>MultiSystems: sorted OUTCAR paths
Loading

Suggested labels: bug

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the main change: collecting OUTCAR files from multiple directories.
Linked Issues check ✅ Passed The recursive OUTCAR discovery and regression test directly address [#894]'s MultiSystems conversion failure.
Out of Scope Changes check ✅ Passed All changes are directly related to recursive OUTCAR discovery and its regression coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codspeed-hq

codspeed-hq Bot commented Jul 16, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 33.1%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime test_cli 378.2 ms 277.1 ms +36.49%
WallTime test_import 11.2 ms 8.6 ms +29.81%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing njzjz-bot:fix/issue-894 (42450f9) with master (d2105f6)

Open in CodSpeed

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.95%. Comparing base (d2105f6) to head (42450f9).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1034   +/-   ##
=======================================
  Coverage   86.94%   86.95%           
=======================================
  Files          90       90           
  Lines        9178     9185    +7     
=======================================
+ Hits         7980     7987    +7     
  Misses       1198     1198           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wanghan-iapcm wanghan-iapcm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving: correct fix for #894. VASPOutcarFormat.from_multi_systems recursively walks the directory and returns sorted OUTCAR file paths, which is exactly the type MultiSystems.from_fmt_obj feeds into from_labeled_system(file_name=...); it mirrors the established os.walk pattern in the deepmd/npy loader (returning file paths rather than directories because VASP loads a file, and adding sorted() for determinism). The new test is a genuine regression test -- verified to raise NotImplementedError (format.py:317) on pre-fix code and pass after, exercising the public MultiSystems.from_file path over a nested layout. Build and codecov/patch green (docs/readthedocs red is the unrelated emscripten-forge outage, #1035). Optional follow-up: the test asserts only counts (len/nframes); asserting the two discovered systems' formulas match the sources would harden it (per the same guidance on #1015).

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 19, 2026
wanghan-iapcm and others added 2 commits July 21, 2026 12:55
Strengthen recursive OUTCAR coverage by checking that both loaded systems preserve the non-zero compositions of their source calculations.

Coding-Agent: Codex
Codex-Version: codex-cli 0.144.6
Model: gpt-5.6-sol
Reasoning-Effort: xhigh
@njzjz

njzjz commented Jul 21, 2026

Copy link
Copy Markdown
Member

Addressed the optional composition assertion in commit 42450f9. The regression test now compares the two discovered systems' non-zero element compositions with the source OUTCAR systems, while normalizing the shared zero-count type entries introduced by MultiSystems. Focused VASP OUTCAR tests pass.

Coding agent: Codex
Codex version: codex-cli 0.144.6
Model: gpt-5.6-sol
Reasoning effort: xhigh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dpdata lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files. vasp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] multi dirs including with OUTCAR(single-point calc mode) can not be converted into deepmd_data together by dpdata

3 participants