12#include <rp/field/FieldIo.h>
13#include <pscf/field/FFT.h>
14#include <pscf/field/WaveList.h>
15#include <pscf/crystal/SpaceGroup.h>
16#include <pscf/crystal/Basis.h>
17#include <pscf/fieldIo/fieldHeader.h>
18#include <util/signal/Signal.h>
19#include <util/misc/FileMaster.h>
29 template <
int D,
class T>
38 waveListPtr_(nullptr),
41 fileMasterPtr_(nullptr),
58 unitCell_.setSignal(*signalPtr_);
64 template <
int D,
class T>
78 template <
int D,
class T>
81 fileMasterPtr_ = &fileMaster;
82 fieldIo().setFileMaster(fileMaster);
88 template <
int D,
class T>
98 fft().setup(mesh_.dimensions());
102 unitCell_.set(lattice_);
111 bool hasGroupName =
false;
113 in,
"groupName", groupName_).isActive();
119 readGroup(groupName_, *groupPtr_);
123 isInitialized_ =
true;
131 template <
int D,
class T>
144 unitCell_, groupName_, nMonomer);
147 lattice_ = unitCell_.lattice();
154 if (label !=
"mesh" && label !=
"ngrid") {
155 std::string msg =
"\n";
156 msg +=
"Error reading field file:\n";
157 msg +=
"Expected mesh or ngrid, but found [";
166 if (mesh_.size() == 0) {
167 mesh_.setDimensions(nGrid);
168 fft().setup(mesh_.dimensions());
173 waveList().allocate(mesh_, unitCell_);
177 if (groupName_ !=
"") {
178 readGroup(groupName_, *groupPtr_);
183 isInitialized_ =
true;
189 template <
int D,
class T>
198 if (!
basis().isInitialized()) {
209 template <
int D,
class T>
215 fileMaster().openOutputFile(filename, file);
216 bool isSymmetric =
true;
220 fieldIo().writeFieldHeader(file, nMonomer, cell, isSymmetric);
228 template <
int D,
class T>
234 fileMaster().openOutputFile(filename, file);
235 bool isSymmetric =
true;
239 fieldIo().writeFieldHeader(file, nMonomer, cell, isSymmetric);
247 template <
int D,
class T>
252 fileMaster().openOutputFile(filename, file);
260 template <
int D,
class T>
262 {
return basis().isInitialized(); }
Symmetry-adapted Fourier basis for pseudo-spectral SCFT.
An IntVec<D, T> is a D-component vector of elements of integer type T.
void makeBasis()
Construct basis if not done already.
void setFileMaster(FileMaster &fileMaster)
Create association with a FileMaster, needed by FieldIo.
FieldIo< D, T > & fieldIo()
Get the FieldIo by non-const reference.
WaveList< D, CPT > & waveList()
SpaceGroup< D > const & group() const
Get the SpaceGroup by const reference.
void readRGridFieldHeader(std::istream &in, int &nMonomer)
Read initialization data from header of an r-grid field file.
void writeWaves(std::string const &filename) const
Output information about waves.
Basis< D > & basis()
Get the Basis object by non-const reference.
void writeGroup(std::string const &filename) const
Output all elements of the space group.
bool hasGroup() const
Has a space group been declared?
bool hasBasis() const
Has a symmetry-adapted Fourier basis been initialized?
FFT< D, T > & fft()
Get the FFT by non-const reference.
virtual void readParameters(std::istream &in)
Read body of parameter block (without opening and closing lines).
void writeStars(std::string const &filename) const
Output information about stars and symmetrized basis functions.
Crystallographic space group.
Base template for UnitCell<D> classes, D=1, 2 or 3.
A FileMaster manages input and output files for a simulation.
ScalarParam< Type > & read(std::istream &in, const char *label, Type &value)
Add and read a new required ScalarParam < Type > object.
void setClassName(const char *className)
Set class name string.
ScalarParam< Type > & readOptional(std::istream &in, const char *label, Type &value)
Add and read a new optional ScalarParam < Type > object.
Notifier (or subject) in the Observer design pattern.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
void readFieldHeader(std::istream &in, int &ver1, int &ver2, UnitCell< D > &cell, std::string &groupName, int &nMonomer)
Read common part of field header (fortran PSCF format).
Code for programs that simulate real-valued periodic fields.
PSCF package top-level namespace.