MonteCarloBarostat

class OpenMM::MonteCarloBarostat : public OpenMM::Force

This class uses a Monte Carlo algorithm to adjust the size of the periodic box, simulating the effect of constant pressure.

This class assumes the simulation is also being run at constant temperature, and requires you to specify the system temperature (since it affects the acceptance probability for Monte Carlo moves). It does not actually perform temperature regulation, however. You must use another mechanism along with it to maintain the temperature, such as LangevinIntegrator or AndersenThermostat.

Public Functions

MonteCarloBarostat(double defaultPressure, double defaultTemperature, int frequency = 25)

Create a MonteCarloBarostat.

Parameters
  • defaultPressure – the default pressure acting on the system (in bar)

  • defaultTemperature – the default temperature at which the system is being maintained (in Kelvin)

  • frequency – the frequency at which Monte Carlo pressure changes should be attempted (in time steps)

inline double getDefaultPressure() const

Get the default pressure acting on the system (in bar).

Returns

the default pressure acting on the system, measured in bar.

inline void setDefaultPressure(double pressure)

Set the default pressure acting on the system. This will affect any new Contexts you create, but not ones that already exist.

Parameters

pressure – the default pressure acting on the system, measured in bar.

inline int getFrequency() const

Get the frequency (in time steps) at which Monte Carlo pressure changes should be attempted. If this is set to 0, the barostat is disabled.

inline void setFrequency(int freq)

Set the frequency (in time steps) at which Monte Carlo pressure changes should be attempted. If this is set to 0, the barostat is disabled.

inline double getDefaultTemperature() const

Get the default temperature at which the system is being maintained, measured in Kelvin.

inline void setDefaultTemperature(double temp)

Set the default temperature at which the system is being maintained. This will affect any new Contexts you create, but not ones that already exist.

Parameters

temp – the system temperature, measured in Kelvin.

inline int getRandomNumberSeed() const

Get the random number seed. See setRandomNumberSeed() for details.

inline void setRandomNumberSeed(int seed)

Set the random number seed. It is guaranteed that if two simulations are run with different random number seeds, the sequence of Monte Carlo steps will be different. On the other hand, no guarantees are made about the behavior of simulations that use the same seed. In particular, Platforms are permitted to use non-deterministic algorithms which produce different results on successive runs, even if those runs were initialized identically.

If seed is set to 0 (which is the default value assigned), a unique seed is chosen when a Context is created from this Force. This is done to ensure that each Context receives unique random seeds without you needing to set them explicitly.

inline virtual bool usesPeriodicBoundaryConditions() const

Returns whether or not this force makes use of periodic boundary conditions.

Returns

true if force uses PBC and false otherwise

Public Static Functions

static inline const std::string &Pressure()

This is the name of the parameter which stores the current pressure acting on the system (in bar).

static inline const std::string &Temperature()

This is the name of the parameter which stores the current temperature at which the system is being maintained (in Kelvin)