Skip to content

fix(generator): document CALYPSO model deviation args#1886

Open
njzjz-bot wants to merge 1 commit into
deepmodeling:masterfrom
njzjz-bot:openclaw/fix-calypso-arginfo-1795
Open

fix(generator): document CALYPSO model deviation args#1886
njzjz-bot wants to merge 1 commit into
deepmodeling:masterfrom
njzjz-bot:openclaw/fix-calypso-arginfo-1795

Conversation

@njzjz-bot

@njzjz-bot njzjz-bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Problem

  • PR [Documentation] Add comprehensive CALYPSO model_devi arguments #1795 leaves pre-commit red and documents CALYPSO settings as accepting list-valued scalar fields, but _make_model_devi_native_calypso() passes those values directly to make_calypso_input(), which expects scalar PsoRatio, PopSize, MaxStep, ICode, fmax, etc.
  • Its new CALYPSO variant also omits common model-deviation selection keys such as model_devi_skip and force/virial trust levels, so existing CALYPSO run parameter files can be rejected during strict argument checking.

Change

  • Add a CALYPSO arginfo variant on top of current master.
  • Keep scalar CALYPSO fields scalar in arginfo, matching the current generator implementation, while keeping PSTRESS as a pressure list.
  • Include the common model-deviation selection/cleanup keys used by CALYPSO workflows.

Validation

  • uvx ruff format dpgen/generator/arginfo.py
  • uvx ruff check dpgen/generator/arginfo.py
  • uvx --with dargs --with dpdispatcher --with packaging python - <<'PY' ... (imported run_jdata_arginfo() and strict-checked a representative CALYPSO arginfo dictionary)
  • uvx pre-commit run --files dpgen/generator/arginfo.py

Authored by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.5)

Summary by CodeRabbit

Release Notes

  • New Features
    • Added support for CALYPSO-based model deviation jobs with comprehensive configuration options, including structural generation parameters (composition, volume, inter-ionic distances, PSO settings) and model-deviation selection settings (trust bounds, adaptive trust, candidate selection, and trajectory cleaning).

Add CALYPSO-specific arginfo without accepting list-valued settings that the generator currently cannot consume, and keep the common model-deviation selection keys valid for CALYPSO runs.

Authored by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.5)
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new model_devi_calypso_args() function in dpgen/generator/arginfo.py that defines the complete dargs schema for CALYPSO-based model deviation jobs, covering structural generation and selection parameters. Updates model_devi_args() to wire the new function into the calypso engine variant, replacing a prior TODO placeholder.

Changes

CALYPSO Model Deviation Schema

Layer / File(s) Summary
model_devi_calypso_args() schema definition
dpgen/generator/arginfo.py
Introduces model_devi_calypso_args() with a repeated model_devi_jobs Argument covering CALYPSO structural-generation fields (composition, volume, inter-ionic distances, PSO settings, iteration via times) and model-deviation selection parameters (force/virial/energy trust bounds, adaptive trust, candidate selection, relative-deviation controls, trajectory cleaning), plus optional external CALYPSO input directory and variable-stoichiometry controls.
Wire calypso engine to model_devi_calypso_args()
dpgen/generator/arginfo.py
Updates the calypso entry in the model_devi_engine variant inside model_devi_args() to reference the new model_devi_calypso_args() and replaces the prior TODO/empty argument list with a concrete CALYPSO docstring.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(generator): document CALYPSO model deviation args' directly addresses the main change: adding CALYPSO model deviation argument documentation. It accurately reflects the primary purpose of the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
dpgen/generator/arginfo.py (1)

624-625: ⚡ Quick win

Use a NumPy-style docstring for the new function

model_devi_calypso_args() currently uses a single-line docstring. Please switch to NumPy style (Returns section at minimum) to match repository rules for dpgen/**/*.py.
As per coding guidelines, "Use Numpy-style docstrings for functions and classes".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@dpgen/generator/arginfo.py` around lines 624 - 625, The function
`model_devi_calypso_args()` currently uses a single-line docstring format.
Convert it to NumPy-style docstring format by expanding the docstring to include
a Returns section that documents the return type and description of what the
function returns (a list of Argument objects). Follow the NumPy docstring
convention used elsewhere in the dpgen module to maintain consistency with
repository guidelines.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@dpgen/generator/arginfo.py`:
- Around line 743-746: The Argument definition for "model_devi_max_iter" is
marked as optional=True, but it is required when "calypso_input_path" is
present, causing configs to pass validation but fail at runtime in
make_model_devi(). Either remove the optional=True flag to make
"model_devi_max_iter" always required, or add conditional validation logic that
enforces "model_devi_max_iter" as a required field specifically when
"calypso_input_path" is provided. Ensure the validation occurs early enough to
prevent runtime failures during CALYPSO execution.

---

Nitpick comments:
In `@dpgen/generator/arginfo.py`:
- Around line 624-625: The function `model_devi_calypso_args()` currently uses a
single-line docstring format. Convert it to NumPy-style docstring format by
expanding the docstring to include a Returns section that documents the return
type and description of what the function returns (a list of Argument objects).
Follow the NumPy docstring convention used elsewhere in the dpgen module to
maintain consistency with repository guidelines.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 63159001-97bb-4015-89df-e9d024072d74

📥 Commits

Reviewing files that changed from the base of the PR and between 7af5246 and 9c8fe94.

📒 Files selected for processing (1)
  • dpgen/generator/arginfo.py

Comment on lines +743 to +746
Argument("calypso_input_path", str, optional=True, doc=doc_calypso_input_path),
Argument(
"model_devi_max_iter", int, optional=True, doc=doc_model_devi_max_iter
),

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.

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

calypso_input_path mode can pass validation but still fail at runtime

model_devi_max_iter is optional here, but make_model_devi() uses it as the iteration bound when calypso_input_path is present. This allows a config that passes arginfo and then crashes/fails during iteration bound handling in CALYPSO mode. Please enforce this as a conditional requirement (calypso_input_path => model_devi_max_iter) in schema validation or via explicit early validation in the CALYPSO run path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@dpgen/generator/arginfo.py` around lines 743 - 746, The Argument definition
for "model_devi_max_iter" is marked as optional=True, but it is required when
"calypso_input_path" is present, causing configs to pass validation but fail at
runtime in make_model_devi(). Either remove the optional=True flag to make
"model_devi_max_iter" always required, or add conditional validation logic that
enforces "model_devi_max_iter" as a required field specifically when
"calypso_input_path" is provided. Ensure the validation occurs early enough to
prevent runtime failures during CALYPSO execution.

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.94%. Comparing base (7af5246) to head (9c8fe94).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1886      +/-   ##
==========================================
+ Coverage   49.80%   49.94%   +0.14%     
==========================================
  Files          83       83              
  Lines       14986    15028      +42     
==========================================
+ Hits         7464     7506      +42     
  Misses       7522     7522              

☔ 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.

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.

1 participant