8 #include "StructureFactorPGrid.h" 9 #include <mcMd/simulation/Simulation.h> 10 #include <mcMd/simulation/McMd_mpi.h> 11 #include <util/crystal/PointGroup.h> 12 #include <util/crystal/PointSymmetry.h> 13 #include <util/format/Int.h> 14 #include <util/format/Dbl.h> 44 read<int>(in,
"hMax", hMax_);
45 read<Util::LatticeSystem>(in,
"lattice", lattice_);
48 nWave_ = (2*hMax_ +1 )*(2*hMax_ + 1)*(2*hMax_ + 1);
61 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) {
120 for (i = 0; i <
nWave_; ++i) {
126 isInitialized_ =
true;
146 loadParameter<int>(ar,
"hMax", hMax_);
147 loadParameter<Util::LatticeSystem>(ar,
"lattice", lattice_);
150 if (nWave_ != (2*hMax_ + 1)*(2*hMax_ + 1)*(2*hMax_ + 1)) {
153 if (nAtomType_ !=
system().simulation().nAtomType()) {
154 UTIL_THROW(
"Inconsistent values of nAtomType_");
157 UTIL_THROW(
"Inconsistent capacity1 for modes array");
159 if (waveIntVectors_.capacity() !=
nWave_) {
160 UTIL_THROW(
"Inconsistent capacity for waveIntVector");
165 fourierModes_.
allocate(nWave_, nAtomType_ + 1);
174 void StructureFactorPGrid::makeStars()
176 int i, j, h, k, l, m;
180 if (lattice_ == Cubic) {
182 nStar_ = (hMax_ +1 )*(hMax_ + 2)*(hMax_ + 3)/6;
211 for (h = 0; h <= hMax_; ++h) {
213 for (k = 0; k <= h; ++k) {
215 for (l = 0; l <= k; ++l) {
219 starSizes_[i] = star.
size();
220 for (m = 0; m < star.
size(); ++m) {
242 double value, average, size;
254 for (i = 0; i < nStar_; ++i) {
255 size = starSizes_[i];
260 for (m = 0; m < size; ++m) {
283 for (m = 0; m < size; ++m) {
288 average = average/double(size);
304 suffix = std::string(
".");
305 for (k = 0; k < 2; k++) {
308 suffix += std::string(
"A");
313 suffix += std::string(
".dat");
StructureFactorP evaluates partial structure factors in Fourier space.
const int Dimension
Dimensionality of space.
int nAtomTypeIdPair_
Number of selected atom type pairs.
std::string toString(int n)
Return string representation of an integer.
void allocate(int capacity1, int capacity2)
Allocate memory for a matrix.
std::ofstream outputFile_
Output file stream.
void openOutputFile(const std::string &filename, std::ofstream &out, std::ios_base::openmode mode=std::ios_base::out) const
Open an output file.
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.
bool add(Symmetry &symmetry)
Add a new element to the group.
virtual void setup()
Set up before a simulation.
void readOutputFileName(std::istream &in)
Read outputFileName from file.
Saving / output archive for binary ostream.
A fixed capacity (static) contiguous array with a variable logical size.
DArray< IntVector > waveIntVectors_
Array of miller index IntVectors for wavevectors.
#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.
virtual void save(Serializable::OArchive &ar)
Save state to an archive.
void readInterval(std::istream &in)
Read interval from file, with error checking.
Utility classes for scientific computation.
virtual void loadParameters(Serializable::IArchive &ar)
Load state from an archive.
int nAtomType_
Number of atom types, copied from Simulation::nAtomType().
int & R(int i, int j)
Return an element of the matrix by reference.
Wrapper for an int, for formatted ostream output.
StructureFactorPGrid(System &system)
Constructor.
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.
int nSample_
Number of samples thus far.
Saving archive for binary istream.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
DMatrix< double > structureFactors_
Structure factor accumulators.
void setClassName(const char *className)
Set class name string.
virtual void readParameters(std::istream &in)
Read parameters from file.
An IntVector is an integer Cartesian vector.
FileMaster & fileMaster()
Get the FileMaster by reference.
const std::string & outputFileName() const
Return outputFileName string.
void allocate(int capacity)
Allocate the underlying C array.
int nAtomType() const
Get the number of atom types.
void makeCompleteGroup()
Generate a complete group from the current elements.
DArray< Vector > waveVectors_
Array of wave vectors (temporary)
int size() const
Return logical size of this array (i.e., number of elements).
virtual void output()
Output structure factors, averaged over stars.
DArray< Pair< int > > atomTypeIdPairs_
Array of atom type indices (-1 indicates a sum of all types)
A PointSymmetry represents a crystallographic point group symmetry.
int nWave_
Number of wavevectors.