openmmtools.mcmc.MonteCarloBarostatMove

class openmmtools.mcmc.MonteCarloBarostatMove(n_attempts=5, **kwargs)[source]

Monte Carlo barostat move.

This move makes one or more attempts to update the box volume using Monte Carlo updates.

Parameters:
n_attempts : int, optional

The number of Monte Carlo attempts to make to adjust the box volume (default is 5).

context_cache : openmmtools.cache.ContextCache, optional

The ContextCache to use for Context creation. If None, the global cache openmmtools.cache.global_context_cache is used (default is None).

Examples

The thermodynamic state must be barostated by a MonteCarloBarostat force. The class ThermodynamicState takes care of adding one when we specify the pressure in its constructor.

>>> from simtk import unit
>>> from openmmtools import testsystems
>>> from openmmtools.states import ThermodynamicState, SamplerState
>>> test = testsystems.AlanineDipeptideExplicit()
>>> sampler_state = SamplerState(positions=test.positions)
>>> thermodynamic_state = ThermodynamicState(system=test.system, temperature=298*unit.kelvin,
...                                          pressure=1.0*unit.atmosphere)

Create a MonteCarloBarostatMove move with default parameters.

>>> move = MonteCarloBarostatMove()

or create a GHMC move with specified parameters.

>>> move = MonteCarloBarostatMove(n_attempts=2)

Perform one update of the sampler state. The sampler state is updated with the new state.

>>> move.apply(thermodynamic_state, sampler_state)
>>> np.allclose(sampler_state.positions, test.positions)
False
Attributes:
n_attempts

The number of MC attempts to make to adjust the box volume.

context_cache : openmmtools.cache.ContextCache

The ContextCache to use for Context creation. If None, the global cache openmmtools.cache.global_context_cache is used.

Methods

apply(thermodynamic_state, sampler_state) Apply the MCMC move.
__init__(n_attempts=5, **kwargs)[source]

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

Methods

__init__([n_attempts]) x.__init__(…) initializes x; see help(type(x)) for signature
apply(thermodynamic_state, sampler_state) Apply the MCMC move.

Attributes

n_attempts The number of MC attempts to make to adjust the box volume.
apply(thermodynamic_state, sampler_state)[source]

Apply the MCMC move.

The thermodynamic state must be barostated by a MonteCarloBarostat force. This modifies the given sampler_state.

Parameters:
thermodynamic_state : openmmtools.states.ThermodynamicState

The thermodynamic state to use when applying the MCMC move.

sampler_state : openmmtools.states.SamplerState

The sampler state to apply the move to. This is modified.

n_attempts

The number of MC attempts to make to adjust the box volume.