31 hasFileMaster_(false),
45 fieldIo_.associate(mesh_, fft_,
46 lattice_, groupName_, group_, basis_,
48 hasFileMaster_ =
true;
59 bool hasUnitCell =
false;
63 readOptional(in,
"unitCell", unitCell_);
65 lattice_ = unitCell_.lattice();
70 read(in,
"mesh", mesh_);
72 fft_.setup(mesh_.dimensions());
76 read(in,
"lattice", lattice_);
77 unitCell_.set(lattice_);
83 waveList().allocate(mesh(), unitCell());
86 read(in,
"groupName", groupName_);
87 readGroup(groupName_, group_);
90 if (unitCell().isInitialized()) {
91 basis().makeBasis(mesh(), unitCell(), group_);
94 isInitialized_ =
true;
103 Pscf::readFieldHeader(in, ver1, ver2,
104 unitCell_, groupName_, nMonomer);
109 if (label !=
"mesh" && label !=
"ngrid") {
110 std::string msg =
"\n";
111 msg +=
"Error reading field file:\n";
112 msg +=
"Expected mesh or ngrid, but found [";
121 mesh_.setDimensions(nGrid);
122 fft_.setup(mesh_.dimensions());
125 readGroup(groupName_, group_);
126 basis_.makeBasis(mesh_, unitCell_, group_);
128 isInitialized_ =
true;
138 lattice_ = unitCell.lattice();
142 unitCell_ = unitCell;
143 if (!basis_.isInitialized()) {
146 waveList_.computeKSq(unitCell_);
147 waveList_.computedKSq(unitCell_);
162 unitCell_.set(lattice, parameters);
163 if (!basis_.isInitialized()) {
166 waveList_.computeKSq(unitCell_);
167 waveList_.computedKSq(unitCell_);
178 unitCell_.setParameters(parameters);
179 if (!basis_.isInitialized()) {
182 waveList_.computeKSq(unitCell_);
183 waveList_.computedKSq(unitCell_);
196 if (group_.size() == 1) {
198 readGroup(groupName_, group_);
203 if (!basis().isInitialized()) {
204 basis_.makeBasis(mesh_, unitCell_, group_);
210 if (!waveList().hasMinimumImages()) {
211 waveList().computeMinimumImages(mesh(), unitCell());
An IntVec<D, T> is a D-component vector of elements of integer type T.
void setUnitCell(UnitCell< D > const &unitCell)
Set the unit cell, given a UnitCell<D> object.
void readRGridFieldHeader(std::istream &in, int &nMonomer)
Read initialization data from header of an r-grid field file.
void setFileMaster(FileMaster &fileMaster)
Create association with a FileMaster, needed by FieldIo.
void makeBasis()
Construct basis if not done already.
virtual void readParameters(std::istream &in)
Read body of parameter block (without opening and closing lines).
Base template for UnitCell<D> classes, D=1, 2 or 3.
A fixed capacity (static) contiguous array with a variable logical size.
int size() const
Return logical size of this array (i.e., number of elements).
A FileMaster manages input and output files for a simulation.
void setClassName(const char *className)
Set class name string.
#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.
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.