8 #include "OrderParamNucleation.h" 9 #include <ddMd/simulation/Simulation.h> 10 #include <ddMd/simulation/SimulationAccess.h> 11 #include <ddMd/storage/AtomStorage.h> 12 #include <ddMd/storage/AtomIterator.h> 13 #include <ddMd/communicate/Exchanger.h> 14 #include <simp/boundary/Boundary.h> 15 #include <util/math/Constants.h> 16 #include <util/misc/ioUtil.h> 17 #include <util/format/Int.h> 18 #include <util/format/Dbl.h> 43 if (perpIndex_ < 0 || perpIndex_ >=
Dimension) {
44 UTIL_THROW(
"Invalid index for ordering direction.");
47 if (parallelIndex_ < 0 || parallelIndex_ >=
Dimension) {
48 UTIL_THROW(
"Invalid index for parallel direction.");
51 read<int>(in,
"nBin",
nBin_);
69 loadParameter<int>(ar,
"perpIndex",
perpIndex_);
70 if (perpIndex_ < 0 || perpIndex_ >=
Dimension) {
71 UTIL_THROW(
"Invalid index for ordering direction.");
74 if (parallelIndex_ < 0 || parallelIndex_ >=
Dimension) {
75 UTIL_THROW(
"Invalid index for parallel direction.");
78 loadParameter<int>(ar,
"nBin",
nBin_);
105 UTIL_THROW(
"Error: object is not initialized");
111 for (j = 0; j <
nBin_; ++j) {
128 blengths = boundaryPtr->
lengths();
131 double slabLength,
product, cosFactor;
136 for ( ; atomIter.
notEnd(); ++atomIter) {
137 position = atomIter->position();
138 typeId = atomIter->typeId();
145 cosFactor = cos(product)*cos(product);
152 for (
int j = 0; j <
nBin_; ++j) {
156 1, MPI::DOUBLE, MPI::SUM, 0);
161 for (
int j = 0; j <
nBin_; ++j) {
188 double volume, value;
191 for (i = 0; i <
nBin_; ++i) {
DMatrix< double > totalCosFactors_
Total cos factors of size nAtomType*nBin (gathered from all processors)
const int Dimension
Dimensionality of space.
Abstract base for periodic output and/or analysis actions.
Simulation & simulation()
Get the parent Simulation by reference.
A Vector is a Cartesian vector.
virtual void output()
Output results to predefined output file.
float product(float a, float b)
Product for float Data.
void readOutputFileName(std::istream &in)
Read outputFileName from file.
void saveInterval(Serializable::OArchive &ar)
Save interval parameter to an archive.
void allocate(int capacity1, int capacity2)
Allocate memory for a matrix.
AtomStorage & atomStorage()
Get the AtomStorage by reference.
double volume() const
Return unit cell volume.
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.
void readInterval(std::istream &in)
Read parameter interval from file.
Wrapper for a double precision number, for formatted ostream output.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
Parallel domain decomposition (DD) MD simulation.
Classes used by all simpatico molecular simulations.
Main object for a domain-decomposition MD simulation.
MPI::Intracomm & communicator() const
Return Cartesian communicator by reference.
DMatrix< double > cosFactors_
Cos factors of size nAtomType*nBin.
Saving / output archive for binary ostream.
void loadOutputFileName(Serializable::IArchive &ar)
Load output file name to an archive.
FileMaster & fileMaster()
Get the associated FileMaster by reference.
virtual void readParameters(std::istream &in)
Read parameters from file.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
OrderParamNucleation(Simulation &simulation)
Constructor.
virtual void writeParam(std::ostream &out)
Write all parameters to an output stream.
virtual void clear()
Clear accumulators.
bool isAtInterval(long counter) const
Return true iff counter is a multiple of the interval.
bool notEnd() const
Is the current pointer not at the end of the PArray?
Utility classes for scientific computation.
Wrapper for an int, for formatted ostream output.
~OrderParamNucleation()
Destructor.
int nAtomType_
Number of atom types, copied from Simulation::nAtomType().
const std::string & outputFileName() const
Return outputFileName string.
int parallelIndex_
Index of direction parallel to the lamellar surfaces.
int perpIndex_
Index of direction perpendicular to lamellae (direction of external field)
Saving archive for binary istream.
std::ofstream outputFile_
Output file stream.
void sample(long iStep)
Add particles to OrderParamNucleation accumulators.
static const double Pi
Trigonometric constant Pi.
void setClassName(const char *className)
Set class name string.
void loadInterval(Serializable::IArchive &ar)
Load parameter interval from input archive.
int nAtomType()
Get maximum number of atom types.
int nSample_
Number of samples thus far.
Boundary & boundary()
Get the Boundary by reference.
void saveOutputFileName(Serializable::OArchive &ar)
Save output file name to an archive.
int nBin_
Number of bins to divide the length along parallel direction.
Domain & domain()
Get the Domain by reference.
Iterator for all atoms owned by an AtomStorage.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
void begin(AtomIterator &iterator)
Set iterator to beginning of the set of atoms.
bool isInitialized_
Has readParam been called?
int periodicity_
Number of periods in the perpendicular direction.