openmmtools.mcmc.SequenceMove

class openmmtools.mcmc.SequenceMove(move_list, context_cache=None)[source]

A sequence of MCMC moves.

Parameters:
move_list : list-like of MCMCMove

The sequence of MCMC moves to apply.

context_cache : openmmtools.cache.ContextCache, optional

If not None, the context_cache of all the moves in the sequence will be set to this (default is None).

Examples

NPT ensemble simulation of a Lennard Jones fluid with a sequence of moves.

>>> import numpy as np
>>> from simtk import unit
>>> from openmmtools import testsystems
>>> from openmmtools.states import ThermodynamicState, SamplerState
>>> test = testsystems.LennardJonesFluid(nparticles=200)
>>> thermodynamic_state = ThermodynamicState(system=test.system, temperature=298*unit.kelvin,
...                                          pressure=1*unit.atmospheres)
>>> sampler_state = SamplerState(positions=test.positions)
>>> # Create a move set that includes a Monte Carlo barostat move.
>>> move = SequenceMove([GHMCMove(n_steps=50), MonteCarloBarostatMove(n_attempts=5)])
>>> # Create an MCMC sampler instance and run 5 iterations of the simulation.
>>> sampler = MCMCSampler(thermodynamic_state, sampler_state, move=move)
>>> sampler.run(n_iterations=2)
>>> np.allclose(sampler.sampler_state.positions, test.positions)
False
Attributes:
move_list : list of MCMCMove

The sequence of MCMC moves to apply.

Methods

apply(thermodynamic_state, sampler_state) Apply the sequence of MCMC move in order.
__init__(move_list, context_cache=None)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

Methods

__init__(move_list[, context_cache]) x.__init__(…) initializes x; see help(type(x)) for signature
apply(thermodynamic_state, sampler_state) Apply the sequence of MCMC move in order.

Attributes

statistics The statistics of all moves as a list of dictionaries.
apply(thermodynamic_state, sampler_state)[source]

Apply the sequence of MCMC move in order.

Parameters:
thermodynamic_state : openmmtools.states.ThermodynamicState

The thermodynamic state to use to propagate dynamics.

sampler_state : openmmtools.states.SamplerState

The sampler state to apply the move to.

statistics

The statistics of all moves as a list of dictionaries.