Class Thermostat

java.lang.Object
ffx.algorithms.dynamics.thermostats.Thermostat
Direct Known Subclasses:
Adiabatic, Berendsen, Bussi

public abstract class Thermostat extends Object
The abstract Thermostat class implements methods common to all thermostats for initializing velocities from a Maxwell-Boltzmann distribution and computing the instantaneous temperature. Abstract methods are declared for half-step and full-step modification of velocities for thermostat implementations.
Since:
1.0
Author:
Michael J. Schnieders
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected List<Constraint>
    Any geometric constraints to apply during integration.
    protected int
    Number of degrees of freedom, which can be less than the number of variables.
    protected double
    The value of kT in kcal/mol at the target temperature.
    protected ThermostatEnum
    The identity of this Thermostat.
    protected Random
    The random number generator that the Thermostat will use to initialize velocities.
    protected final SystemState
    The molecular dynamics state to be used.
    The type of each variable.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Thermostat(SystemState state, Potential.VARIABLE_TYPE[] type, double targetTemperature)
    Constructor for Thermostat.
    Thermostat(SystemState state, Potential.VARIABLE_TYPE[] type, double targetTemperature, List<Constraint> constraints)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    centerOfMassMotion(boolean remove, boolean print)
    Compute the center of mass, linear momentum and angular momentum.
    final void
    Compute the current temperature and kinetic energy of the system.
    abstract void
    fullStep(double dt)
    The full-step temperature correction.
    double
    Get the current temperature.
    int
    Return the number of degrees of freedom.
    double
    Get the current kinetic energy.
    boolean
    Getter for the field removeCenterOfMassMotion.
    double
    Get the target temperature.
    abstract void
    halfStep(double dt)
    The half-step temperature correction.
    protected void
    log(Level level)
    Log the target temperature and current number of kT per degree of freedom (should be 0.5 kT at equilibrium).
     
    void
    Reset velocities from a Maxwell-Boltzmann distribution based on the current target temperature of thermostat.
    void
    maxwell(double targetTemperature)
    Reset velocities from a Maxwell-Boltzmann distribution of momenta based on the supplied target temperature.
    double[]
    maxwellIndividual(double mass)
    Return 3 velocities from a Maxwell-Boltzmann distribution of momenta.
    Parse a string into a Thermostat enumeration.
    void
    setQuiet(boolean quiet)
    Setter for the field quiet.
    void
    setRandomSeed(long seed)
    The setRandomSeed method is used to initialize the Random number generator to the same starting state, such that separate runs produce the same Maxwell-Boltzmann initial velocities.
    void
    If center of mass motion is being removed, then the mean kinetic energy of the system will be 3 kT/2 less than if center of mass motion is allowed.
    void
    Set the target temperature.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • name

      protected ThermostatEnum name
      The identity of this Thermostat.
    • kT

      protected double kT
      The value of kT in kcal/mol at the target temperature.
    • degreesOfFreedom

      protected int degreesOfFreedom
      Number of degrees of freedom, which can be less than the number of variables. For example, removing translational motion removes 3 degrees of freedom.
    • state

      protected final SystemState state
      The molecular dynamics state to be used.
    • type

      protected Potential.VARIABLE_TYPE[] type
      The type of each variable.
    • random

      protected Random random
      The random number generator that the Thermostat will use to initialize velocities.
    • constraints

      protected List<Constraint> constraints
      Any geometric constraints to apply during integration.
  • Constructor Details

    • Thermostat

      public Thermostat(SystemState state, Potential.VARIABLE_TYPE[] type, double targetTemperature)
      Constructor for Thermostat.
      Parameters:
      state - The molecular dynamics state to be used.
      type - the VARIABLE_TYPE of each variable.
      targetTemperature - a double.
    • Thermostat

      public Thermostat(SystemState state, Potential.VARIABLE_TYPE[] type, double targetTemperature, List<Constraint> constraints)
  • Method Details

    • parseThermostat

      public static ThermostatEnum parseThermostat(String str)
      Parse a string into a Thermostat enumeration.
      Parameters:
      str - Thermostat String.
      Returns:
      An instance of the ThermostatEnum.
    • centerOfMassMotion

      public void centerOfMassMotion(boolean remove, boolean print)
      Compute the center of mass, linear momentum and angular momentum.
      Parameters:
      remove - If true, the center of mass motion will be removed.
      print - If true, the center of mass and momenta will be printed.
    • computeKineticEnergy

      public final void computeKineticEnergy()
      Compute the current temperature and kinetic energy of the system.
    • halfStep

      public abstract void halfStep(double dt)
      The half-step temperature correction.
      Parameters:
      dt - a double.
    • fullStep

      public abstract void fullStep(double dt)
      The full-step temperature correction.
      Parameters:
      dt - a double.
    • getCurrentTemperature

      public double getCurrentTemperature()
      Get the current temperature.

      This depends on a previous call to the computeKineticEnergy.

      Returns:
      Current temperature.
    • getDegreesOfFreedom

      public int getDegreesOfFreedom()
      Return the number of degrees of freedom.
      Returns:
      Degrees of freedom.
    • getKineticEnergy

      public double getKineticEnergy()
      Get the current kinetic energy.

      This depends on a previous call to the computeKineticEnergy.

      Returns:
      Kinetic energy.
    • getRemoveCenterOfMassMotion

      public boolean getRemoveCenterOfMassMotion()
      Getter for the field removeCenterOfMassMotion.
      Returns:
      a boolean.
    • setRemoveCenterOfMassMotion

      public void setRemoveCenterOfMassMotion(boolean remove)
      If center of mass motion is being removed, then the mean kinetic energy of the system will be 3 kT/2 less than if center of mass motion is allowed.
      Parameters:
      remove - true if center of mass motion is being removed.
    • getTargetTemperature

      public double getTargetTemperature()
      Get the target temperature.
      Returns:
      Target temperature.
    • setTargetTemperature

      public void setTargetTemperature(double t)
      Set the target temperature.
      Parameters:
      t - Target temperature must be greater than absolute zero.
      Since:
      1.0
    • maxwell

      public void maxwell(double targetTemperature)
      Reset velocities from a Maxwell-Boltzmann distribution of momenta based on the supplied target temperature. The variance of each independent momentum component is kT * mass.
      Parameters:
      targetTemperature - the target Temperature for the Maxwell distribution.
    • maxwell

      public void maxwell()
      Reset velocities from a Maxwell-Boltzmann distribution based on the current target temperature of thermostat.
    • maxwellIndividual

      public double[] maxwellIndividual(double mass)
      Return 3 velocities from a Maxwell-Boltzmann distribution of momenta. The variance of each independent momentum component is kT * mass.
      Parameters:
      mass - The mass for the degrees of freedom.
      Returns:
      three velocity components.
    • setQuiet

      public void setQuiet(boolean quiet)
      Setter for the field quiet.
      Parameters:
      quiet - a boolean.
    • setRandomSeed

      public void setRandomSeed(long seed)
      The setRandomSeed method is used to initialize the Random number generator to the same starting state, such that separate runs produce the same Maxwell-Boltzmann initial velocities. same
      Parameters:
      seed - The seed.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • logTemp

      public String logTemp()
    • log

      protected void log(Level level)
      Log the target temperature and current number of kT per degree of freedom (should be 0.5 kT at equilibrium).
      Parameters:
      level - a Level object.