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_attemptsint, optional
The number of Monte Carlo attempts to make to adjust the box volume (default is 5).
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 openmm 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,context_cache=context_cache) >>> np.allclose(sampler_state.positions, test.positions) False
- Attributes:
n_attempts
The number of MC attempts to make to adjust the box volume.
Methods
apply
(thermodynamic_state, sampler_state[, ...])Apply the MCMC move.
Methods
__init__
([n_attempts])apply
(thermodynamic_state, sampler_state[, ...])Apply the MCMC move.
Attributes
context_cache
n_attempts
The number of MC attempts to make to adjust the box volume.