11#include <prdc/field/FieldIoReal.h>
12#include <prdc/cuda/RField.h>
13#include <prdc/cuda/RFieldDft.h>
14#include <prdc/cuda/FFT.h>
19 template <
typename T>
class DArray;
23 template <
int D>
class UnitCell;
62 :
public FieldIoReal< D, RField<D>, RFieldDft<D>, FFT<D> >
161 bool writeHeader =
true,
162 bool isSymmetric =
true,
163 bool writeMeshSize =
true)
const;
179 bool writeHeader =
true,
180 bool isSymmetric =
true)
const;
208 bool isSymmetric =
true)
const;
233 bool checkSymmetry =
true,
234 double epsilon = 1.0e-8)
const;
247 double epsilon = 1.0e-8,
248 bool verbose =
true)
const;
319 #ifndef RPG_FIELD_IO_TPP
320 extern template class FieldIo<1>;
321 extern template class FieldIo<2>;
322 extern template class FieldIo<3>;
327#ifndef RPG_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 writeFieldsKGrid(std::ostream &out, DArray< RFieldDft< D > > const &fields, UnitCell< D > const &unitCell, bool isSymmetric=true) const
Write array of RFieldDft objects (k-space fields) to file.
FieldIo()
Default constructor.
void expandRGridDimension(std::ostream &out, DArray< RField< D > > const &fields, UnitCell< D > const &unitCell, int d, DArray< int > const &newGridDimensions) const
Expand spatial dimension of an array of r-grid fields.
void readFieldsKGrid(std::istream &in, DArray< RFieldDft< D > > &fields, UnitCell< D > &unitCell) const
Read array of RFieldDft objects (k-space fields) from a stream.
void replicateUnitCell(std::ostream &out, DArray< RField< D > > const &fields, UnitCell< D > const &unitCell, IntVec< D > const &replicas) const
Write r-grid fields in a replicated unit cell to std::ostream.
void scaleFieldBasis(DArray< double > &field, double factor) const
Rescale a single field in basis format by a scalar factor.
void scaleFieldRGrid(RField< D > &field, double factor) const
Rescale a single r-grid field by a scalar factor.
bool hasSymmetry(RFieldDft< D > const &in, double epsilon=1.0e-8, bool verbose=true) const
Check if a k-grid field has the declared space group symmetry.
void readFieldsRGridData(std::istream &in, DArray< RField< D > > &fields, int nMonomer) const
Read data for an array of r-grid fields, with no header section.
void writeFieldRGrid(std::ostream &out, RField< D > const &field, UnitCell< D > const &unitCell, bool writeHeader=true, bool isSymmetric=true) const
Write a single RField (field on an r-space grid) to a stream.
void convertKGridToBasis(RFieldDft< D > const &in, DArray< double > &out, bool checkSymmetry=true, double epsilon=1.0e-8) const
Convert a field from Fourier (k-grid) to symmetrized basis form.
void readFieldRGrid(std::istream &in, RField< D > &field, UnitCell< D > &unitCell) const
Read a single RField (field on an r-space grid) from a stream.
void writeFieldsRGrid(std::ostream &out, DArray< RField< D > > const &fields, UnitCell< D > const &unitCell, bool writeHeader=true, bool isSymmetric=true, bool writeMeshSize=true) const
Write array of RField objects (fields on r-space grid) to a stream.
void convertBasisToKGrid(DArray< double > const &components, RFieldDft< D > &dft) const
Convert a field from symmetrized basis to Fourier grid (k-grid).
void readFieldsRGrid(std::istream &in, DArray< RField< D > > &fields, UnitCell< D > &unitCell) const
Read array of RField objects (r-grid fields) from a stream.
Dynamically allocatable contiguous array template.
A FileMaster manages input and output files for a simulation.
Fields, FFTs, and utilities for periodic boundary conditions (CUDA)
Periodic fields and crystallography.
PSCF package top-level namespace.
Utility classes for scientific computation.