9 #include <tools/chemistry/Molecule.h> 10 #include <tools/chemistry/Atom.h> 11 #include <tools/chemistry/Species.h> 12 #include <tools/storage/Configuration.h> 13 #include <simp/boundary/Boundary.h> 14 #include <util/space/Dimension.h> 15 #include <util/archives/Serializable_includes.h> 46 :
Analyzer(configuration, fileMaster),
68 read<int>(in,
"speciesId", speciesId_);
69 read<int>(in,
"atomId", atomId_);
70 read<int>(in,
"capacity", capacity_);
83 if (atomId_ >= species.
nAtom()) {
91 int speciesCapacity = species.
capacity();
94 truePositions_.allocate(speciesCapacity);
95 oldPositions_.allocate(speciesCapacity);
96 shifts_.allocate(speciesCapacity);
99 accumulator_.setParam(speciesCapacity, capacity_);
101 isInitialized_ =
true;
109 if (!isInitialized_) {
110 UTIL_THROW(
"Error: object is not initialized");
116 nMolecule_ = species.size();
117 accumulator_.setNEnsemble(nMolecule_);
118 accumulator_.clear();
127 for ( ; iter.
notEnd(); ++iter) {
128 r = iter->atom(atomId_).position;
130 oldPositions_[i] = r;
146 if (nMolecule_ <= 0) {
149 if (nMolecule_ != species.size()) {
150 UTIL_THROW(
"Number of molecules has changed.");
160 for (species.begin(iter); iter.
notEnd(); ++iter) {
162 r = iter->atom(atomId_).position;
166 boundary.
distanceSq(r, oldPositions_[i], shift);
173 truePositions_[i][j] = r[j] + shifts_[i][j]*lengths[j];
177 oldPositions_[i] = r;
181 accumulator_.sample(truePositions_);
195 outputFile_ << std::endl;
196 outputFile_ << std::endl;
197 outputFile_ <<
"nMolecule " << accumulator_.nEnsemble()
199 outputFile_ <<
"buffercapacity " << accumulator_.bufferCapacity()
201 outputFile_ <<
"nSample " << accumulator_.nSample()
203 outputFile_ << std::endl;
211 accumulator_.output(outputFile_);
const int Dimension
Dimensionality of space.
A Vector is a Cartesian vector.
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.
bool notEnd() const
Is the current pointer not at the end of the array?
const Vector & lengths() const
Get Vector of unit cell lengths by const reference.
An orthorhombic periodic unit cell.
void openOutputFile(const std::string &filename, std::ofstream &out, std::ios_base::openmode mode=std::ios_base::out) const
Open an output file.
File containing preprocessor macros for error handling.
Classes used by all simpatico molecular simulations.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
virtual void writeParam(std::ostream &out)
Write all parameters to an output stream.
Utility classes for scientific computation.
void shift(Vector &r) const
Shift Cartesian Vector r to its primary image.
Forward iterator for an Array or a C array.
A FileMaster manages input and output files for a simulation.
void setClassName(const char *className)
Set class name string.
An IntVector is an integer Cartesian vector.
int capacity() const
Maximum allowed number of molecules for this Species.
A Species represents a set of chemically similar molecules.