8 #include "StructureFactorP.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/math/Constants.h> 15 #include <util/space/Dimension.h> 16 #include <util/misc/FileMaster.h> 17 #include <util/misc/ioUtil.h> 18 #include <util/format/Int.h> 19 #include <util/format/Dbl.h> 55 read<int>(in,
"nWave",
nWave_);
76 loadParameter<int>(ar,
"nWave",
nWave_);
83 UTIL_THROW(
"Inconsistent values of nAtomType");
86 UTIL_THROW(
"Inconsistent capacity for atomTypeIdPairs");
88 if (
nWave_ != waveIntVectors_.capacity()) {
89 UTIL_THROW(
"Inconsistent capacity for waveIntVectors");
91 if (
nWave_ != structureFactors_.capacity1()) {
92 UTIL_THROW(
"Inconsistent capacity1 for structureFactors");
95 UTIL_THROW(
"Inconsistent capacity2 for structureFactors");
124 for (i = 0; i <
nWave_; ++i) {
138 std::complex<double> expFactor;
142 int nSpecies, iSpecies, typeId, i;
147 for (i = 0; i <
nWave_; ++i) {
148 for (typeId = 0; typeId <=
nAtomType_; ++typeId) {
149 fourierModes_(i, typeId) = std::complex<double>(0.0, 0.0);
155 for (iSpecies = 0; iSpecies < nSpecies; ++iSpecies) {
157 for ( ; molIter.
notEnd(); ++molIter) {
158 molIter->begin(atomIter);
159 for ( ; atomIter.
notEnd(); ++atomIter) {
160 position = atomIter->position();
161 typeId = atomIter->typeId();
164 for (i = 0; i <
nWave_; ++i) {
168 fourierModes_(i, typeId) += expFactor;
179 std::complex<double> rho[2];
182 for (i = 0; i <
nWave_; ++i) {
184 for (k = 0; k < 2; ++k) {
187 rho[k] = fourierModes_(i, typeId);
192 rho[0] = std::conj(rho[0]);
213 for (i = 0; i <
nWave_; ++i) {
236 for (i = 0; i <
nWave_; ++i) {
256 suffix = std::string(
".");
257 for (k = 0; k < 2; k++) {
260 suffix += std::string(
"A");
265 suffix += std::string(
".dat");
270 for (i = 0; i <
nWave_; ++i) {
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.
A Vector is a Cartesian vector.
virtual void readParameters(std::istream &in)
Read parameters from file.
float product(float a, float b)
Product for float Data.
virtual void loadParameters(Serializable::IArchive &ar)
Load state from an archive.
void allocate(int capacity1, int capacity2)
Allocate memory for a matrix.
void begin(int speciesId, MoleculeIterator &iterator)
Initialize an iterator for molecules of one species in this System.
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.
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.
static const Vector Zero
Zero Vector = {0.0, 0.0, 0.0}.
bool isInitialized_
Has readParam been called?
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.
virtual void save(Serializable::OArchive &ar)
Save state to an archive.
Forward iterator for a PArray.
Classes used by all simpatico molecular simulations.
void readOutputFileName(std::istream &in)
Read outputFileName from file.
~StructureFactorP()
Destructor.
StructureFactorP(System &system)
Constructor.
Forward const iterator for an Array or a C array.
Saving / output archive for binary ostream.
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.
const Vector & reciprocalBasisVector(int i) const
Return reciprocal lattice basis vector i.
virtual void setup()
Clear accumulators.
void readInterval(std::istream &in)
Read interval from file, with error checking.
Utility classes for scientific computation.
int nAtomType_
Number of atom types, copied from Simulation::nAtomType().
Wrapper for an int, for formatted ostream output.
virtual void output()
Output results to predefined output file.
void sample(long iStep)
Add particle pairs to StructureFactorP histogram.
Template for Analyzer associated with one System.
int nSample_
Number of samples thus far.
bool notEnd() const
Is the current pointer not at the end of the array?
Boundary & boundary() const
Get the Boundary by reference.
Saving archive for binary istream.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
int nSpecies() const
Get the number of Species in this Simulation.
DMatrix< double > structureFactors_
Structure factor accumulators.
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.
const std::string & outputFileName() const
Return outputFileName string.
int nAtomType() const
Get the number of atom types.
bool notEnd() const
Is this not the end of the array?
static const std::complex< double > Im
Square root of -1.
DArray< Vector > waveVectors_
Array of wave vectors (temporary)
void makeWaveVectors()
Update wavevectors.
DArray< Pair< int > > atomTypeIdPairs_
Array of atom type indices (-1 indicates a sum of all types)
int nWave_
Number of wavevectors.