Skip to content

Fix issue #549 - #550

Merged
lohedges merged 2 commits into
develfrom
fix_549
Nov 26, 2026
Merged

lohedges merged 2 commits into
develfrom
fix_549

Conversation

@lohedges

@lohedges lohedges commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

This PR closes #549 by clearing the forces buffer at the start of computeForce in PyQMForceImpl and TorchQMForceImpl. OpenMM reuses the vector passed to a CustomCPPForceImpl between evaluations, so an MM atom that left the QM cutoff kept its previous QM/MM force.

A regression test, test_qm_force_cleared_outside_cutoff, moves an MM water outside, inside, then outside the cutoff and checks its QM/MM force is zero both times it is outside.

Also closes #551 by using the periodic space to compute distances for the switching function.

  • I confirm that I have merged the latest version of devel into this branch before issuing this pull request (e.g. by running git pull origin devel): y
  • I confirm that I have added a test for any new functionality in this pull request: y
  • I confirm that I have added documentation (e.g. a new tutorial page or detailed guide) for any new functionality in this pull request: n/a
  • I confirm that I have added a changelog entry: y

lohedges added a commit that referenced this pull request Nov 26, 2026
@lohedges
lohedges merged commit fbefa86 into devel Nov 26, 2026
4 of 5 checks passed
@lohedges
lohedges deleted the fix_549 branch November 26, 2026 17:57

This branch was previously deployed

1 inactive deployment
sire-build — 342bd02d Deployed Nov 26, 2026 by lohedges via build (3.13, linux) #481
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] QM/MM switching force uses the wrong periodic image [BUG] QM/MM force persists after an MM atom leaves the cutoff

1 participant