Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
4e6617e
Membrane support prototype start
hannahbaumann Oct 9, 2025
ac9862a
Merge branch 'main' into membrane_prototype
hannahbaumann Oct 9, 2025
8ea145a
Point to corresponding branch in gufe
hannahbaumann Oct 10, 2025
587a1bf
Merge branch 'membrane_prototype' of https://github.com/OpenFreeEnerg…
hannahbaumann Oct 10, 2025
b7c63d6
Merge branch 'main' into membrane_prototype
hannahbaumann Oct 13, 2025
24f3d58
Make plain md protocol membrane ready
hannahbaumann Oct 13, 2025
617ac8c
Merge branch 'membrane_prototype' of https://github.com/OpenFreeEnerg…
hannahbaumann Oct 13, 2025
7fd5ca9
Merge branch 'main' into membrane_prototype
hannahbaumann Oct 15, 2025
18db828
Dry run for membrane system for debugging
hannahbaumann Oct 17, 2025
1ee6fd7
Merge branch 'membrane_prototype' of https://github.com/OpenFreeEnerg…
hannahbaumann Oct 17, 2025
238b36b
Merge branch 'main' into membrane_prototype
hannahbaumann Oct 20, 2025
6945805
Merge branch 'main' into membrane_prototype
hannahbaumann Oct 20, 2025
646ebbe
Merge branch 'membrane_prototype' of https://github.com/OpenFreeEnerg…
hannahbaumann Oct 20, 2025
abf0007
Add box vectors to modeller
hannahbaumann Oct 20, 2025
96fa49a
Adapt htf to allow for membrane barostat
hannahbaumann Oct 20, 2025
b70e5b2
Fix test
hannahbaumann Oct 20, 2025
481ff35
Add test files membrane
hannahbaumann Oct 20, 2025
4d28281
Merge branch 'main' into membrane_prototype
hannahbaumann Oct 20, 2025
eff1958
Change test to cpu
hannahbaumann Oct 21, 2025
1456a99
Merge branch 'membrane_prototype' of https://github.com/OpenFreeEnerg…
hannahbaumann Oct 21, 2025
0cdde55
Merge branch 'main' into membrane_prototype
hannahbaumann Oct 21, 2025
5bfd1c9
Prints for debugging
hannahbaumann Oct 23, 2025
ce29130
Some more debugginh stuff, remove later
hannahbaumann Oct 24, 2025
c53fd60
Merge branch 'main' into membrane_prototype
hannahbaumann Oct 29, 2025
5c313b1
Small fix
hannahbaumann Oct 29, 2025
9dce0e0
Merge conflicts
hannahbaumann Oct 29, 2025
080d93e
Temporarily use branches for openmmtools and openmmforcefield
hannahbaumann Oct 29, 2025
48a7844
Small fixes
hannahbaumann Oct 29, 2025
b492de0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 29, 2025
2913994
support membrane in gather
hannahbaumann Oct 30, 2025
e654a4d
Merge branch 'main' into membrane_prototype
hannahbaumann Oct 31, 2025
1e707ba
Merge branch 'main' into membrane_prototype
hannahbaumann Nov 4, 2025
bf51b0c
First pass membrane support for SepTop protocol
hannahbaumann Nov 6, 2025
872c914
Change validation solvent
hannahbaumann Nov 6, 2025
27d15f7
Move changes in solvent validation to validate_solvent
hannahbaumann Nov 6, 2025
508fa62
Some small fixes
hannahbaumann Nov 6, 2025
a33d882
Merge branch 'main' into membrane_prototype
hannahbaumann Nov 6, 2025
7a640ce
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 6, 2025
44e3545
Add membrane test septop
hannahbaumann Nov 6, 2025
6e4023d
Change box vector units for handling membrane barostat
hannahbaumann Nov 10, 2025
339a9ed
Test box vectors SepTop more
hannahbaumann Nov 10, 2025
741e44c
First pass at ABFE membrane prototype
hannahbaumann Nov 12, 2025
e53512b
Merge branch 'main' into membrane_prototype
hannahbaumann Nov 12, 2025
e67ecd2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 12, 2025
1f408fc
Remove some prints
hannahbaumann Nov 12, 2025
19761df
Revert box changes
hannahbaumann Nov 12, 2025
5d5bc8e
Some fixes in SepTop to fix tests
hannahbaumann Nov 12, 2025
3e6b063
Apply suggestion from @hannahbaumann
hannahbaumann Nov 12, 2025
4d7da11
Add tests for system creation
hannahbaumann Nov 12, 2025
4c7cdd4
Merge branch 'membrane_prototype' of https://github.com/OpenFreeEnerg…
hannahbaumann Nov 12, 2025
0962f3c
FIx test
hannahbaumann Nov 12, 2025
00c606e
Add ABFE membrane tests
hannahbaumann Nov 13, 2025
b317cab
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 13, 2025
d97de53
More tests membrane septop and more dry outputs in septop
hannahbaumann Nov 13, 2025
2145f37
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 13, 2025
fc61675
Add validation for box vector in ProteinMembraneComponent
hannahbaumann Nov 25, 2025
b132806
Merge branch 'main' into membrane_prototype
hannahbaumann Nov 25, 2025
88c9179
Adapt gather for membranes
hannahbaumann Nov 25, 2025
379cdf6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 25, 2025
d79eb36
Merge branch 'main' into membrane_prototype
hannahbaumann Nov 27, 2025
207fe3c
small changes
hannahbaumann Dec 2, 2025
3504100
Merge branch 'main' into membrane_prototype
hannahbaumann Dec 2, 2025
af99e37
Merge branch 'main' into membrane_prototype
hannahbaumann Dec 2, 2025
c309957
Merge branch 'main' into membrane_prototype
hannahbaumann Dec 3, 2025
9ae0565
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 3, 2025
4156c55
Modify box vectors plain md
hannahbaumann Dec 4, 2025
4327ef1
Merge branch 'main' into membrane_prototype
hannahbaumann Dec 5, 2025
ff06372
Address review comments
hannahbaumann Dec 5, 2025
3cd7793
Merge branch 'membrane_prototype' of https://github.com/OpenFreeEnerg…
hannahbaumann Dec 5, 2025
8c00e32
Remove unnecessary prints
hannahbaumann Dec 5, 2025
5dd1758
Subclass membrane test
hannahbaumann Dec 5, 2025
11602f5
Small fix
hannahbaumann Dec 11, 2025
7ac6d32
Merge branch 'main' into membrane_prototype
hannahbaumann Dec 11, 2025
45c26de
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 11, 2025
7dc626c
remove unnecessary import
hannahbaumann Dec 11, 2025
621b0d7
Remove prints
hannahbaumann Dec 12, 2025
a42653e
Small fix
hannahbaumann Dec 12, 2025
825e8ae
Merge branch 'main' into membrane_prototype
hannahbaumann Dec 12, 2025
919cacf
Small fix
hannahbaumann Dec 16, 2025
683b47d
Merge branch 'membrane_prototype' of https://github.com/OpenFreeEnerg…
hannahbaumann Dec 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies:
- threadpoolctl
- tqdm
- pip:
- git+https://github.com/OpenFreeEnergy/gufe@main
- git+https://github.com/OpenFreeEnergy/gufe@membrane_prototype
- git+https://github.com/OpenFreeEnergy/ofe-sphinx-theme@v0.3.1
# pip install these so that we can make sure docs build on main while these packages' docs are under development
- git+https://github.com/OpenFreeEnergy/kartograf@main
Expand Down
6 changes: 3 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ dependencies:
- openff-toolkit-base >=0.16.2
- openff-units==0.3.1 # https://github.com/OpenFreeEnergy/openfe/pull/1374
- openmm ~=8.2.0 # omit 8.3.0 and 8.3.1 due to https://github.com/openmm/openmm/pull/5069, unpin once we've qualified 8.3.2
- openmmforcefields >=0.15.0 # min needed for https://github.com/OpenFreeEnergy/openfe/pull/1695
- openmmtools >=0.25.0
- packaging
- pandas
- perses>=0.10.3
Expand Down Expand Up @@ -52,4 +50,6 @@ dependencies:
# Control blas/openmp threads
- threadpoolctl
- pip:
- git+https://github.com/OpenFreeEnergy/gufe@main
- git+https://github.com/OpenFreeEnergy/gufe@membrane_prototype
- git+https://github.com/hannahbaumann/openmmtools@update_disabling_barostat
- git+https://github.com/hannahbaumann/openmmforcefields@systemgenerator_bastostat
1 change: 1 addition & 0 deletions openfe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
LigandAtomMapping,
NonTransformation,
ProteinComponent,
ProteinMembraneComponent,
SmallMoleculeComponent,
SolventComponent,
Transformation,
Expand Down
25 changes: 19 additions & 6 deletions openfe/protocols/openmm_afe/equil_binding_afe_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from gufe import (
ChemicalSystem,
ProteinComponent,
ProteinMembraneComponent,
SmallMoleculeComponent,
SolventComponent,
settings,
Expand Down Expand Up @@ -655,13 +656,19 @@ def _validate_endstates(
If stateB contains any unique Components.
If the alchemical species is charged.
"""
if not (stateA.contains(ProteinComponent) and stateB.contains(ProteinComponent)):
errmsg = "No ProteinComponent found"
raise ValueError(errmsg)
components = (ProteinComponent, ProteinMembraneComponent)
system_validation.require_components(
systems=[stateA, stateB],
component_types=components,
msg="No ProteinComponent or ProteinMembraneComponent found",
)

if not (stateA.contains(SolventComponent) and stateB.contains(SolventComponent)):
errmsg = "No SolventComponent found"
raise ValueError(errmsg)
components = (SolventComponent, ProteinMembraneComponent)
system_validation.require_components(
systems=[stateA, stateB],
component_types=components,
msg="No SolventComponent or ProteinMembraneComponent found",
)

# Needs gufe 1.3
diff = stateA.component_diff(stateB)
Expand Down Expand Up @@ -944,6 +951,12 @@ def _get_components(self):
# an error will have been raised when calling `validate_solvent`
# in the Protocol's `_create`.
# Similarly we don't need to check prot_comp

# If there is a ProteinMembraneComponent, we set the SolventComponent
# in the complex to None, as it is only used in the solvent leg
if isinstance(prot_comp, ProteinMembraneComponent):
solv_comp = None

return alchem_comps, solv_comp, prot_comp, off_comps

def _handle_settings(self) -> dict[str, SettingsBaseModel]:
Expand Down
27 changes: 19 additions & 8 deletions openfe/protocols/openmm_md/plain_md_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import openmm.unit as omm_unit
from gufe import (
ChemicalSystem,
ProteinMembraneComponent,
SmallMoleculeComponent,
settings,
)
Expand All @@ -32,6 +33,7 @@
from openff.toolkit.topology import Molecule as OFFMolecule
from openff.units import Quantity, unit
from openff.units.openmm import from_openmm, to_openmm
from openmm import MonteCarloBarostat, MonteCarloMembraneBarostat

from openfe.protocols.openmm_md.plain_md_settings import (
IntegratorSettings,
Expand Down Expand Up @@ -187,7 +189,11 @@ def _create(
# TODO: Deal with multiple ProteinComponents
solvent_comp, protein_comp, small_mols = system_validation.get_components(stateA)

system_name = "Solvent MD" if solvent_comp is not None else "Vacuum MD"
system_name = (
"Solvent MD"
if solvent_comp is not None or isinstance(protein_comp, ProteinMembraneComponent)
else "Vacuum MD"
)

for comp in [protein_comp] + small_mols:
if comp is not None:
Expand Down Expand Up @@ -363,9 +369,9 @@ def _run_MD(
logger.info("Running NVT equilibration")

# Set barostat frequency to zero for NVT
for x in simulation.context.getSystem().getForces():
if x.getName() == "MonteCarloBarostat":
x.setFrequency(0)
for force in simulation.context.getSystem().getForces():
if isinstance(force, (MonteCarloBarostat, MonteCarloMembraneBarostat)):
force.setFrequency(0)

simulation.context.setVelocitiesToTemperature(to_openmm(temperature))

Expand Down Expand Up @@ -397,9 +403,9 @@ def _run_MD(
simulation.context.setVelocitiesToTemperature(to_openmm(temperature))

# Enable the barostat for NPT
for x in simulation.context.getSystem().getForces():
if x.getName() == "MonteCarloBarostat":
x.setFrequency(barostat_frequency.m)
for force in simulation.context.getSystem().getForces():
if isinstance(force, (MonteCarloBarostat, MonteCarloMembraneBarostat)):
force.setFrequency(barostat_frequency.m)

t0 = time.time()
simulation.step(equil_steps_npt)
Expand Down Expand Up @@ -585,7 +591,7 @@ def run(
solvent_comp, protein_comp, small_mols = system_validation.get_components(stateA)

# 1. Create stateA system
# Create a dictionary of OFFMol for each SMC for bookeeping
# Create a dictionary of OFFMol for each SMC for bookkeeping
smc_components: dict[SmallMoleculeComponent, OFFMolecule]

smc_components = {i: i.to_openff() for i in small_mols}
Expand Down Expand Up @@ -634,6 +640,11 @@ def run(
stateA_topology,
molecules=[s.to_openff() for s in small_mols],
)
box = [
openmm.Vec3(*v.value_in_unit(omm_unit.nanometer))
for v in stateA_system.getDefaultPeriodicBoxVectors()
] * omm_unit.nanometer
stateA_topology.setPeriodicBoxVectors(box)

# f. Save pdb of entire system
if output_settings.preminimized_structure:
Expand Down
15 changes: 10 additions & 5 deletions openfe/protocols/openmm_rfe/_rfe_utils/relative.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,12 @@ def _check_and_store_system_forces(self):

def _check_unknown_forces(forces, system_name):
# TODO: double check that CMMotionRemover is ok being here
known_forces = {'HarmonicBondForce', 'HarmonicAngleForce',
'PeriodicTorsionForce', 'NonbondedForce',
'MonteCarloBarostat', 'CMMotionRemover', 'CMAPTorsionForce'}
known_forces = {
'HarmonicBondForce', 'HarmonicAngleForce',
'PeriodicTorsionForce', 'NonbondedForce',
'MonteCarloBarostat', 'CMMotionRemover',
'CMAPTorsionForce', 'MonteCarloMembraneBarostat',
}

force_names = forces.keys()
unknown_forces = set(force_names) - set(known_forces)
Expand Down Expand Up @@ -548,9 +551,11 @@ def _handle_box(self):
"""
# Check that if there is a barostat in the old system,
# it is added to the hybrid system
if "MonteCarloBarostat" in self._old_system_forces.keys():
known_barostats = ["MonteCarloBarostat", "MonteCarloMembraneBarostat"]
present_barostat = [i for i in self._old_system_forces.keys() if i in known_barostats]
if len(present_barostat) == 1:
barostat = copy.deepcopy(
self._old_system_forces["MonteCarloBarostat"])
self._old_system_forces[present_barostat[0]])
self._hybrid_system.addForce(barostat)

# Copy over the box vectors from the old system
Expand Down
13 changes: 10 additions & 3 deletions openfe/protocols/openmm_rfe/equil_rfe_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
ComponentMapping,
LigandAtomMapping,
ProteinComponent,
ProteinMembraneComponent,
SmallMoleculeComponent,
SolventComponent,
settings,
Expand Down Expand Up @@ -1182,20 +1183,26 @@ def run(

sampler.energy_context_cache = energy_context_cache
sampler.sampler_context_cache = sampler_context_cache

if not dry: # pragma: no-cover
# minimize
print(
"box1", sampler._thermodynamic_states[0].system.getDefaultPeriodicBoxVectors()
)
if verbose:
self.logger.info("Running minimization")

sampler.minimize(max_iterations=sampler_settings.minimization_steps)

print(
"box2", sampler._thermodynamic_states[0].system.getDefaultPeriodicBoxVectors()
)
# equilibrate
if verbose:
self.logger.info("Running equilibration phase")

sampler.equilibrate(int(equil_steps / steps_per_iteration))

print(
"box3", sampler._thermodynamic_states[0].system.getDefaultPeriodicBoxVectors()
)
# production
if verbose:
self.logger.info("Running production phase")
Expand Down
15 changes: 13 additions & 2 deletions openfe/protocols/openmm_septop/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ def _pre_equilibrate(

# Don't do anything if we're doing a dry run
if dry:
return positions, system.getDefaultPeriodicBoxVectors()
box = [
openmm.Vec3(*v.value_in_unit(omm_unit.nanometer))
for v in system.getDefaultPeriodicBoxVectors()
] * omm_unit.nanometer
return positions, box

# TODO: Refactor this part to live outside the method call
# We have to modify the output settings to have different output
Expand Down Expand Up @@ -1373,4 +1377,11 @@ def run(
**unit_result_dict,
}
else:
return {"debug": {"sampler": sampler}}
return {
"debug": {
"sampler": sampler,
"alchem_system": system,
"selection_indices": self.selection_indices,
"positions": equil_positions,
}
}
Loading
Loading