Skip to content

Membrane support#1561

Open
hannahbaumann wants to merge 188 commits intomainfrom
membrane_prototype
Open

Membrane support#1561
hannahbaumann wants to merge 188 commits intomainfrom
membrane_prototype

Conversation

@hannahbaumann
Copy link
Contributor

@hannahbaumann hannahbaumann commented Oct 9, 2025

[Note from @atravitz: we are making an experimental release from this branch, and so this branch should not be merged into main just yet]

This PR addresses the following issues:

Checklist

  • Added a news entry

Developers certificate of origin

@codecov
Copy link

codecov bot commented Oct 10, 2025

Codecov Report

❌ Patch coverage is 62.90984% with 181 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.05%. Comparing base (031e13c) to head (a72e135).

Files with missing lines Patch % Lines
...ts/protocols/openmm_septop/test_septop_protocol.py 35.75% 115 Missing ⚠️
...s/protocols/openmm_rfe/test_hybrid_top_protocol.py 8.57% 32 Missing ⚠️
.../tests/protocols/openmm_abfe/test_abfe_protocol.py 68.65% 21 Missing ⚠️
src/openfe/protocols/openmm_md/plain_md_methods.py 81.81% 2 Missing ⚠️
...openfe/protocols/openmm_rfe/_rfe_utils/relative.py 66.66% 2 Missing ⚠️
...openfe/protocols/openmm_rfe/hybridtop_protocols.py 60.00% 2 Missing ⚠️
...nfe/protocols/openmm_septop/equil_septop_method.py 90.90% 2 Missing ⚠️
src/openfe/protocols/openmm_utils/omm_settings.py 84.61% 2 Missing ⚠️
src/openfe/protocols/openmm_afe/abfe_units.py 80.00% 1 Missing ⚠️
src/openfe/protocols/openmm_rfe/hybridtop_units.py 50.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1561      +/-   ##
==========================================
- Coverage   94.79%   91.05%   -3.74%     
==========================================
  Files         205      205              
  Lines       17957    18342     +385     
==========================================
- Hits        17022    16702     -320     
- Misses        935     1640     +705     
Flag Coverage Δ
fast-tests 91.05% <62.90%> (?)
slow-tests ?

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

☔ View full report in Codecov by Sentry.
📢 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.

Comment on lines +251 to +257
protocol_settings.forcefield_settings.forcefields = [
"amber/ff14SB.xml",
"amber/tip3p_standard.xml",
"amber/tip3p_HFE_multivalent.xml",
"amber/lipid17_merged.xml",
"amber/phosaa10.xml",
]
Copy link
Collaborator

@jthorton jthorton Mar 24, 2026

Choose a reason for hiding this comment

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

Should this be changing all of the force fields? What if the user has requested tip4p and ff19sb? This silently replaces the force field which is not good, we could check if its in the list and if not add it or maybe we should update the default list to include the lipid force field I don't think there is any harm in doing that.

Suggested change
protocol_settings.forcefield_settings.forcefields = [
"amber/ff14SB.xml",
"amber/tip3p_standard.xml",
"amber/tip3p_HFE_multivalent.xml",
"amber/lipid17_merged.xml",
"amber/phosaa10.xml",
]
if "amber/lipid17_merged.xml" not in protocol_settings.forcefield_settings.forcefields:
protocol_settings.forcefield_settings.forcefields.append("amber/lipid17_merged.xml")

Copy link
Member

Choose a reason for hiding this comment

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

maybe we should update the default list to include the lipid force field I don't think there is any harm in doing that.

I think this is more sensible. It would be a problem if someone wanted another lipid FF and then got lipid 17 instead.

Copy link
Member

Choose a reason for hiding this comment

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

Opened this gufe PR to fix it: OpenFreeEnergy/gufe#767

Comment on lines +648 to +650
# roundtrip box vectors to remove vec3 issues
box = to_openmm(from_openmm(stateA_system.getDefaultPeriodicBoxVectors()))
stateA_topology.setPeriodicBoxVectors(box)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this not be done in system creation when setting the box vectors from the membrane protein component?

Comment on lines +268 to +270
elif isinstance(solvent_comp, SolvatedPDBComponent):
# Set the periodic box vectors
system_modeller.topology.setPeriodicBoxVectors(to_openmm(solvent_comp.box_vectors))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we do the vec3 round trip stuff here to avoid it being done in protocols?

Comment on lines +625 to +629
solvent = SolventComponent(ion_concentration=0 * offunit.molar)
num_all_not_water = 16080
num_complex_atoms = 39390
# No ions
num_ligand_atoms = 36
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we be checking that no solvent is added to the system as well?

Comment on lines +109 to +111
# Forcefields should include the lipid forcefields
ff = settings.forcefield_settings.forcefields
assert "amber/lipid17_merged.xml" in ff
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also include a test to ensure that custom input settings using a different set of force fields are not changed.


# Check we have the right number of atoms in the PDB
pdb = mdt.load_pdb("hybrid_system.pdb")
assert pdb.n_atoms == 4690
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we be checking no extra solvent is added here, by changing the selection to all and making sure the number of atoms don't change?

Comment on lines +1820 to +1823

# Forcefields should include the lipid forcefields
ff = settings.forcefield_settings.forcefields
assert "amber/lipid17_merged.xml" in ff
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lets also add a test here to make sure we don't break the users input settings if they have already changed the default force fields.

box_modeller = model.topology.getPeriodicBoxVectors()
box_protein = a2a_protein_membrane_component.box_vectors

assert np.allclose(box_modeller, to_openmm(box_protein), atol=1e-6)
Copy link
Collaborator

Choose a reason for hiding this comment

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

check no extra water or ions have been added?

Copy link
Collaborator

@jthorton jthorton left a comment

Choose a reason for hiding this comment

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

Looking super close, spotted one bug with adaptive settings which should be fixed, it would also be nice to explicitly test that we are not adding waters to membrane systems before considering merging the others are optional.

@IAlibay
Copy link
Member

IAlibay commented Mar 24, 2026

pre-commit.ci autofix

@github-actions
Copy link

No API break detected ✅

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.

Membrane: Add warning/validation for barostat usage

4 participants