Skip to content

fix(psi4): honor requested input method#1006

Merged
njzjz merged 1 commit into
deepmodeling:masterfrom
rathodkunj2005:fix-psi4-input-method
Jul 2, 2026
Merged

fix(psi4): honor requested input method#1006
njzjz merged 1 commit into
deepmodeling:masterfrom
rathodkunj2005:fix-psi4-input-method

Conversation

@rathodkunj2005

@rathodkunj2005 rathodkunj2005 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Use the requested method argument when writing Psi4 gradient(...) calls instead of always writing WB97M-D3BJ.
  • Add a regression test for non-default Psi4 input methods.

Fixes #992.

Verification

  • python -m pytest test_psi4.py -q (from tests/): 17 passed in 0.24s
  • python -m ruff check dpdata/formats/psi4/input.py tests/test_psi4.py: All checks passed!
  • Direct smoke check: write_psi4_input(..., method="hf", basis="sto-3g") emits gradient("hf", return_wfn=True) and no WB97M-D3BJ.

Summary by CodeRabbit

  • Bug Fixes
    • PSI4 input generation now uses the method selected by the caller instead of always falling back to a default value.
    • Added coverage to confirm generated PSI4 input reflects the requested method and basis settings.

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. dpdata labels Jul 2, 2026
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e456f699-2ce4-4104-8e3a-d043ccede4dc

📥 Commits

Reviewing files that changed from the base of the PR and between 86c69ca and fd8e00d.

📒 Files selected for processing (2)
  • dpdata/formats/psi4/input.py
  • tests/test_psi4.py

📝 Walkthrough

Walkthrough

The Psi4 input template's gradient(...) call now uses the user-provided method placeholder instead of a hardcoded "WB97M-D3BJ" string. A new test was added to verify the generated input reflects the requested method rather than the default.

Changes

Psi4 Method Fix

Layer / File(s) Summary
Template fix and test verification
dpdata/formats/psi4/input.py, tests/test_psi4.py
The gradient(...) call in the input template now uses the method placeholder instead of a hardcoded "WB97M-D3BJ" string; a new test confirms output contains the requested method's gradient call and excludes the default one.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Related issues:

Suggested labels: bug, psi4

Suggested reviewers: njzjz

🐰 A hardcoded method, stuck like glue,
Now swapped for the one that you construe,
A gradient line, correctly penned,
With "hf" or "WB97" — you get to append!
Hopping onward, the tests confirm it's true.

🚥 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 Psi4 input writer now honors the requested method.
Linked Issues check ✅ Passed The change matches issue #992 by replacing the hard-coded method and adding regression coverage.
Out of Scope Changes check ✅ Passed The PR stays focused on Psi4 input generation and its test coverage, with no obvious unrelated changes.
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 2, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 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.

✅ 2 untouched benchmarks


Comparing rathodkunj2005:fix-psi4-input-method (fd8e00d) with master (86c69ca)

Open in CodSpeed

@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.87%. Comparing base (86c69ca) to head (fd8e00d).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1006   +/-   ##
=======================================
  Coverage   86.87%   86.87%           
=======================================
  Files          89       89           
  Lines        8268     8268           
=======================================
  Hits         7183     7183           
  Misses       1085     1085           

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

@njzjz njzjz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks!

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 2, 2026
@njzjz njzjz merged commit 5de0229 into deepmodeling:master Jul 2, 2026
12 checks passed
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:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code scan] Psi4 input writer ignores the requested method

2 participants