Skip to content

Enable user defn boresch restraints in ABFE Protocol - #2019

Merged
IAlibay merged 42 commits into
mainfrom
abfe_user_defn_restraints
Aug 13, 2026
Merged

Enable user defn boresch restraints in ABFE Protocol#2019
IAlibay merged 42 commits into
mainfrom
abfe_user_defn_restraints

Conversation

@IAlibay

@IAlibay IAlibay commented Jun 16, 2026

Copy link
Copy Markdown
Member

Fixes #2002

Checklist

  • All new code is appropriately documented (user-facing code must have complete docstrings).
  • Added a news entry, or the changes are not user-facing.
  • Ran pre-commit: you can run pre-commit locally or comment on this PR with pre-commit.ci autofix.

Manual Tests: these are slow so don't need to be run every commit, only before merging and when relevant changes are made (generally at reviewer-discretion).

Developers certificate of origin

@IAlibay IAlibay changed the title Enable user defn boresch restraints Enable user defn boresch restraints in ABFE Protocol Jun 16, 2026
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.57%. Comparing base (ffc1cb9) to head (10ccce3).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2019      +/-   ##
==========================================
- Coverage   95.15%   90.57%   -4.58%     
==========================================
  Files         213      213              
  Lines       20950    21104     +154     
==========================================
- Hits        19934    19114     -820     
- Misses       1016     1990     +974     
Flag Coverage Δ
fast-tests 90.57% <100.00%> (?)
slow-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@IAlibay

IAlibay commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

pre-commit.ci autofix

@IAlibay
IAlibay marked this pull request as ready for review June 17, 2026 12:19
@IAlibay

IAlibay commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

pre-commit.ci autofix

@IAlibay
IAlibay requested a review from hannahbaumann June 18, 2026 14:12
@hannahbaumann hannahbaumann self-assigned this Jun 18, 2026

@hannahbaumann hannahbaumann 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.

Thanks @IAlibay , this looks great, just added a few comments.

host_restraint_ids: tuple[int, int, int] | None = None
"""
The indices of the host component atoms to restrain.
The entries define the H0, H1, and H2 atoms in order.

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.

Would it be helpful to add how the restraints are defined, since people use different definitions of H0 vs H2 (meaning, is the bond between H0 and G0 or between H2 and G0?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll double check but I think the docstring gets inherited from

class BoreschRestraintSettings(BaseRestraintSettings):

Which has the whole description of the restraints including my attempt at ASCII art.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Looks like the class docstring wasn't getting inherited, so I've added it.

"""
guest_restraint_ids: tuple[int, int, int] | None = None
"""
The indices of the guest component atoms to restraint.

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.

This is based on the only ligand indices (from the sdf), correct? Maybe worth adding that this are not the indices the ligand would have in the complex (probably obvious since the complex is not created yet, but maybe just to be extra clear).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done


errmsg = "``guest_atoms`` and ``host_atoms`` cannot have negative indices."
with pytest.raises(ValueError, match=errmsg):
setattr(setting, parameter, [1, 2, -3])

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.

What happens if you pass in 4 integers?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It'll fail validation, I initially tried that test and was pleasantly surprised that pydantic was that good.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added a test just in case.

Comment thread src/openfe/protocols/openmm_afe/abfe_units.py Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@hannahbaumann something I've been thinking about is whether or not SepTop should be using two of these settings (one for each restraint) or if it always makes sense for the restraint to have the exact same settings? (i.e. I think if the settings are different, the restraint might not cancel out, but I'm not sure).

return v


class ABFEBoreschRestraintSettings(BoreschRestraintSettings):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'd like to avoid having to proliferate more settings classes for SepTop - TBD with @hannahbaumann, how easily can we align things?

@IAlibay

IAlibay commented Jul 29, 2026

Copy link
Copy Markdown
Member Author

pre-commit.ci autofix

@IAlibay
IAlibay requested a review from hannahbaumann July 29, 2026 10:54

.. module:: openfe.protocols.openmm_afe.equil_afe_settings


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.

I just noticed looking at the API docs that this page openmm_protocol_settings.rst does not have a link to the ABFE protocol settings. Maybe we could add that in this PR?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done

@hannahbaumann hannahbaumann 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.

Thanks @IAlibay lgtm! Just the one comment on adding the link to the ABFE ProtocolSettings in the OpenMM settings reference, but approving early!

hannahbaumann and others added 7 commits August 12, 2026 13:13
* User supplied restraints SepTop protocol

* Apply suggestion from @hannahbaumann

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update test data

* Update test data

* Address review comments

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@IAlibay

IAlibay commented Aug 13, 2026

Copy link
Copy Markdown
Member Author

pre-commit.ci autofix

@IAlibay
IAlibay requested a review from hannahbaumann August 13, 2026 12:04

@hannahbaumann hannahbaumann 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.

Thanks @IAlibay , lgtm!

@github-actions

Copy link
Copy Markdown

🚨 API breaking changes detected! 🚨

View workflow run

Griffe output
$ griffe check "openfe" -s src --no-inspection --no-color --verbose -a origin/main
src/openfe/protocols/openmm_septop/equil_septop_settings.py:0: SepTopSettings.complex_restraint_settings:
Public object was removed


$ griffe check "openfecli" -s src --no-inspection --no-color --verbose -a origin/main

@IAlibay
IAlibay merged commit d8a6d37 into main Aug 13, 2026
9 of 10 checks passed
@IAlibay
IAlibay deleted the abfe_user_defn_restraints branch August 13, 2026 14:28
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.

Add support for user-defined restraints in the ABFE Protocol

2 participants