feat(qcmanybody): support fragment-scoped external potentials - #53
Merged
Conversation
Contributor
Author
|
Corresponding Psi4 integration: psi4/psi4#3501 |
There was a problem hiding this comment.
🟢 Approval recommended
The reviewed changes have no unresolved approval-blocking issues.
Pull request overview
Adds fragment-scoped external-potential reporting for the linked Psi4 integration.
Changes:
- Exposes
external_potentialthroughManyBodyCore.analyze. - Omits unavailable interaction properties while retaining valid contributions.
- Preserves legacy formatting and renders unavailable values as
N/A. - Adds regression coverage.
File summaries
| File | Description |
|---|---|
qcmanybody/utils.py |
Filters invalid properties and formats unavailable interactions. |
qcmanybody/tests/test_utils.py |
Tests formatting and spacing contracts. |
qcmanybody/tests/test_core_singlelevel.py |
Tests public analysis behavior. |
qcmanybody/core.py |
Propagates the external-potential classification. |
pyproject.toml |
Corrects test discovery paths. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
loriab
approved these changes
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Intent
Support fragment-scoped external potentials as a distinct external_potential classification in QCManyBody, without conflating them with embedding charges. They should share unavailable-interaction behavior while preserving the exact historical print_nbody_energy output contract: every pre-existing row must remain byte-for-byte identical, including trailing whitespace, except that literal nan tokens for unavailable interaction energies become N/A at the exact same character offsets. Ordinary interaction-only and supersystem formatting must not move. Omit invalid interaction-energy properties while retaining valid n-body contributions, expose ManyBodyCore.analyze(external_potential=...), and cover the public output and analyze behavior. The user chose to defer a changelog entry. The corresponding Psi4 integration is psi4/psi4#3501; keep the QCManyBody PR communication brief and include that link.
What Changed
external_potentialsupport toManyBodyCore.analyzeas a classification distinct from embedding charges.N/Avalues and omit invalid interaction properties while retaining valid n-body contributions and legacy formatting.Risk Assessment
✅ Low: The change is well-bounded, preserves legacy output formatting, cleanly propagates the distinct external-potential classification, and retains valid contribution properties while suppressing invalid interaction properties.
Testing
After the system Python lacked pytest, an isolated uv environment ran the focused formatter and public analyze tests successfully; differential checks confirmed legacy rows remain byte-identical and unavailable values replace only
nanwithN/Aat the same offsets, while an end-to-end artifact demonstrates retained n-body contributions, omitted interaction properties, and the rendered N/A columns. Generated environment files were removed afterward.Evidence: External-potential public API output
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
python -m pytest ...andpython3 -m pytest ...— unavailable system test tooling; resolved using the project-local uv environment.uv run --extra tests pytest -q qcmanybody/tests/test_utils.py::test_print_nbody_energy_external_potential_without_total_energy qcmanybody/tests/test_utils.py::test_print_nbody_energy_preserves_legacy_spacing qcmanybody/tests/test_core_singlelevel.py::test_external_potential_reportingExecuted a differential formatter check across 16 ordinary, embedding, external-potential, interaction-only, total-energy, and supersystem scenarios against base commit1c56881dee567403337cd6da4521ce9639e95d74.ExecutedManyBodyCore.analyze(component_results, external_potential=True)with water-trimer component data and captured its returned properties and printed energy summary.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.