MonteCarloFlexibleBarostat

class openmm.openmm.MonteCarloFlexibleBarostat(*args)

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

This class is similar to MonteCarloBarostat, but it simulates a fully flexible periodic box in which all three lengths and all three angles are free to change independently. It is primarily useful for simulations of bulk materials where the shape of a crystal’s unit cell may not be known in advance, or could even change with time as it transitions between phases.

Like MonteCarloBarostat, the default behavior of this class is to scale the centroid position of each molecule while holding it rigid. In simulations of materials where all atoms are covalently bonded to each other, this behavior will not work well since the entire system then consists of a single molecule. You can use setScaleMoleculesAsRigid() to disable this behavior and instead have it scale the position of every atom independently.

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.

__init__(self, defaultPressure, defaultTemperature, frequency=25, scaleMoleculesAsRigid=True)MonteCarloFlexibleBarostat
__init__(self, other)MonteCarloFlexibleBarostat

Create a MonteCarloFlexibleBarostat.

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

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

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

  • scaleMoleculesAsRigid (bool) – if true, coordinate scaling keeps molecules rigid, scaling only the center of mass of each one. If false, every atom is scaled independently.

Methods

Pressure()

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

Temperature()

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

__init__(-> MonteCarloFlexibleBarostat)

Create a MonteCarloFlexibleBarostat.

getDefaultPressure(self)

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

getDefaultTemperature(self)

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

getForceGroup(self)

Get the force group this Force belongs to.

getFrequency(self)

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

getName(self)

Get the name of this Force.

getRandomNumberSeed(self)

Get the random number seed.

getScaleMoleculesAsRigid(self)

Get whether scaling is applied to the centroid of each molecule while keeping the molecules rigid, or to each atom independently.

setDefaultPressure(self, pressure)

Set the default pressure acting on the system.

setDefaultTemperature(self, temp)

Set the default temperature at which the system is being maintained.

setForceGroup(self, group)

Set the force group this Force belongs to.

setFrequency(self, freq)

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

setName(self, name)

Set the name of this Force.

setRandomNumberSeed(self, seed)

Set the random number seed.

setScaleMoleculesAsRigid(self, rigid)

Set whether scaling is applied to the centroid of each molecule while keeping the molecules rigid, or to each atom independently.

usesPeriodicBoundaryConditions(self)

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

Attributes

thisown

The membership flag

property thisown

The membership flag

static Pressure()std::string const &

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

static Temperature()std::string const &

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

getDefaultPressure(self)double

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

Returns

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

Return type

double

setDefaultPressure(self, 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 (double) – the default pressure acting on the system, measured in bar.

getFrequency(self)int

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.

setFrequency(self, 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.

getDefaultTemperature(self)double

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

setDefaultTemperature(self, 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 (double) – the system temperature, measured in Kelvin.

getRandomNumberSeed(self)int

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

setRandomNumberSeed(self, 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.

usesPeriodicBoundaryConditions(self)bool

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

Returns

true if force uses PBC and false otherwise

Return type

bool

getScaleMoleculesAsRigid(self)bool

Get whether scaling is applied to the centroid of each molecule while keeping the molecules rigid, or to each atom independently.

Returns

true if scaling is applied to molecule centroids, false if it is applied to each atom independently.

Return type

bool

setScaleMoleculesAsRigid(self, rigid)

Set whether scaling is applied to the centroid of each molecule while keeping the molecules rigid, or to each atom independently.

getForceGroup(self)int

Get the force group this Force belongs to.

getName(self)std::string const &

Get the name of this Force. This is an arbitrary, user modifiable identifier. By default it equals the class name, but you can change it to anything useful.

setForceGroup(self, group)

Set the force group this Force belongs to.

Parameters

group (int) – the group index. Legal values are between 0 and 31 (inclusive).

setName(self, name)

Set the name of this Force. This is an arbitrary, user modifiable identifier. By default it equals the class name, but you can change it to anything useful.