Skip to content

Comments

feat: scf convergence check in vasp .xml format.#862

Merged
wanghan-iapcm merged 4 commits intodeepmodeling:develfrom
wanghan-iapcm:feat-xml-conv
Aug 8, 2025
Merged

feat: scf convergence check in vasp .xml format.#862
wanghan-iapcm merged 4 commits intodeepmodeling:develfrom
wanghan-iapcm:feat-xml-conv

Conversation

@wanghan-iapcm
Copy link
Contributor

@wanghan-iapcm wanghan-iapcm commented Aug 6, 2025

Summary by CodeRabbit

  • New Features

    • Added an option to filter VASP XML calculation steps based on SCF convergence status.
    • Introduced a new parameter to enable or disable convergence checking when loading VASP XML files.
  • Tests

    • Added new tests to verify behavior with and without SCF convergence filtering using sample VASP XML files.
    • Included a new sample VASP XML output file for testing purposes.

@wanghan-iapcm wanghan-iapcm requested a review from njzjz August 6, 2025 09:37
@codecov
Copy link

codecov bot commented Aug 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.45%. Comparing base (c129cc3) to head (82c5f9a).
⚠️ Report is 34 commits behind head on devel.

Additional details and impacted files
@@            Coverage Diff             @@
##            devel     #862      +/-   ##
==========================================
+ Coverage   85.41%   85.45%   +0.04%     
==========================================
  Files          82       82              
  Lines        7577     7592      +15     
==========================================
+ Hits         6472     6488      +16     
+ Misses       1105     1104       -1     

☔ View full report in Codecov by Sentry.
📢 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.

@coderabbitai
Copy link

coderabbitai bot commented Aug 6, 2025

📝 Walkthrough

Walkthrough

A new optional SCF convergence filtering feature was introduced to the VASP XML parsing logic. This includes updates to the VASPXMLFormat.from_labeled_system method and the underlying XML analysis functions, allowing users to control whether only converged steps are included. Associated tests and a new VASP XML test file were also added.

Changes

Cohort / File(s) Change Summary
VASP Plugin Interface Update
dpdata/plugins/vasp.py
Updated VASPXMLFormat.from_labeled_system to accept a new convergence_check boolean parameter (default True), which is passed to the XML analysis function.
VASP XML Analysis Logic
dpdata/vasp/xml.py
Added convergence filtering in analyze and analyze_calculation functions via a new convergence_check parameter. Extracts NELM from XML to determine SCF convergence, filters calculation steps accordingly, and updates function signatures, docstrings, and type annotations.
VASP XML Test File
tests/poscars/vasprun.h2o.md.conv.xml
Added a new, detailed VASP XML output for an H2O system, providing a converged calculation for use in new tests.
VASP XML Convergence Tests
tests/test_vasp_xml.py
Added two test classes (TestVaspXmlConvTrue, TestVaspXmlConvFalse) to check system behavior with and without convergence filtering using the new test XML file.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant VASPXMLFormat
    participant vasp.xml.analyze
    participant vasp.xml.analyze_calculation

    User->>VASPXMLFormat: from_labeled_system(file_name, ..., convergence_check)
    VASPXMLFormat->>vasp.xml.analyze: analyze(file_name, ..., convergence_check)
    vasp.xml.analyze->>vasp.xml.analyze: Extract NELM if convergence_check
    loop for each <calculation> in XML
        vasp.xml.analyze->>vasp.xml.analyze_calculation: analyze_calculation(calculation, nelm)
        vasp.xml.analyze_calculation-->>vasp.xml.analyze: (data..., is_converged)
        alt convergence_check is True
            alt is_converged
                vasp.xml.analyze->>vasp.xml.analyze: Append calculation data
            else is not converged
                vasp.xml.analyze->>vasp.xml.analyze: Skip calculation
            end
        else convergence_check is False
            vasp.xml.analyze->>vasp.xml.analyze: Append calculation data
        end
    end
    vasp.xml.analyze-->>VASPXMLFormat: Analysis result
    VASPXMLFormat-->>User: LabeledSystem
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–20 minutes

Suggested reviewers

  • njzjz

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7238d7c and 82c5f9a.

📒 Files selected for processing (1)
  • tests/test_vasp_xml.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/test_vasp_xml.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: benchmark
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 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>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
  • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 6, 2025

CodSpeed WallTime Performance Report

Merging #862 will not alter performance

Comparing wanghan-iapcm:feat-xml-conv (82c5f9a) with devel (8263565)

Summary

✅ 2 untouched benchmarks

wanghan-iapcm and others added 3 commits August 6, 2025 17:58
Signed-off-by: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com>
Signed-off-by: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com>
@wanghan-iapcm wanghan-iapcm merged commit b1ba78b into deepmodeling:devel Aug 8, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants