Class Thermostat
java.lang.Object
ffx.algorithms.dynamics.thermostats.Thermostat
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
FieldsModifier and TypeFieldDescriptionprotected List<Constraint> Any geometric constraints to apply during integration.protected intNumber of degrees of freedom, which can be less than the number of variables.protected doubleThe value of kT in kcal/mol at the target temperature.protected ThermostatEnumThe identity of this Thermostat.protected RandomThe random number generator that the Thermostat will use to initialize velocities.protected final SystemStateThe molecular dynamics state to be used.protected Potential.VARIABLE_TYPE[]The type of each variable. -
Constructor Summary
ConstructorsConstructorDescriptionThermostat(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 TypeMethodDescriptionvoidcenterOfMassMotion(boolean remove, boolean print) Compute the center of mass, linear momentum and angular momentum.final voidCompute the current temperature and kinetic energy of the system.abstract voidfullStep(double dt) The full-step temperature correction.doubleGet the current temperature.intReturn the number of degrees of freedom.doubleGet the current kinetic energy.booleanGetter for the fieldremoveCenterOfMassMotion.doubleGet the target temperature.abstract voidhalfStep(double dt) The half-step temperature correction.protected voidLog the target temperature and current number of kT per degree of freedom (should be 0.5 kT at equilibrium).logTemp()voidmaxwell()Reset velocities from a Maxwell-Boltzmann distribution based on the current target temperature of thermostat.voidmaxwell(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.static ThermostatEnumparseThermostat(String str) Parse a string into a Thermostat enumeration.voidsetQuiet(boolean quiet) Setter for the fieldquiet.voidsetRandomSeed(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. samevoidsetRemoveCenterOfMassMotion(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.voidsetTargetTemperature(double t) Set the target temperature.toString()
-
Field Details
-
name
The identity of this Thermostat. -
kT
protected double kTThe value of kT in kcal/mol at the target temperature. -
degreesOfFreedom
protected int degreesOfFreedomNumber of degrees of freedom, which can be less than the number of variables. For example, removing translational motion removes 3 degrees of freedom. -
state
The molecular dynamics state to be used. -
type
The type of each variable. -
random
The random number generator that the Thermostat will use to initialize velocities. -
constraints
Any geometric constraints to apply during integration.
-
-
Constructor Details
-
Thermostat
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
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 fieldremoveCenterOfMassMotion.- 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-trueif 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 fieldquiet.- 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
-
logTemp
-
log
Log the target temperature and current number of kT per degree of freedom (should be 0.5 kT at equilibrium).- Parameters:
level- aLevelobject.
-