-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store initial and final topologies for all phases -- small molecule pipeline #1210
Changes from 9 commits
a73586f
9ada08e
36a7458
dd9d164
2e7aa04
be7f52a
f0b23bd
4a593be
c90e539
499b39e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -7,7 +7,6 @@ | |||
from perses.app import setup_relative_calculation | ||||
import mdtraj as md | ||||
from openmmtools import states, alchemy, testsystems, cache | ||||
from unittest import skipIf | ||||
import pytest | ||||
|
||||
from perses.tests.utils import enter_temp_directory | ||||
|
@@ -19,7 +18,6 @@ | |||
'lambda_electrostatics' : 'lambda', | ||||
} | ||||
|
||||
|
||||
def generate_example_waterbox_states(temperature=300.0*unit.kelvin, pressure=1.0*unit.atmosphere): | ||||
""" | ||||
This is a convenience function to generate a CompoundThermodynamicState and SamplerState to use in other tests. | ||||
|
@@ -260,47 +258,6 @@ def warn(*args, **kwargs): | |||
found_tla = True | ||||
assert found_tla == True, 'Spectator TLA not in old topology' | ||||
|
||||
|
||||
def test_host_guest_deterministic_geometries(): | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this test being deleted? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It basically got replaced by the test at perses/perses/tests/test_relative_setup.py Line 368 in 499b39e
The diff between the two is shown in the following screenshot You can see only the forcefield was changed between the tests (since we want to be testing openff rather than gaff, preferably), and the lines to test the storage pdbs were added. |
||||
""" | ||||
execute the `RelativeFEPSetup` with geometries specified for a host-guest relative free energy pair | ||||
""" | ||||
from perses.app.relative_setup import RelativeFEPSetup | ||||
|
||||
# Setup directory | ||||
ligand_sdf = resource_filename("perses", "data/given-geometries/ligands.sdf") | ||||
host_pdb = resource_filename("perses", "data/given-geometries/receptor.pdb") | ||||
|
||||
setup = RelativeFEPSetup( | ||||
ligand_input = ligand_sdf, | ||||
old_ligand_index=0, | ||||
new_ligand_index=1, | ||||
forcefield_files = ['amber/ff14SB.xml','amber/tip3p_standard.xml','amber/tip3p_HFE_multivalent.xml'], | ||||
phases = ['complex', 'solvent', 'vacuum'], | ||||
protein_pdb_filename=host_pdb, | ||||
receptor_mol2_filename=None, | ||||
pressure=1.0 * unit.atmosphere, | ||||
temperature=300.0 * unit.kelvin, | ||||
solvent_padding=9.0 * unit.angstroms, | ||||
ionic_strength=0.15 * unit.molar, | ||||
hmass=3*unit.amus, | ||||
neglect_angles=False, | ||||
map_strength='default', | ||||
atom_expr=None, | ||||
bond_expr=None, | ||||
anneal_14s=False, | ||||
small_molecule_forcefield='gaff-2.11', | ||||
small_molecule_parameters_cache=None, | ||||
trajectory_directory=None, | ||||
trajectory_prefix=None, | ||||
spectator_filenames=None, | ||||
nonbonded_method = 'PME', | ||||
complex_box_dimensions=None, | ||||
solvent_box_dimensions=None, | ||||
remove_constraints=False, | ||||
use_given_geometries = True | ||||
) | ||||
|
||||
def test_relative_setup_charge_change(): | ||||
""" | ||||
execute `RelativeFEPSetup` in solvent/complex phase on a charge change and assert that the modified new system and old system charge difference is zero. | ||||
|
@@ -357,7 +314,6 @@ def test_relative_setup_solvent_padding(): | |||
Check that the user inputted solvent_padding argument to `RelativeFEPSetup` actually changes the padding for the solvent phase | ||||
""" | ||||
from perses.app.relative_setup import RelativeFEPSetup | ||||
import numpy as np | ||||
|
||||
input_solvent_padding = 1.7 * unit.nanometers | ||||
smiles_filename = resource_filename("perses", os.path.join("data", "test.smi")) | ||||
|
@@ -409,6 +365,58 @@ def test_relative_setup_list_ligand_input(): | |||
assert ligand_input_size == expected_input_size, f"There should be {expected_input_size} ligand input files, " \ | ||||
f"receiving {ligand_input_size} files." | ||||
|
||||
def test_relative_setup_topologies_storage(tmp_path): | ||||
""" | ||||
Check that topologies get stored | ||||
""" | ||||
from perses.app.relative_setup import RelativeFEPSetup | ||||
|
||||
# if __name__=="__main__": | ||||
# test_run_cdk2_iterations_repex() | ||||
# Setup directory | ||||
ligand_sdf = resource_filename("perses", "data/given-geometries/ligands.sdf") | ||||
host_pdb = resource_filename("perses", "data/given-geometries/receptor.pdb") | ||||
|
||||
fe_setup = RelativeFEPSetup( | ||||
ligand_input=ligand_sdf, | ||||
old_ligand_index=0, | ||||
new_ligand_index=1, | ||||
forcefield_files=['amber/ff14SB.xml', 'amber/tip3p_standard.xml', 'amber/tip3p_HFE_multivalent.xml'], | ||||
phases=['complex', 'solvent', 'vacuum'], | ||||
protein_pdb_filename=host_pdb, | ||||
receptor_mol2_filename=None, | ||||
pressure=1.0 * unit.atmosphere, | ||||
temperature=300.0 * unit.kelvin, | ||||
solvent_padding=9.0 * unit.angstroms, | ||||
ionic_strength=0.15 * unit.molar, | ||||
hmass=3 * unit.amus, | ||||
neglect_angles=False, | ||||
map_strength='default', | ||||
atom_expr=None, | ||||
bond_expr=None, | ||||
anneal_14s=False, | ||||
small_molecule_forcefield='openff-2.1.0', | ||||
small_molecule_parameters_cache=None, | ||||
trajectory_directory=tmp_path, | ||||
trajectory_prefix="host-guest", | ||||
spectator_filenames=None, | ||||
nonbonded_method='PME', | ||||
complex_box_dimensions=None, | ||||
solvent_box_dimensions=None, | ||||
remove_constraints=False, | ||||
use_given_geometries=True | ||||
) | ||||
|
||||
expected_files = [ | ||||
'host-guest_vacuum_old.pdb', | ||||
'host-guest_vacuum_new.pdb', | ||||
'host-guest_solvent_old.pdb', | ||||
'host-guest_solvent_new.pdb', | ||||
'host-guest_complex_old.pdb', | ||||
'host-guest_complex_new.pdb', | ||||
] | ||||
for file in expected_files: | ||||
pdb_filename = f"{tmp_path}/models/{file}" | ||||
assert os.path.exists(pdb_filename) | ||||
|
||||
# Assert that no extra files are created | ||||
files_in_directory = os.listdir(f"{tmp_path}/models") | ||||
assert len(files_in_directory) == len(expected_files) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for keeping this an
AnyPath