Skip to content

Commit

Permalink
Merge pull request #164 from fjclark/bugfix_somd_pert_files
Browse files Browse the repository at this point in the history
Ensure that SOMD ABFE pert files are always correct
  • Loading branch information
lohedges authored Sep 1, 2023
2 parents 6fdda73 + c37f9e2 commit e26d2d0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
7 changes: 5 additions & 2 deletions python/BioSimSpace/Sandpit/Exscientia/Process/_somd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,9 @@ def atom_sorting_criteria(atom):
# Get the perturbed atom.
atom = mol.atom(idx)

# Start atom record.
file.write(" atom\n")

# Only require the initial Lennard-Jones properties.
LJ0 = atom.property("LJ0")

Expand Down Expand Up @@ -3002,8 +3005,8 @@ def sort_dihedrals(dihedrals, idx):
# End improper record.
file.write(" endimproper\n")

# End molecule record.
file.write("endmolecule\n")
# End molecule record.
file.write("endmolecule\n")

# Finally, convert the molecule to the lambda = 0 state.

Expand Down
16 changes: 16 additions & 0 deletions tests/Sandpit/Exscientia/Protocol/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,16 @@ def test_turn_on_restraint(self, system_and_restraint):
assert atom in pert_text
# Check perturbations are correct
lines = [
"molecule LIG",
"atom",
"initial_type C1",
"final_type C1",
"initial_LJ 3.48065 0.08688",
"final_LJ 3.48065 0.08688",
"initial_charge -0.13000",
"final_charge -0.13000",
"endatom",
"endmolecule",
]
for line in lines:
assert line in pert_text
Expand Down Expand Up @@ -413,12 +417,16 @@ def test_discharge(self, system_and_restraint):
assert atom in pert_text
# Check perturbations are correct
lines = [
"molecule LIG",
"atom",
"initial_type C1",
"final_type C1",
"initial_LJ 3.48065 0.08688",
"final_LJ 3.48065 0.08688",
"initial_charge -0.13000",
"final_charge -0.00000",
"endatom",
"endmolecule",
]
for line in lines:
assert line in pert_text
Expand Down Expand Up @@ -453,12 +461,16 @@ def test_vanish(self, system_and_restraint):
assert atom in pert_text
# Check perturbations are correct
lines = [
"molecule LIG",
"atom",
"initial_type C1",
"final_type du",
"initial_LJ 3.48065 0.08688",
"final_LJ 0.00000 0.00000",
"initial_charge -0.00000",
"final_charge -0.00000",
"endatom",
"endmolecule",
]
for line in lines:
assert line in pert_text
Expand Down Expand Up @@ -493,12 +505,16 @@ def test_discharge_and_vanish(self, system_and_restraint):
assert atom in pert_text
# Check perturbations are correct
lines = [
"molecule LIG",
"atom",
"initial_type C1",
"final_type du",
"initial_LJ 3.48065 0.08688",
"final_LJ 0.00000 0.00000",
"initial_charge -0.13000",
"final_charge 0.00000",
"endatom",
"endmolecule",
]
for line in lines:
assert line in pert_text
Expand Down

0 comments on commit e26d2d0

Please sign in to comment.