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

Specifying hybrid topology factory (htf) from input file #988

Merged
merged 13 commits into from
May 18, 2022
Merged
Prev Previous commit
Next Next commit
Support for multisampler platform spec from YAML input file.
  • Loading branch information
ijpulidos committed May 5, 2022
commit 86fe7b6a120646f5601af1d94557132b652fe78a
8 changes: 6 additions & 2 deletions perses/app/setup_relative_calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ def getSetupOptions(filename):
setup_options['hybrid_topology_factory'] = default_htf_class_name
_logger.info(f"\t 'hybrid_topology_factory' not specified: default to {default_htf_class_name}")

# Handling absence platform name input (backwards compatibility)
if 'platform' not in setup_options:
setup_options['platform'] = None # defaults to choosing best platform

os.makedirs(trajectory_directory, exist_ok=True)


Expand Down Expand Up @@ -659,7 +663,7 @@ def run_setup(setup_options, serialize_systems=True, build_samplers=True):
return {'topology_proposals': top_prop, 'hybrid_topology_factories': htf}

# get platform
platform = get_openmm_platform(platform_name=None)
platform = get_openmm_platform(platform_name=setup_options['platform'])
# Setup context caches for multistate samplers
energy_context_cache = cache.ContextCache(capacity=None, time_to_live=None, platform=platform)
sampler_context_cache = cache.ContextCache(capacity=None, time_to_live=None, platform=platform)
Expand Down Expand Up @@ -958,7 +962,7 @@ def _resume_run(setup_options):
from openmmtools.cache import ContextCache
from perses.samplers.multistate import HybridSAMSSampler, HybridRepexSampler
# get platform
platform = get_openmm_platform(platform_name=None)
platform = get_openmm_platform(platform_name=setup_options['platform'])
# Setup context caches for multistate samplers
energy_context_cache = ContextCache(capacity=None, time_to_live=None, platform=platform)
sampler_context_cache = ContextCache(capacity=None, time_to_live=None, platform=platform)
Expand Down