11#include <prdc/cpu/types.h>
12#include <prdc/cpu/complex.h>
14#include <prdc/field/FieldIoReal.h>
15#include <prdc/cpu/RField.h>
16#include <prdc/cpu/RFieldDft.h>
17#include <prdc/cpu/FFT.h>
22 template <
typename T>
class DArray;
26 template <
int D>
class UnitCell;
65 :
public FieldIoReal< D, RField<D>, RFieldDft<D>, FFT<D> >
106 int nMonomer)
const override;
136 bool writeHeader =
true,
137 bool isSymmetric =
true,
138 bool writeMeshSize =
true)
const override;
154 bool writeHeader =
true,
155 bool isSymmetric =
true)
185 bool isSymmetric =
true)
212 bool checkSymmetry =
true,
213 double epsilon = 1.0e-8)
227 double epsilon = 1.0e-8,
288 IntVec<D> const & replicas)
const override;
332 #ifndef RPC_FIELD_IO_TPP
333 extern template class FieldIo<1>;
334 extern template class FieldIo<2>;
335 extern template class FieldIo<3>;
340#ifndef RPC_FIELD_IO_TPP
An IntVec<D, T> is a D-component vector of elements of integer type T.
Fourier transform wrapper.
Fourier transform of a real field on an FFT mesh.
Field of real double precision values on an FFT mesh.
File input/output operations and format conversions for fields.
virtual void readFieldsRGridData(std::istream &in, DArray< RField< D > > &fields, int nMonomer) const
FFT< D > const & fft() const
void scaleFieldsRGrid(DArray< RField< D > > &fields, double factor) const
void writeFieldHeader(std::ostream &out, int nMonomer, UnitCell< D > const &unitCell, bool isSymmetric=true) const
virtual bool hasSymmetry(RFieldDft< D > const &in, double epsilon=1.0e-8, bool verbose=true) const
virtual void expandRGridDimension(std::ostream &out, DArray< RField< D > > const &fields, UnitCell< D > const &unitCell, int d, DArray< int > const &newGridDimensions) const
virtual void writeFieldsRGrid(std::ostream &out, DArray< RField< D > > const &fields, UnitCell< D > const &unitCell, bool writeHeader=true, bool isSymmetric=true, bool writeMeshSize=true) const
virtual void replicateUnitCell(std::ostream &out, DArray< RField< D > > const &fields, UnitCell< D > const &unitCell, IntVec< D > const &replicas) const
virtual void convertBasisToKGrid(DArray< double > const &components, RFieldDft< D > &dft) const
virtual void convertKGridToBasis(RFieldDft< D > const &in, DArray< double > &out, bool checkSymmetry=true, double epsilon=1.0e-8) const
std::string const & groupName() const
SpaceGroup< D > const & group() const
void convertBasisToRGrid(DArray< double > const &in, RField< D > &out) const
virtual void readFieldRGrid(std::istream &in, RField< D > &field, UnitCell< D > &unitCell) const
virtual void writeFieldsKGrid(std::ostream &out, DArray< RFieldDft< D > > const &fields, UnitCell< D > const &unitCell, bool isSymmetric=true) const
void convertRGridToKGrid(DArray< RField< D > > const &in, DArray< RFieldDft< D > > &out) const
virtual void writeFieldRGrid(std::ostream &out, RField< D > const &field, UnitCell< D > const &unitCell, bool writeHeader=true, bool isSymmetric=true) const
void readFieldHeader(std::istream &in, int &nMonomer, UnitCell< D > &unitCell, bool &isSymmetric) const
Mesh< D > const & mesh() const
UnitCell< D >::LatticeSystem const & lattice() const
void setFileMaster(FileMaster const &fileMaster)
void convertRGridToBasis(RField< D > const &in, DArray< double > &out, bool checkSymmetry=true, double epsilon=1.0e-8) const
void readFieldBasis(std::istream &in, DArray< double > &field, UnitCell< D > &unitCell) const
void readFieldsBasis(std::istream &in, DArray< DArray< double > > &fields, UnitCell< D > &unitCell) const
FileMaster const & fileMaster() const
virtual void readFieldsRGrid(std::istream &in, DArray< RField< D > > &fields, UnitCell< D > &unitCell) const
void scaleFieldsBasis(DArray< DArray< double > > &fields, double factor) const
void convertKGridToRGrid(DArray< RFieldDft< D > > const &in, DArray< RField< D > > &out) const
void associate(Mesh< D > const &mesh, FFT< D > const &fft, typename UnitCell< D >::LatticeSystem const &lattice, bool const &hasGroup, std::string const &groupName, SpaceGroup< D > const &group, Basis< D > &basis)
virtual void readFieldsKGrid(std::istream &in, DArray< RFieldDft< D > > &fields, UnitCell< D > &unitCell) const
void writeFieldsBasis(std::ostream &out, DArray< DArray< double > > const &fields, UnitCell< D > const &unitCell) const
Basis< D > const & basis() const
void writeFieldBasis(std::string filename, DArray< double > const &field, UnitCell< D > const &unitCell) const
Base template for UnitCell<D> classes, D=1, 2 or 3.
void expandRGridDimension(std::ostream &out, DArray< RField< D > > const &fields, UnitCell< D > const &unitCell, int d, DArray< int > const &newGridDimensions) const override
Expand spatial dimension of an array of r-grid fields.
void replicateUnitCell(std::ostream &out, DArray< RField< D > > const &fields, UnitCell< D > const &unitCell, IntVec< D > const &replicas) const override
Write r-grid fields in a replicated unit cell to std::ostream.
bool hasSymmetry(RFieldDft< D > const &in, double epsilon=1.0e-8, bool verbose=true) const override
Check if a k-grid field has the declared space group symmetry.
void scaleFieldRGrid(RField< D > &field, double factor) const override
Rescale a single r-grid field by a scalar factor.
void writeFieldsKGrid(std::ostream &out, DArray< RFieldDft< D > > const &fields, UnitCell< D > const &unitCell, bool isSymmetric=true) const override
Write array of RFieldDft objects (k-space fields) to file.
void readFieldsRGrid(std::istream &in, DArray< RField< D > > &fields, UnitCell< D > &unitCell) const override
Read array of RField objects (r-grid fields) from a stream.
void convertBasisToKGrid(DArray< double > const &components, RFieldDft< D > &dft) const override
Convert a field from symmetrized basis to Fourier grid (k-grid).
void readFieldsRGridData(std::istream &in, DArray< RField< D > > &fields, int nMonomer) const override
Read data for an array of r-grid fields, with no header section.
void readFieldsKGrid(std::istream &in, DArray< RFieldDft< D > > &fields, UnitCell< D > &unitCell) const override
Read array of RFieldDft objects (k-space fields) from a stream.
void convertKGridToBasis(RFieldDft< D > const &in, DArray< double > &out, bool checkSymmetry=true, double epsilon=1.0e-8) const override
Convert a field from Fourier (k-grid) to symmetrized basis form.
void writeFieldsRGrid(std::ostream &out, DArray< RField< D > > const &fields, UnitCell< D > const &unitCell, bool writeHeader=true, bool isSymmetric=true, bool writeMeshSize=true) const override
Write array of RField objects (fields on r-space grid) to a stream.
void scaleFieldBasis(DArray< double > &field, double factor) const override
Rescale a single field in basis format by a scalar factor.
void readFieldRGrid(std::istream &in, RField< D > &field, UnitCell< D > &unitCell) const override
Read a single RField (field on an r-space grid) from a stream.
FieldIo()
Default constructor.
void writeFieldRGrid(std::ostream &out, RField< D > const &field, UnitCell< D > const &unitCell, bool writeHeader=true, bool isSymmetric=true) const override
Write a single RField (field on an r-space grid) to a stream.
Dynamically allocatable contiguous array template.
A FileMaster manages input and output files for a simulation.
Fields and FFTs for periodic boundary conditions (CPU)
Periodic fields and crystallography.
PSCF package top-level namespace.
Utility classes for scientific computation.