Skip to content
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

Fix spectator support #1233

Merged
merged 2 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 1 addition & 7 deletions perses/app/relative_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,6 @@ def __init__(self,
self._ligand_md_topology_new = md.Topology.from_openmm(self._ligand_topology_new)
_logger.info(f"Created mdtraj topologies for both ligands.")

# We must generate the complex topology and positions before the SystemGenerator is created because if the
# receptor is a mol2, it must be added to mol_list, which is use to create self._molecules, which is fed to the SystemGenerator
if 'complex' in phases:
_logger.info(f"setting up complex phase...")
self._setup_complex_phase()

# Select barostat
NONPERIODIC_NONBONDED_METHODS = [app.NoCutoff, app.CutoffNonPeriodic]
if pressure is not None:
Expand Down Expand Up @@ -365,7 +359,7 @@ def __init__(self,
spectator_mol = generate_unique_atom_names(spectator_mol)
self._spectator_molecules.append(spectator_mol)
# add this to a small molecule register
self._molecules.append(Molecule.from_openeye(spectator_mol,allow_undefined_stereo=True))
molecules.append(Molecule.from_openeye(spectator_mol, allow_undefined_stereo=True))
self._spectator_positions.append(extractPositionsFromOEMol(spectator_mol))
spectator_topology = forcefield_generators.generateTopologyFromOEMol(spectator_mol)
self._spectator_md_topologies.append(md.Topology.from_openmm(spectator_topology))
Expand Down
10 changes: 4 additions & 6 deletions perses/tests/test_relative_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ def warn(*args, **kwargs):

# TODO: Check output

#@skipIf(running_on_github_actions, "Skip analysis test on GH Actions. SLOW")
@pytest.mark.skip(reason="Skip analysis test on GH Actions. SLOW")
# Running it on gpu CI -- slow
@pytest.mark.gpu_needed
def test_run_bace_spectator():
"""
Ensure that we can instantiate and run a repex relative free energy calculation the cdk2 ligands in vacuum
Ensure that we can setup a simulation of BACE system with an spectator
"""
# Enter a temporary directory
from perses.tests.utils import enter_temp_directory
Expand Down Expand Up @@ -242,14 +242,12 @@ def warn(*args, **kwargs):
setup_options[parameter] = os.path.join(setup_directory, setup_options[parameter])
# only one spectator
setup_options['spectators'] = [ os.path.join(setup_directory, setup_options['spectators'][0])]
for parameter in ['trajectory_directory', 'trajectory_prefix', 'save_setup_pickle_as']:
for parameter in ['trajectory_directory', 'save_setup_pickle_as']:
setup_options[parameter] = os.path.join(tmpdirname, setup_options[parameter])


# Run setup
n_iterations = 2
setup_dict = setup_relative_calculation.run_setup(setup_options)
setup_dict['hybrid_samplers']['complex'].run(n_iterations=n_iterations)

# test that there is TLA in the complex system
found_tla = False
Expand Down