8 #include "CompositionProfile.h" 9 #include <mcMd/simulation/Simulation.h> 10 #include <mcMd/simulation/McMd_mpi.h> 11 #include <mcMd/chemistry/Molecule.h> 12 #include <mcMd/chemistry/Atom.h> 13 #include <simp/boundary/Boundary.h> 14 #include <util/space/Dimension.h> 15 #include <util/misc/FileMaster.h> 16 #include <util/misc/ioUtil.h> 17 #include <util/format/Dbl.h> 46 read<int>(in,
"nBins",
nBins_);
71 UTIL_THROW(
"Inconsistent values for nAtomType_");
74 UTIL_THROW(
"Inconsistent intVectors capacity");
77 UTIL_THROW(
"Inconsistent waveVectors capacity");
79 if (
nDirection_*nAtomType_ != accumulators_.capacity()) {
80 UTIL_THROW(
"Inconsistent waveVectors capacity");
143 int nSpecies, iSpecies, typeId;
153 std::ios_base::openmode mode = std::ios_base::out;
155 mode = std::ios_base::out | std::ios_base::app;
161 std::ostringstream oss;
167 oss <<
"_type" << j <<
".log";
177 for (iSpecies = 0; iSpecies < nSpecies; ++iSpecies) {
180 for ( ; molIter.
notEnd(); ++molIter) {
181 molIter->begin(atomIter);
183 for ( ; atomIter.
notEnd(); ++atomIter) {
184 position = atomIter->position();
185 typeId = atomIter->typeId();
187 position[i] /= blengths[i];
virtual void save(Serializable::OArchive &ar)
Load parameters to archive.
const int Dimension
Dimensionality of space.
A Vector is a Cartesian vector.
virtual void readParameters(std::istream &in)
Read parameters from file.
bool isInitialized_
Has readParam been called?
float product(float a, float b)
Product for float Data.
void begin(int speciesId, MoleculeIterator &iterator)
Initialize an iterator for molecules of one species in this System.
std::ofstream outputFile_
Output file stream.
bool isFirstStep_
True if this is the first step.
double dot(const Vector &v) const
Return dot product of this vector and vector v.
void makeWaveVectors()
Update wavevectors.
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.
static const Vector Zero
Zero Vector = {0.0, 0.0, 0.0}.
virtual void loadParameters(Serializable::IArchive &ar)
Load parameters from archive.
A set of interacting Molecules enclosed by a Boundary.
System & system()
Return reference to parent system.
Wrapper for a double precision number, for formatted ostream output.
Forward iterator for a PArray.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
Classes used by all simpatico molecular simulations.
void readOutputFileName(std::istream &in)
Read outputFileName from file.
void sample(long iStep)
Add particle positions to histogram.
Forward const iterator for an Array or a C array.
Saving / output archive for binary ostream.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
#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 writeParam(std::ostream &out)
Write all parameters to an output stream.
const Vector & reciprocalBasisVector(int i) const
Return reciprocal lattice basis vector i.
void readInterval(std::istream &in)
Read interval from file, with error checking.
Utility classes for scientific computation.
int nDirection_
Number of directions.
DArray< Distribution > currentAccumulators_
Distribution statistical accumulators.
Template for Analyzer associated with one System.
virtual void output()
Output results to predefined output file.
~CompositionProfile()
Destructor.
bool notEnd() const
Is the current pointer not at the end of the array?
Boundary & boundary() const
Get the Boundary by reference.
int nSample_
Number of samples thus far.
Saving archive for binary istream.
int nBins_
Number of bins for density profile.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
int nSpecies() const
Get the number of Species in this Simulation.
DArray< Distribution > accumulators_
Distribution statistical accumulators.
DArray< Vector > waveVectors_
Array of direction vectors.
void setClassName(const char *className)
Set class name string.
FileMaster & fileMaster()
Get the FileMaster by reference.
bool isAtInterval(long counter) const
Return true iff counter is a multiple of the interval.
virtual void setup()
Clear accumulators.
const std::string & outputFileName() const
Return outputFileName string.
void allocate(int capacity)
Allocate the underlying C array.
DArray< IntVector > intVectors_
Array of Miller index vectors for directions.
int nAtomType() const
Get the number of atom types.
bool notEnd() const
Is this not the end of the array?
int nAtomType_
Number of atom types, copied from Simulation::nAtomType().
CompositionProfile(System &system)
Constructor.