32 hasFileMaster_(false),
46 fieldIo_.associate(mesh_, fft_,
47 lattice_, groupName_, group_, basis_,
49 hasFileMaster_ =
true;
62 bool hasUnitCell =
false;
65 readOptional(in,
"unitCell", unitCell_);
67 lattice_ = unitCell_.lattice();
72 read(in,
"mesh", mesh_);
73 fft_.setup(mesh_.dimensions());
77 read(in,
"lattice", lattice_);
78 unitCell_.set(lattice_);
82 read(in,
"groupName", groupName_);
83 readGroup(groupName_, group_);
87 basis().makeBasis(mesh(), unitCell(), group_);
89 isInitialized_ =
true;
102 Pscf::readFieldHeader(in, ver1, ver2,
103 unitCell_, groupName_, nMonomer);
105 lattice_ = unitCell_.lattice();
110 if (label !=
"mesh" && label !=
"ngrid") {
111 std::string msg =
"\n";
112 msg +=
"Error reading field file:\n";
113 msg +=
"Expected mesh or ngrid, but found [";
122 mesh_.setDimensions(nGrid);
123 fft_.setup(mesh_.dimensions());
126 readGroup(groupName_, group_);
127 basis_.makeBasis(mesh_, unitCell_, group_);
129 isInitialized_ =
true;
136 lattice_ = unitCell.lattice();
140 unitCell_ = unitCell;
141 if (!basis_.isInitialized()) {
158 unitCell_.set(lattice, parameters);
159 if (!basis_.isInitialized()) {
172 unitCell_.setParameters(parameters);
173 if (!basis_.isInitialized()) {
185 if (group_.size() == 1) {
186 if (groupName_ !=
"I") {
188 readGroup(groupName_, group_);
193 if (!basis().isInitialized()) {
194 basis_.makeBasis(mesh_, unitCell_, group_);
An IntVec<D, T> is a D-component vector of elements of integer type T.
virtual void readParameters(std::istream &in)
Read body of parameter block (without opening and closing lines).
void setFileMaster(FileMaster &fileMaster)
Create association with a FileMaster, needed by FieldIo.
void setUnitCell(UnitCell< D > const &unitCell)
Set unit cell.
void readRGridFieldHeader(std::istream &in, int &nMonomer)
Read header of an r-grid field file to initialize this Domain.
void makeBasis()
Construct basis if not done already.
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.