8 #include "StructureFactor.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/space/Dimension.h> 17 #include <util/space/IntVector.h> 18 #include <util/misc/ioUtil.h> 19 #include <util/mpi/MpiLoader.h> 20 #include <util/format/Int.h> 21 #include <util/format/Dbl.h> 32 isInitialized_(false),
46 read<int>(in,
"nMode",
nMode_);
49 read<int>(in,
"nWave",
nWave_);
60 for (i = 0; i <
nWave_; ++i) {
61 for (j = 0; j <
nMode_; ++j) {
80 loadParameter<int>(ar,
"nMode",
nMode_);
83 loadParameter<int>(ar,
"nWave",
nWave_);
126 UTIL_THROW(
"Error: object is not initialized");
135 for (i = 0; i <
nWave_; ++i) {
136 for (j = 0; j <
nMode_; ++j) {
149 UTIL_THROW(
"Time step index not a multiple of interval");
152 std::ios_base::openmode mode = std::ios_base::out;
154 mode = std::ios_base::out | std::ios_base::app;
162 std::complex<double> expFactor;
170 for (i = 0; i <
nWave_; ++i) {
171 for (j = 0; j <
nMode_; ++j) {
177 for ( ; atomIter.
notEnd(); ++atomIter) {
178 position = atomIter->position();
179 typeId = atomIter->typeId();
182 for (i = 0; i <
nWave_; ++i) {
186 for (j = 0; j <
nMode_; ++j) {
192 for (i = 0; i <
nWave_; ++i) {
193 for (j = 0; j <
nMode_; ++j) {
200 for (
int i = 0; i <
nWave_; ++i) {
201 for (
int j = 0; j <
nMode_; ++j) {
205 1, MPI::DOUBLE_COMPLEX, MPI::SUM, 0);
209 for (
int i = 0; i <
nWave_; ++i) {
210 for (
int j = 0; j <
nMode_; ++j) {
219 double norm, maxValue, maxQ;
221 for (j = 0; j <
nMode_; ++j) {
224 for (i = 1; i <
nWave_; ++i) {
227 if ( norm >= maxValue ) {
257 for (i = 0; i <
nWave_; ++i) {
285 for (i = 0; i <
nWave_; ++i) {
290 for (j = 0; j <
nMode_; ++j) {
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.
DArray< IntVector > waveIntVectors_
Array of Miller index IntVectors for wavevectors.
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.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
double volume() const
Return unit cell volume.
double dot(const Vector &v) const
Return dot product of this vector and vector v.
An orthorhombic periodic unit cell.
int nWave_
Number of wavevectors.
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}.
DMatrix< double > structureFactors_
Structure factor accumulators.
int nAtomType_
Number of atom types, copied from Simulation::nAtomType().
void readInterval(std::istream &in)
Read parameter interval from file.
Wrapper for a double precision number, for formatted ostream output.
DArray< Vector > waveVectors_
Array of floating point wave vectors.
virtual void readParameters(std::istream &in)
Read parameters from file.
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.
void makeWaveVectors()
Update wavevectors.
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.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
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.
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.
virtual void clear()
Clear accumulators.
std::ofstream outputFile_
Output file stream.
Wrapper for an int, for formatted ostream output.
DMatrix< std::complex< double > > totalFourierModes_
Total fourier modes of concentration.
const std::string & outputFileName() const
Return outputFileName string.
StructureFactor(Simulation &simulation)
Constructor.
Saving archive for binary istream.
DMatrix< std::complex< double > > fourierModes_
Fourier modes of concentration.
Provides methods for MPI-aware loading of data from input archive.
int nMode_
Number of mode vectors.
void setClassName(const char *className)
Set class name string.
void loadInterval(Serializable::IArchive &ar)
Load parameter interval from input archive.
An IntVector is an integer Cartesian vector.
int nAtomType()
Get maximum number of atom types.
bool isFirstStep_
Is this the first step?
Boundary & boundary()
Get the Boundary by reference.
void saveOutputFileName(Serializable::OArchive &ar)
Save output file name to an archive.
Domain & domain()
Get the Domain by reference.
Iterator for all atoms owned by an AtomStorage.
static const std::complex< double > Im
Square root of -1.
int nSample_
Number of samples thus far.
void sample(long iStep)
Add particles to StructureFactor accumulators.
DMatrix< double > modes_
Array of mode vectors.
~StructureFactor()
Destructor.
void begin(AtomIterator &iterator)
Set iterator to beginning of the set of atoms.
bool isInitialized_
Has readParam been called?
virtual void output()
Output results to predefined output file.