8 #include "StructureFactorGrid.h" 9 #include <ddMd/simulation/Simulation.h> 10 #include <util/crystal/PointGroup.h> 11 #include <util/crystal/PointSymmetry.h> 12 #include <util/archives/Serializable_includes.h> 13 #include <util/mpi/MpiLoader.h> 14 #include <util/format/Int.h> 15 #include <util/format/Dbl.h> 45 read<int>(in,
"nMode",
nMode_);
48 read<int>(in,
"hMax", hMax_);
49 read<LatticeSystem>(in,
"lattice", lattice_);
52 nWave_ = (2*hMax_ +1 )*(2*hMax_ + 1)*(2*hMax_ + 1);
62 if (lattice_ == Cubic) {
63 nStar_ = (hMax_ +1 )*(hMax_ + 2)*(hMax_ + 3)/6;
92 for (h = 0; h <= hMax_; ++h) {
94 for (k = 0; k <= h; ++k) {
96 for (l = 0; l <= k; ++l) {
100 starSizes_[i] = star.
size();
101 for (m = 0; m < star.
size(); ++m) {
115 }
else if (lattice_ == Tetragonal) {
117 nStar_ = (hMax_ + 1 )*(hMax_ + 1)*(hMax_ + 2)/2;
145 for (h = 0; h <= hMax_; ++h) {
147 for (k = 0; k <= hMax_; ++k) {
149 for (l = 0; l <= k; ++l) {
153 starSizes_[i] = star.
size();
154 for (m = 0; m < star.
size(); ++m) {
168 }
else if (lattice_ == Orthorhombic) {
170 nStar_ = (hMax_ + 1 )*(hMax_ + 1)*(hMax_ + 1);
198 for (h = 0; h <= hMax_; ++h) {
200 for (k = 0; k <= hMax_; ++k) {
202 for (l = 0; l <= hMax_; ++l) {
206 starSizes_[i] = star.
size();
207 for (m = 0; m < star.
size(); ++m) {
227 for (i = 0; i <
nWave_; ++i) {
228 for (j = 0; j <
nMode_; ++j) {
236 isInitialized_ =
true;
249 loadParameter<int>(ar,
"nMode",
nMode_);
252 loadParameter<int>(ar,
"hMax", hMax_);
253 loadParameter<LatticeSystem>(ar,
"lattice", lattice_);
262 loader.load(starIds_, nStar_);
264 loader.load(starSizes_, nStar_);
277 isInitialized_ =
true;
308 UTIL_THROW(
"Time step index is not a multiple of interval");
313 std::ios_base::openmode mode = std::ios_base::out;
315 mode = std::ios_base::out | std::ios_base::app;
327 for (
int i = 0; i < nStar_; ++i) {
328 int size = starSizes_[i];
336 for (
int j = 0; j <
nMode_; ++j) {
337 double average = 0.0;
340 for (
int m = 0; m < size; ++m) {
346 average = average/double(size);
347 logFile_ << Dbl(average, 20, 8);
349 logFile_ << std::endl;
351 logFile_ << std::endl;
361 double value, average, size;
371 for (i = 0; i < nStar_; ++i) {
372 size = starSizes_[i];
378 for (j = 0; j <
nMode_; ++j) {
381 for (m = 0; m < size; ++m) {
386 average = average/double(size);
virtual void clear()
Clear all accumulators and counters.
const int Dimension
Dimensionality of space.
Simulation & simulation()
Get the parent Simulation by reference.
DArray< IntVector > waveIntVectors_
Array of Miller index IntVectors for wavevectors.
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.
StructureFactorGrid(Simulation &simulation)
Constructor.
double volume() const
Return unit cell volume.
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.
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.
bool add(Symmetry &symmetry)
Add a new element to the group.
Parallel domain decomposition (DD) MD simulation.
Main object for a domain-decomposition MD simulation.
Saving / output archive for binary ostream.
void loadOutputFileName(Serializable::IArchive &ar)
Load output file name to an archive.
A fixed capacity (static) contiguous array with a variable logical size.
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 writeParam(std::ostream &out)
Write all parameters to an output stream.
bool isAtInterval(long counter) const
Return true iff counter is a multiple of the interval.
Utility classes for scientific computation.
std::ofstream outputFile_
Output file stream.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
int & R(int i, int j)
Return an element of the matrix by reference.
Wrapper for an int, for formatted ostream output.
DMatrix< std::complex< double > > totalFourierModes_
Total fourier modes of concentration.
void makeStar(const IntVector &root, FSArray< IntVector, N > &star)
Generate a set of reciprocal vectors that are related by symmetry.
Group of crystal symmetries with no translations.
const std::string & outputFileName() const
Return outputFileName string.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
StructureFactor evaluates structure factors in Fourier space.
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 allocate(int capacity)
Allocate the underlying C array.
void saveOutputFileName(Serializable::OArchive &ar)
Save output file name to an archive.
virtual void output()
Output structure factors, averaged over stars.
virtual void readParameters(std::istream &in)
Read parameters from file.
void makeCompleteGroup()
Generate a complete group from the current elements.
int nSample_
Number of samples thus far.
int size() const
Return logical size of this array (i.e., number of elements).
void sample(long iStep)
Add particles to StructureFactor accumulators.
DMatrix< double > modes_
Array of mode vectors.
virtual void sample(long iStep)
Add particles to StructureFactor accumulators.
A PointSymmetry represents a crystallographic point group symmetry.