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

Fixing FIREMinimizerIntegrator #420

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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: 5 additions & 3 deletions openmmtools/integrators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2198,8 +2198,10 @@ def __init__(self, timestep=1.0 * unit.femtoseconds, tolerance=None, alpha=0.1,
self.addPerDofVariable("x1", 0)
self.addGlobalVariable("E0", 0) # old energy associated with x0
self.addGlobalVariable("dE", 0)
self.addGlobalVariable("is_nan",0)
self.addGlobalVariable("restart", 0)
self.addGlobalVariable("delta_t", timestep.value_in_unit_system(unit.md_unit_system))
self.addGlobalVariable("dt_min", 1.0e-5*timestep.value_in_unit_system(unit.md_unit_system))

# Update context state.
self.addUpdateContextState()
Expand Down Expand Up @@ -2256,7 +2258,8 @@ def __init__(self, timestep=1.0 * unit.femtoseconds, tolerance=None, alpha=0.1,

# Back up if the energy went up, protecing against NaNs
self.addComputeGlobal('restart', '1')
self.beginIfBlock('dE < 0')
self.addComputeGlobal('is_nan','step( exp(-dE)/kT - uniform)')
self.beginIfBlock('is_nan = 1')
self.addComputeGlobal('restart', '0')
self.endBlock()
self.beginIfBlock('restart > 0')
Expand All @@ -2266,8 +2269,7 @@ def __init__(self, timestep=1.0 * unit.femtoseconds, tolerance=None, alpha=0.1,
self.endBlock()

# If dt goes to zero, signal we've converged!
dt_min = 1.0e-5 * timestep
self.beginIfBlock('delta_t <= %f' % dt_min.value_in_unit_system(unit.md_unit_system))
self.beginIfBlock('delta_t <= dt_min')
self.addComputeGlobal('converged', '1')
self.endBlock()

Expand Down
4 changes: 2 additions & 2 deletions openmmtools/multistate/multistatesampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,8 @@ def create(self, thermodynamic_states: list, sampler_states, storage,
self._initialize_reporter()

@utils.with_timer('Minimizing all replicas')
def minimize(self, tolerance=1.0 * unit.kilojoules_per_mole / unit.nanometers,
max_iterations=0):
def minimize(self, tolerance=2.0 * unit.kilojoules_per_mole / unit.nanometers,
max_iterations=1000):
"""Minimize all replicas.

Minimized positions are stored at the end.
Expand Down