8 #include "BondLengthDist.h" 9 #include <mcMd/simulation/Simulation.h> 10 #include <mcMd/chemistry/Molecule.h> 11 #include <mcMd/chemistry/Atom.h> 12 #include <simp/species/Species.h> 13 #include <simp/boundary/Boundary.h> 14 #include <util/math/feq.h> 15 #include <util/misc/FileMaster.h> 16 #include <util/archives/Serializable_includes.h> 40 read<int>(in,
"speciesId", speciesId_);
41 read<double>(in,
"min", min_);
42 read<double>(in,
"max", max_);
43 read<double>(in,
"nBin", nBin_);
48 accumulator_.
setParam(min_, max_, nBin_);
50 isInitialized_ =
true;
60 loadParameter<int>(ar,
"speciesId", speciesId_);
61 loadParameter<double>(ar,
"min", min_);
62 loadParameter<double>(ar,
"max", max_);
63 loadParameter<double>(ar,
"nBin", nBin_);
71 if (!
feq(accumulator_.min(),min_)) {
74 if (!
feq(accumulator_.max(), max_)) {
77 if (accumulator_.nBin() != nBin_) {
81 isInitialized_ =
true;
95 if (!isInitialized_) {
110 for (
system().begin(speciesId_, molIter); molIter.
notEnd(); ++molIter) {
111 for (molIter->begin(bondIter); bondIter.
notEnd(); ++bondIter) {
113 bondIter->atom(1).position());
133 accumulator_.
output(outputFile_);
virtual void save(Serializable::OArchive &ar)
Save state to archive.
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?
void openOutputFile(const std::string &filename, std::ofstream &out, std::ios_base::openmode mode=std::ios_base::out) const
Open an output file.
BondLengthDist(System &system)
Constructor.
virtual void loadParameters(Serializable::IArchive &ar)
Load state from an archive.
A set of interacting Molecules enclosed by a Boundary.
System & system()
Return reference to parent system.
virtual void output()
Output results to output file.
File containing preprocessor macros for error handling.
Classes used by all simpatico molecular simulations.
void readOutputFileName(std::istream &in)
Read outputFileName from file.
virtual void readParameters(std::istream &in)
Read parameters from file.
Saving / output archive for binary ostream.
#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.
void readInterval(std::istream &in)
Read interval from file, with error checking.
bool notEnd() const
Is the current pointer not at the end of the PArray?
Utility classes for scientific computation.
void sample(double value)
Sample a value.
Forward iterator for an Array or a C array.
Forward iterator for a PArray.
Template for Analyzer associated with one System.
void output(std::ostream &out)
Output the distribution to file.
virtual void clear()
Clear (i.e., zero) previously allocated histogram.
Boundary & boundary() const
Get the Boundary by reference.
Saving archive for binary istream.
virtual void setup()
Clear accumulator.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
void setClassName(const char *className)
Set class name string.
FileMaster & fileMaster()
Get the FileMaster by reference.
void loadInterval(Serializable::IArchive &ar)
Load interval from archive, with error checking.
bool isAtInterval(long counter) const
Return true iff counter is a multiple of the interval.
const std::string & outputFileName() const
Return outputFileName string.
void loadOutputFileName(Serializable::IArchive &ar)
Load output file name from archive.
void setParam(double min, double max, int nBin)
Set parameters and initialize.
bool feq(double x, double y, double eps=1.0E-10)
Are two floating point numbers equal to within round-off error?
void sample(long iStep)
Add particle pairs to BondLengthDist histogram.