BoxEventListener
IntegratorDroplet
, IntegratorGear4
, IntegratorHard
, IntegratorHarmonic
, IntegratorPolymer
, IntegratorRigidIterative
, IntegratorRigidMatrixIterative
, IntegratorVelocityVerlet
, IntegratorVelocityVerletQuaternion
, IntegratorVelocityVerletShake
, IntegratorVerlet
public abstract class IntegratorMD extends IntegratorBox implements BoxEventListener
Modifier and Type | Class | Description |
---|---|---|
static class |
IntegratorMD.ThermostatType |
|
static class |
IntegratorMD.VectorSource |
An AgentSource that permits another vector to be associated with each atom.
|
Integrator.Forcible, Integrator.Torquable
Modifier and Type | Field | Description |
---|---|---|
protected boolean |
alwaysScaleMomenta |
|
protected AtomActionRandomizeVelocity |
atomActionRandomizeVelocity |
|
protected double |
currentKineticEnergy |
|
protected double |
currentTime |
|
protected IntegratorMC |
integratorMC |
|
protected int |
mcSteps |
|
protected DataSourceScalar |
meterKE |
|
protected MeterTemperature |
meterTemperature |
|
protected Vector |
momentum |
|
protected long |
nAccepted |
|
protected long |
nRejected |
|
protected double |
oldEnergy |
|
protected AtomLeafAgentManager<Vector> |
oldPositionAgentManager |
|
protected double |
oldPotentialEnergy |
|
protected IRandom |
random |
|
protected Vector |
temperatureVec |
|
protected IntegratorMD.ThermostatType |
thermostat |
|
protected int |
thermostatCount |
|
protected int |
thermostatInterval |
|
protected boolean |
thermostatNoDrift |
|
protected boolean |
thermostatting |
|
protected double |
timeStep |
eventManager, initialized, interval, stepCount
box, currentPotentialEnergy, isothermal, meterPE, potentialMaster, space, temperature
Constructor | Description |
---|---|
IntegratorMD(PotentialMaster potentialMaster,
IRandom random,
double timeStep,
double temperature,
Box box) |
Constructs integrator with a default for non-isothermal sampling.
|
Modifier and Type | Method | Description |
---|---|---|
void |
boxAtomLeafIndexChanged(BoxAtomIndexEvent e) |
Called when an atom's global (leaf) index has changed.
|
void |
boxGlobalAtomLeafIndexChanged(BoxIndexEvent e) |
Called when the maximum leaf index in the box has changed.
|
void |
boxMoleculeAdded(BoxMoleculeEvent e) |
Called when a molecule is added to the box.
|
void |
boxMoleculeIndexChanged(BoxMoleculeIndexEvent e) |
Called when an molecule's index has changed.
|
void |
boxMoleculeRemoved(BoxMoleculeEvent e) |
Called when a molecule is removed from the box.
|
void |
boxNumberMolecules(BoxMoleculeCountEvent e) |
Called when the number of molecules of a particular species has changed
in the box.
|
protected void |
doStepInternal() |
Performs the elementary integration step, such as a molecular dynamics
time step, or a Monte Carlo trial.
|
void |
doThermostat() |
Invokes thermostat, modifying velocities according to specified temperature and
algorithm of thermostat specified via setThermostat.
|
protected void |
doThermostatInternal() |
Fires the thermostat if the appropriate interval has been reached.
|
boolean |
getAlwaysScaleRandomizedMomenta() |
Returns true if the thermostat is set to always scale randomized momenta
to match the set temperature
|
double |
getCurrentTime() |
|
double |
getHybridAcceptance() |
|
IntegratorMC |
getIntegratorMC() |
|
double |
getKineticEnergy() |
|
DataSourceScalar |
getMeterTemperature() |
|
IntegratorMD.ThermostatType |
getThermostat() |
|
int |
getThermostatInterval() |
|
double |
getTimeStep() |
|
boolean |
isThermostatNoDrift() |
|
protected void |
randomizeMomenta() |
Randomizes the velocities of all atoms in the box using values
chosen from a Maxwell-Boltzmann distribution, as in the Andersen
thermostat.
|
protected void |
randomizeMomentum(IAtomKinetic atom) |
Randomizes the velocities of the given atom using value
chosen from a Maxwell-Boltzmann distribution, as in the Andersen
thermostat.
|
protected void |
randomizeTotalKE() |
Scales all velocities so that the total kinetic energy matches a value selected at random for the
previously specified temperature.
|
void |
reset() |
Performs superclass reset actions and recalculated currentPotentialEnergy
|
void |
resetHybridAcceptance() |
Zeros counters used to track acceptance fraction of HYBRID_MC thermostat.
|
void |
resetStepCount() |
This method resets the step counter.
|
protected void |
scaleMomenta() |
Crude method to enforce constant-temperature constraint, by
scaling momenta of all atoms by a constant factor so that
box adheres to setpoint temperature.
|
protected void |
scaleMomenta(Vector t) |
|
void |
setAlwaysScaleRandomizedMomenta(boolean alwaysScale) |
Configure thermostat to always scale randomized momenta to match the set
temperature
|
void |
setIntegratorMC(IntegratorMC integratorMC,
int mcSteps) |
A Monte Carlo integrator is employed with this MD integrator when performing hybrid MD/MC
sampling.
|
void |
setIsothermal(boolean b) |
|
void |
setMeterTemperature(MeterTemperature meter) |
Sets the temperature meter used to calculate temperature for
velocity rescaling.
|
void |
setTemperature(double t) |
|
void |
setThermostat(IntegratorMD.ThermostatType aThermostat) |
Sets the type of thermostat used by the integrator for isothermal sampling.
|
void |
setThermostatInterval(int interval) |
Sets the number of integrator steps between thermostat
actions (for thermostats such as velocity scaling and Andersen).
|
void |
setThermostatNoDrift(boolean newNoDrift) |
Configures the thermostat to remove any net momenta imparted
to the system after use of the thermostat.
|
void |
setTimeStep(double t) |
|
protected void |
setup() |
Perform initialization.
|
protected void |
shiftMomenta() |
Subtracts velocity from all atoms such that the new net momentum of
the whole system is zero.
|
doStep, getEventInterval, getEventManager, getStepCount, isInitialized, setEventInterval
getBox, getMeterPotentialEnergy, getPotentialEnergy, getPotentialMaster, getTemperature, getTemperatureDimension, isIsothermal, setBox, setMeterPotentialEnergy
protected final IRandom random
protected final Vector momentum
protected final Vector temperatureVec
protected double timeStep
protected double currentKineticEnergy
protected IntegratorMD.ThermostatType thermostat
protected int thermostatCount
protected int thermostatInterval
protected DataSourceScalar meterKE
protected AtomActionRandomizeVelocity atomActionRandomizeVelocity
protected MeterTemperature meterTemperature
protected double currentTime
protected boolean thermostatting
protected boolean thermostatNoDrift
protected boolean alwaysScaleMomenta
protected double oldEnergy
protected double oldPotentialEnergy
protected long nRejected
protected long nAccepted
protected AtomLeafAgentManager<Vector> oldPositionAgentManager
protected IntegratorMC integratorMC
protected int mcSteps
public IntegratorMD(PotentialMaster potentialMaster, IRandom random, double timeStep, double temperature, Box box)
potentialMaster
- PotentialMaster instance used to compute the energy and forcesrandom
- random number generator used for initial velocities and some thermostatstimeStep
- time step for integrationtemperature
- used by thermostat and/or to initialize velocitiespublic final double getTimeStep()
public void setTimeStep(double t)
t
- the new integration time stepprotected void setup()
Integrator
setup
in class Integrator
public void resetStepCount()
Integrator
resetStepCount
in class Integrator
public void reset()
IntegratorBox
reset
in class IntegratorBox
protected void doStepInternal()
Integrator
doStepInternal
in class Integrator
public double getCurrentTime()
public double getKineticEnergy()
public void setIsothermal(boolean b)
setIsothermal
in class IntegratorBox
b
- specifies whether the Integrator should (if true) sample according to a specified temperaturepublic void setTemperature(double t)
setTemperature
in class IntegratorBox
t
- the new temperaturepublic void setIntegratorMC(IntegratorMC integratorMC, int mcSteps)
integratorMC
- the Monte Carlo integrator to be used for hybrid MC/MDmcSteps
- number of Monte Carlo trial steps to perform after MD segmentjava.lang.RuntimeException
- if HYBRID_MC thermostat is not enabled or if isothermal is falsepublic IntegratorMC getIntegratorMC()
public void setThermostatNoDrift(boolean newNoDrift)
newNoDrift
- if true, will remove net momentum after thermostat usepublic boolean isThermostatNoDrift()
public void setAlwaysScaleRandomizedMomenta(boolean alwaysScale)
public boolean getAlwaysScaleRandomizedMomenta()
public IntegratorMD.ThermostatType getThermostat()
public void setThermostat(IntegratorMD.ThermostatType aThermostat)
aThermostat
- the desired thermostatpublic int getThermostatInterval()
public void setThermostatInterval(int interval)
interval
- number of integrator steps between thermostat
activityprotected void doThermostatInternal()
public void doThermostat()
public double getHybridAcceptance()
public void resetHybridAcceptance()
protected void randomizeTotalKE()
protected void randomizeMomenta()
protected void randomizeMomentum(IAtomKinetic atom)
atom
- whose momenta is be randomizedprotected void shiftMomenta()
protected void scaleMomenta()
protected void scaleMomenta(Vector t)
public DataSourceScalar getMeterTemperature()
public void setMeterTemperature(MeterTemperature meter)
public void boxMoleculeAdded(BoxMoleculeEvent e)
BoxEventListener
boxMoleculeAdded
in interface BoxEventListener
e
- the event, which contains the added molecule and the box to
which it was added.public void boxMoleculeRemoved(BoxMoleculeEvent e)
BoxEventListener
boxMoleculeRemoved
in interface BoxEventListener
e
- the event, which contains the removed molecule and the box from
which it was removed.public void boxGlobalAtomLeafIndexChanged(BoxIndexEvent e)
BoxEventListener
boxGlobalAtomLeafIndexChanged
in interface BoxEventListener
e
- the event, which contains the box and the new maximum global
indexpublic void boxAtomLeafIndexChanged(BoxAtomIndexEvent e)
BoxEventListener
boxAtomLeafIndexChanged
in interface BoxEventListener
e
- the event, which contains the box, the atom whose index changed
and the atom's old leaf index. The atom's new leaf index can
be obtained from the atom.public void boxMoleculeIndexChanged(BoxMoleculeIndexEvent e)
BoxEventListener
boxMoleculeIndexChanged
in interface BoxEventListener
e
- the event, which contains the box, the molecule whose index
changed and the molecule's old index. The molecule's new index
can be obtained from the atom.public void boxNumberMolecules(BoxMoleculeCountEvent e)
BoxEventListener
boxNumberMolecules
in interface BoxEventListener
e
- the event, which contains the box, the species and the new
number of molecules of that species.