Skip to content

Commit

Permalink
remove double mapping validation, fix toluene to toluene test
Browse files Browse the repository at this point in the history
  • Loading branch information
jthorton committed Sep 24, 2024
1 parent 82447f0 commit 55b8765
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
4 changes: 1 addition & 3 deletions feflow/protocols/nonequilibrium_cycling.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,12 +996,10 @@ def _create(
)
from openfe.protocols.openmm_utils import system_validation

# Handle parameters
if mapping is None:
raise ValueError("`mapping` is required for this Protocol")
if extends:
raise NotImplementedError("Can't extend simulations yet")

# Do manual validation until it is part of the protocol
# Get alchemical components & validate them + mapping
alchem_comps = system_validation.get_alchemical_components(stateA, stateB)
# raise an error if we have more than one mapping
Expand Down
4 changes: 2 additions & 2 deletions feflow/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ def mapping_toluene_toluene(toluene):
i: i for i in range(len(toluene.to_rdkit().GetAtoms()))
}
mapping_obj = LigandAtomMapping(
componentA=toluene,
componentB=toluene,
componentA=toluene.copy_with_replacements(name="toluene_a"),
componentB=toluene.copy_with_replacements(name="toluene_b"),
componentA_to_componentB=mapping_toluene_to_toluene,
)
return mapping_obj
Expand Down
20 changes: 16 additions & 4 deletions feflow/tests/test_nonequilibrium_cycling.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,13 @@ def test_create_execute_gather(
],
)
def test_create_execute_gather_toluene_to_toluene(
self, protocol, toluene_vacuum_system, mapping_toluene_toluene, tmpdir, request
self,
protocol,
toluene_vacuum_system,
mapping_toluene_toluene,
tmpdir,
request,
toluene,
):
"""
Perform 20 independent simulations of the NEQ cycling protocol for the toluene to toluene
Expand All @@ -324,10 +330,16 @@ def test_create_execute_gather_toluene_to_toluene(
import numpy as np

protocol = request.getfixturevalue(protocol)

# rename the components
toluene_state_a = toluene_vacuum_system.copy_with_replacements(
components={"ligand": toluene.copy_with_replacements(name="toluene_a")}
)
toluene_state_b = toluene_vacuum_system.copy_with_replacements(
components={"ligand": toluene.copy_with_replacements(name="toluene_b")}
)
dag = protocol.create(
stateA=toluene_vacuum_system,
stateB=toluene_vacuum_system,
stateA=toluene_state_a,
stateB=toluene_state_b,
name="Toluene vacuum transformation",
mapping=mapping_toluene_toluene,
)
Expand Down

0 comments on commit 55b8765

Please sign in to comment.