openmmtools icon indicating copy to clipboard operation
openmmtools copied to clipboard

Minimization in ReplicaExchangeSampler

Open djhuggins opened this issue 4 years ago • 4 comments

Hello,

I have been using the minimize function in ReplicaExchangeSampler to minimize a set of replicas in different alchemical states like this:

lsd_move = openmmtools.mcmc.LangevinSplittingDynamicsMove(options) repex_simulation = ReplicaExchangeSampler(mcmc_moves=lsd_move) repex_simulation.minimize()

I am finding a lot of the replicas NaN when the initial structure contains a clash. I tried changing the minimize options but it always NaNs. I then tried the following which fixes the problem.

for k in range(nstates): sampler_state = sampler_states[k] thermodynamic_state = thermodynamic_states[k] integrator=LangevinIntegrator() context = thermodynamic_state.create_context(integrator) sampler_state.apply_to_context(context) mm.LocalEnergyMinimizer.minimize(context) sampler_state.update_from_context(context)

As far as I can see ReplicaExchangeSampler uses the FIREMinimizationIntegrator. Could the minimize function be set to use LocalEnergyMinimizer as an option? It seems more effective in this case.

Cheers,

Dave

djhuggins avatar Jul 31 '20 19:07 djhuggins

@hannahbrucemacdonald @dominicrufa @jaimergp : Didn't you find a way to change this default behavior? I was under the impression that was backported to openmmtools.

jchodera avatar Aug 01 '20 05:08 jchodera

Hi,

The Fire minimizer has been problematic, I wasn't aware that it was still the default and I can change it back to LocalEnergyMinimizer (Linking to issue #394 ) . Thanks for spotting this Dave - I will change it now

hannahbrucemacdonald avatar Aug 03 '20 07:08 hannahbrucemacdonald

Sorry I spoke too soon -- it looks like if the Fire integrator nans, then it should fall back to openmm's LocalEnergyMinimizer anyway. What version of openmmtools are you using?

hannahbrucemacdonald avatar Aug 03 '20 07:08 hannahbrucemacdonald

Hi Hannah,

I should have been clearer in my initial message. The (FIRE) minimizer completes without NANs. Its the equilibration that then NANs immediately. Looking at the initial and minimized energies for FIRE vs LocalEnergyMinimizer I can see that LocalEnergyMinimizer reduces the energy a LOT more.

Dave

djhuggins avatar Aug 03 '20 14:08 djhuggins