8 #include "NveVvIntegrator.h" 9 #include <mcMd/mdSimulation/MdSystem.h> 10 #include <mcMd/simulation/Simulation.h> 11 #include <mcMd/potentials/pair/MdPairPotential.h> 12 #include <mcMd/chemistry/Molecule.h> 13 #include <mcMd/chemistry/Atom.h> 14 #include <simp/boundary/Boundary.h> 15 #include <util/space/Vector.h> 16 #include <util/archives/Serializable_includes.h> 43 read<double>(in,
"dt",
dt_);
53 loadParameter<double>(ar,
"dt",
dt_);
74 int nAtomType = prefactors_.
capacity();
75 for (
int i = 0; i < nAtomType; ++i) {
77 prefactors_[i] = 0.5*
dt_/mass;
103 int iSpecies, nSpecies;
110 for (iSpecies=0; iSpecies < nSpecies; ++iSpecies) {
112 for ( ; molIter.
notEnd(); ++molIter) {
113 for (molIter->begin(atomIter); atomIter.
notEnd(); ++atomIter) {
115 prefactor = prefactors_[atomIter->typeId()];
117 dv.
multiply(atomIter->force(), prefactor);
118 atomIter->velocity() += dv;
121 atomIter->position() += dr;
129 for (iSpecies=0; iSpecies < nSpecies; ++iSpecies) {
131 for ( ; molIter.
notEnd(); ++molIter) {
132 for (ia=0; ia < molIter->nAtom(); ++ia) {
133 atomPtr = &molIter->atom(ia);
134 prefactor = prefactors_[atomPtr->
typeId()];
150 if (!
system().pairPotential().isPairListCurrent()) {
159 for (iSpecies=0; iSpecies < nSpecies; ++iSpecies) {
161 for ( ; molIter.
notEnd(); ++molIter) {
162 for (molIter->begin(atomIter); atomIter.
notEnd(); ++atomIter) {
163 prefactor = prefactors_[atomIter->typeId()];
164 dv.
multiply(atomIter->force(), prefactor);
165 atomIter->velocity() += dv;
170 for (iSpecies=0; iSpecies < nSpecies; ++iSpecies) {
172 for ( ; molIter.
notEnd(); ++molIter)
174 for (ia=0; ia < molIter->nAtom(); ++ia) {
175 atomPtr = &molIter->atom(ia);
176 prefactor = prefactors_[atomPtr->
typeId()];
A Vector is a Cartesian vector.
void calculateForces()
Compute all forces in this System.
void begin(int speciesId, MoleculeIterator &iterator)
Initialize an iterator for molecules of one species in this System.
Vector & velocity()
Get atomic velocity Vector by reference.
bool notEnd() const
Is the current pointer not at the end of the array?
Signal & positionSignal()
Signal to indicate change in atomic positions.
Vector & force()
Get atomic force Vector by reference.
Vector & multiply(const Vector &v, double s)
Multiply a vector v by a scalar s.
Classes used by all simpatico molecular simulations.
Simulation & simulation()
Get parent Simulation by reference.
Abstract base for molecular dynamics integrators.
Saving / output archive for binary ostream.
MdPairPotential & pairPotential() const
Return MdPairPotential by reference.
const AtomType & atomType(int i) const
Get a single AtomType object by const reference.
int typeId() const
Get type index for this Atom.
MdSystem & system()
Get parent MdSystem by reference.
NveVvIntegrator(MdSystem &system)
Constructor.
void notify(const T &t)
Notify all observers.
A point particle within a Molecule.
virtual void save(Serializable::OArchive &ar)
Save the internal state to an archive.
bool notEnd() const
Is the current pointer not at the end of the PArray?
Utility classes for scientific computation.
virtual void step()
Take a complete NVE MD integration step.
Forward iterator for an Array or a C array.
Forward iterator for a PArray.
virtual void readParameters(std::istream &in)
Read parameters from file and initialize this MdSystem.
double dt_
Integrator time step.
Signal & velocitySignal()
Signal to indicate change in atomic velocities.
virtual ~NveVvIntegrator()
Destructor.
virtual void setup()
Setup private variables before main loop.
Saving archive for binary istream.
double mass() const
Get the mass.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
int nSpecies() const
Get the number of Species in this Simulation.
void buildPairList()
Build the internal PairList.
void setClassName(const char *className)
Set class name string.
A System for Molecular Dynamics simulation.
int capacity() const
Return allocated size.
void allocate(int capacity)
Allocate the underlying C array.
const Vector & position() const
Get the position Vector by const reference.
int nAtomType() const
Get the number of atom types.
virtual void loadParameters(Serializable::IArchive &ar)
Load the internal state to an archive.