12 #include <mcMd/simulation/Simulation.h> 13 #include <mcMd/chemistry/Molecule.h> 14 #include <mcMd/chemistry/Atom.h> 15 #include <simp/species/Species.h> 16 #include <simp/boundary/Boundary.h> 17 #include <util/space/Dimension.h> 51 read<int>(in,
"speciesId", speciesId_);
52 read<int>(in,
"capacity", capacity_);
55 if (speciesId_ < 0)
UTIL_THROW(
"Negative speciesId");
56 if (speciesId_ >=
system().simulation().nSpecies())
58 if (capacity_ <= 0)
UTIL_THROW(
"Negative capacity");
61 nAtom_ = speciesPtr_->
nAtom();
74 nratoms = nMolecule_*nAtom_;
76 truePositions_.allocate(nratoms);
77 oldPositions_.allocate(nratoms);
78 shifts_.allocate(nratoms);
81 accumulator_.setParam(nratoms, capacity_);
88 for (
int i = 0; i < nMolecule_; ++i) {
90 for (
int j = 0 ; j < nAtom_; j++) {
93 oldPositions_[iatom] = r;
94 shifts_[iatom] = zero;
109 if (nMolecule_ <= 0) {
112 if (nMolecule_ !=
system().nMolecule(speciesId_)) {
113 UTIL_THROW(
"Number of molecules has changed.");
122 for (i = 0; i < nMolecule_; ++i) {
124 for (j = 0 ; j < nAtom_; j++) {
132 shifts_[iatom] += shift;
136 truePositions_[iatom][k] = r[k] + shifts_[iatom][k]*lengths[k];
140 oldPositions_[iatom] = r;
145 accumulator_.sample(truePositions_);
156 outputFile_ << std::endl;
157 outputFile_ <<
"nrAtoms " << accumulator_.nEnsemble() << std::endl;
158 outputFile_ <<
"buffercapacity " << accumulator_.bufferCapacity() << std::endl;
159 outputFile_ <<
"nSample " << accumulator_.nSample() << std::endl;
160 outputFile_ << std::endl;
161 outputFile_ <<
"Format of *.dat file:" << std::endl;
162 outputFile_ <<
"[time in samples] [Mean Sq Displacement]" 168 accumulator_.output(outputFile_);
const int Dimension
Dimensionality of space.
A Vector is a Cartesian vector.
virtual void sample(long iStep)
Evaluate end-to-end vectors of all chains, add to ensemble.
int nAtom() const
Get number of atoms per molecule for this Species.
double distanceSq(const Vector &r1, const Vector &r2) const
Return square distance between positions r1 and r2.
const Vector & lengths() const
Get Vector of unit cell lengths by const reference.
virtual void readParameters(std::istream &in)
Read parameters from file.
void openOutputFile(const std::string &filename, std::ofstream &out, std::ios_base::openmode mode=std::ios_base::out) const
Open an output file.
A set of interacting Molecules enclosed by a Boundary.
System & system()
Return reference to parent system.
Classes used by all simpatico molecular simulations.
void readOutputFileName(std::istream &in)
Read outputFileName from file.
G1MSD(System &system)
Constructor.
Molecule & molecule(int speciesId, int moleculeId)
Get a specific Molecule in this System, by integer index.
int nMolecule(int speciesId) const
Get the number of molecules of one Species in this System.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Simulation & simulation() const
Get the parent Simulation by reference.
virtual void output()
Output results to file after simulation is completed.
virtual void writeParam(std::ostream &out)
Write all parameters to an output stream.
void readInterval(std::istream &in)
Read interval from file, with error checking.
Utility classes for scientific computation.
void shift(Vector &r) const
Shift Cartesian Vector r to its primary image.
Template for Analyzer associated with one System.
Boundary & boundary() const
Get the Boundary by reference.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
virtual void setup()
Determine number of molecules and allocate memory.
void setClassName(const char *className)
Set class name string.
An IntVector is an integer Cartesian vector.
const Atom & atom(int localId) const
Get a specific Atom in this Molecule.
FileMaster & fileMaster()
Get the FileMaster by reference.
bool isAtInterval(long counter) const
Return true iff counter is a multiple of the interval.
const std::string & outputFileName() const
Return outputFileName string.
A physical molecule (a set of covalently bonded Atoms).
const Vector & position() const
Get the position Vector by const reference.
Species & species(int i)
Get a specific Species by reference.