Skip to content

Add flat-bottomed distance restraints - #517

Merged
lohedges merged 5 commits into
develfrom
feature_flat_bottomed_restraint
Nov 4, 2026
Merged

lohedges merged 5 commits into
develfrom
feature_flat_bottomed_restraint

Conversation

@lohedges

@lohedges lohedges commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

This PR adds a flat-bottomed distance restraint, FlatBottomBondRestraint(s), so that truncated-protein FEP setups can move from SOMD1 to SOMD2. The potential matches SOMD1's distance restraint, E = k * (|r - r0| - rfb)^2 when |r - r0| > rfb and zero otherwise, using the same units. SOMD1 (reql, kl, Dl) values therefore map directly onto r0, k and rfb. The restraint is created with sire.restraints.flat_bottom_distance() or sire.restraints.flat_bottom_bond(), and is converted to OpenMM as a CustomBondForce that is scaled by the lambda lever like the other restraints.

The PR also fixes some existing restraint bugs found during review:

  • operator+ on seven restraint containers returned the unmodified left-hand operand, so a + b silently dropped b.
  • Converting restraints to OpenMM read past the end of the atom map when a restraint index was outside the system. It now raises an exception.
  • The bond, inverse bond and Morse centroid constructors named the wrong atom in the overlap error, and called squeeze() inside the loop.

The restraints tutorial has a new section for the flat-bottomed restraint, and the changelog has an entry for each change. Some files have also been reformatted by the pre-commit hooks.

  • 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: [y]
  • I confirm that I have added a changelog entry to the changelog (we will add a link to this PR as part of the review): [y]
  • I confirm that I have permission to release this code under the MIT license (the Python API) or the LGPLv3+ license (everything else), as described in the LICENSE file: [y]

@lohedges lohedges added enhancement New feature or request cresset related to work with cresset labels Nov 4, 2026
@lohedges
lohedges merged commit dbbaf8d into devel Nov 4, 2026
4 of 5 checks passed
@lohedges
lohedges deleted the feature_flat_bottomed_restraint branch November 4, 2026 13:32

This branch was previously deployed

1 inactive deployment
sire-build — 8aed095e Deployed Nov 4, 2026 by lohedges via build (3.10, linux) #461
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cresset related to work with cresset enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant