Skip to content

Commit

Permalink
Fix ABFE restraint written twice when there is no position restraint (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
xiki-tempula authored Jun 13, 2024
1 parent 86555d1 commit 0d7cf23
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
1 change: 0 additions & 1 deletion python/BioSimSpace/Sandpit/Exscientia/Process/_gromacs.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ def _write_system(self, system, coord_file=None, topol_file=None, ref_file=None)
match_waters=False,
property_map=self._property_map,
)
self._apply_ABFE_restraint()

def _apply_ABFE_restraint(self):
# Write the restraint to the topology file
Expand Down
22 changes: 21 additions & 1 deletion tests/Sandpit/Exscientia/Process/test_gromacs.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,27 @@ def test_regular_protocol(self, setup, tmp_path_factory):
# Run the process and check that it finishes without error.
run_process(system, protocol, restraint=restraint, work_dir=str(tmp_path))
with open(tmp_path / "test.top", "r") as f:
assert "intermolecular_interactions" in f.read()
text = f.read()
assert text.count("intermolecular_interactions") == 1

def test_position_restraint_protocol(self, setup, tmp_path_factory):
"""Test if the restraint has been written in a way that could be processed
correctly.
"""
tmp_path = tmp_path_factory.mktemp("out")
system, restraint = setup
# Create a short production protocol.
protocol = BSS.Protocol.FreeEnergy(
runtime=BSS.Types.Time(0.0001, "nanoseconds"),
perturbation_type="full",
restraint="heavy",
)

# Run the process and check that it finishes without error.
run_process(system, protocol, restraint=restraint, work_dir=str(tmp_path))
with open(tmp_path / "test.top", "r") as f:
text = f.read()
assert text.count("intermolecular_interactions") == 1

def test_restraint_lambda(self, setup, tmp_path_factory):
"""Test if the restraint has been written correctly when restraint lambda is evoked."""
Expand Down

0 comments on commit 0d7cf23

Please sign in to comment.