Package ffx.openmm

Class MonteCarloBarostat

java.lang.Object
ffx.openmm.Force
ffx.openmm.MonteCarloBarostat

public class MonteCarloBarostat extends 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.

  • Constructor Details

    • MonteCarloBarostat

      public MonteCarloBarostat(double pressure, double temperature, int frequency)
      Create a MonteCarloBarostat.
      Parameters:
      pressure - the default pressure acting on the system (in bar)
      temperature - 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)
  • Method Details

    • computeCurrentPressure

      public double computeCurrentPressure(Context context)
      Compute the instantaneous pressure of a system to which this barostat is applied.

      The pressure is computed from the molecular virial, using a finite difference to calculate the derivative of potential energy with respect to volume. For most systems in equilibrium, the time average of the instantaneous pressure should equal the pressure applied by the barostat. Fluctuations around the average value can be extremely large, however, and it may take a very long simulation to accurately compute the average.

      Parameters:
      context - the Context for which to compute the current pressure
      Returns:
      the instantaneous pressure
    • destroy

      public void destroy()
      Destroy the force.
      Specified by:
      destroy in class Force
    • getDefaultPressure

      public double getDefaultPressure()
      Get the default pressure acting on the system (in bar).
      Returns:
      the default pressure acting on the system, measured in bar.
    • getDefaultTemperature

      public double getDefaultTemperature()
      Get the default temperature at which the system is being maintained, measured in Kelvin.
      Returns:
      the default temperature at which the system is being maintained, measured in Kelvin.
    • getFrequency

      public int getFrequency()
      Get the frequency.
      Returns:
      The frequency.
    • getRandomNumberSeed

      public int getRandomNumberSeed()
      Get the random number seed.
      Returns:
      The random number seed.
    • setDefaultPressure

      public 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.
    • setDefaultTemperature

      public void setDefaultTemperature(double temperature)
      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:
      temperature - the system temperature, measured in Kelvin.
    • setFrequency

      public void setFrequency(int frequency)
      Set the frequency.
      Parameters:
      frequency - The frequency.
    • setRandomNumberSeed

      public void setRandomNumberSeed(int seed)
      Set the random number seed.
      Parameters:
      seed - The random number seed.
    • usesPeriodicBoundaryConditions

      public boolean usesPeriodicBoundaryConditions()
      Does the force use periodic boundary conditions?
      Overrides:
      usesPeriodicBoundaryConditions in class Force
      Returns:
      True if the force uses periodic boundary conditions.