8 #include "NvtLangevinIntegrator.h" 9 #include <ddMd/simulation/Simulation.h> 10 #include <ddMd/storage/AtomStorage.h> 11 #include <ddMd/storage/AtomIterator.h> 12 #include <ddMd/communicate/Exchanger.h> 13 #include <ddMd/potentials/pair/PairPotential.h> 14 #include <simp/ensembles/EnergyEnsemble.h> 15 #include <util/space/Vector.h> 49 read<double>(in,
"dt", dt_);
50 read<double>(in,
"gamma", gamma_);
66 loadParameter<double>(ar,
"dt", dt_);
96 UTIL_THROW(
"Energy ensemble is not isothermal");
109 double cv = (exp(-dt_*gamma_) - 1.0)/dt_;
111 double d = 2.0/(1.0 + exp(-dt_*gamma_));
112 double cr = 12.0*temp*d*(1.0 - exp(-2.0*dt_*gamma_))/(dt_*dt_);
115 double dtHalf = 0.5*dt_;
120 prefactors_[i] = dtHalf/mass;
122 cr_[i] = sqrt(mass*cr);
139 for ( ; atomIter.
notEnd(); ++atomIter) {
140 prefactor = prefactors_[atomIter->typeId()];
142 dv.
multiply(atomIter->force(), prefactor);
143 atomIter->velocity() += dv;
145 dr.
multiply(atomIter->velocity(), dt_);
146 atomIter->position() += dr;
164 for ( ; atomIter.
notEnd(); ++atomIter) {
165 typeId = atomIter->typeId();
168 df.
multiply(atomIter->velocity(), cv_[typeId]);
171 df[j] += (random.
uniform() - 0.5)*cr;
173 atomIter->force() += df;
176 dv.
multiply(atomIter->force(), prefactors_[typeId]);
177 atomIter->velocity() += dv;
void loadParameters(Serializable::IArchive &ar)
Load saveInterval and saveFileName from restart archive.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
Signal & velocitySignal()
Signal to indicate change in atomic velocities.
const int Dimension
Dimensionality of space.
A Vector is a Cartesian vector.
virtual void integrateStep2()
Execute second step of two-step integrator.
Vector & multiply(const Vector &v, double s)
Multiply a vector v by a scalar s.
void readParameters(std::istream &in)
Read saveInterval and saveFileName.
NvtLangevinIntegrator(Simulation &simulation)
Constructor.
void setIsSetup()
Mark the integrator as having been setup at least once.
double mass() const
Get the mass.
EnergyEnsemble & energyEnsemble()
Get the EnergyEnsemble.
File containing preprocessor macros for error handling.
Parallel domain decomposition (DD) MD simulation.
Classes used by all simpatico molecular simulations.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
Main object for a domain-decomposition MD simulation.
double uniform()
Return a random floating point number x, uniformly distributed in the range 0 <= x < 1...
void readParameters(std::istream &in)
Read required parameters.
AtomType & atomType(int i)
Get an AtomType descriptor by reference.
Saving / output archive for binary ostream.
void setup()
Setup state just before main loop.
A statistical ensemble for energy.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
void setupAtoms()
Setup state of atoms just before integration.
virtual void integrateStep1()
Execute first step of two-step integrator.
bool isIsothermal() const
Is this an Isothermal ensemble?
void notify(const T &t)
Notify all observers.
Random & random()
Get the Random number generator.
bool notEnd() const
Is the current pointer not at the end of the PArray?
Utility classes for scientific computation.
bool isAllocated() const
Return true if the DArray has been allocated, false otherwise.
bool isSetup() const
Has the setup() method been called at least once previously?
AtomStorage & atomStorage()
Get the AtomStorage.
void save(Serializable::OArchive &ar)
Save saveInterval and saveFileName from restart archive.
Simulation & simulation()
Get the parent simulation.
~NvtLangevinIntegrator()
Destructor.
int nAtomType()
Get maximum number of atom types.
Saving archive for binary istream.
A two-step velocity-Verlet style integrator.
void setClassName(const char *className)
Set class name string.
int nAtomType()
Get maximum number of atom types.
Random & random()
Get the Random number generator by reference.
int capacity() const
Return allocated size.
void allocate(int capacity)
Allocate the underlying C array.
double temperature() const
Return the temperature.
Iterator for all atoms owned by an AtomStorage.
virtual void clear()
Set integrator to initial state and clears all statistics.
void begin(AtomIterator &iterator)
Set iterator to beginning of the set of atoms.
EnergyEnsemble & energyEnsemble()
Get the EnergyEnsemble by reference.