1#ifndef RPC_FIELD_IO_REAL_H
2#define RPC_FIELD_IO_REAL_H
11#include <prdc/crystal/UnitCell.h>
12#include <pscf/math/IntVec.h>
17 template <
typename T>
class DArray;
20 template <
int D>
class Mesh;
22 template <
int D>
class Basis;
25 template <
int D>
class FFT;
26 template <
int D>
class RField;
66 template <
int D,
class RFRT,
class RFKT,
class FFTT>
345 bool writeHeader =
true,
346 bool isSymmetric =
true,
347 bool writeMeshSize =
true)
const;
364 bool isSymmetric =
true)
const;
382 bool writeHeader =
true,
383 bool isSymmetric =
true)
const;
400 bool isSymmetric =
true)
const;
463 bool isSymmetric =
true)
const;
480 bool isSymmetric =
true)
const;
530 bool checkSymmetry =
true,
531 double epsilon = 1.0e-8)
const;
551 bool checkSymmetry =
true,
552 double epsilon = 1.0e-8)
const;
588 bool checkSymmetry =
true,
589 double epsilon = 1.0e-8)
const;
607 bool checkSymmetry =
true,
608 double epsilon = 1.0e-8)
const;
677 bool hasSymmetry(RFKT
const & in,
double epsilon = 1.0e-8,
678 bool verbose =
true)
const;
694 bool hasSymmetry(RFRT
const & in,
double epsilon = 1.0e-8,
695 bool verbose =
true)
const;
891 bool & isSymmetric)
const;
903 bool isSymmetric =
true)
const;
910 mutable RFKT workDft_;
918 FFTT
const * fftPtr_;
924 bool const * hasGroupPtr_;
927 std::string
const * groupNamePtr_;
967 return *hasGroupPtr_;
974 return *groupNamePtr_;
995 return *fileMasterPtr_;
An IntVec<D, T> is a D-component vector of elements of integer type T.
Description of a regular grid of points in a periodic domain.
Symmetry-adapted Fourier basis for pseudo-spectral scft.
Fourier transform wrapper.
Field of real double precision values on an FFT mesh.
File input/output operations and format conversions for fields.
FieldIoReal()
Constructor.
virtual void readFieldsRGridData(std::istream &in, DArray< RFRT > &fields, int nMonomer) const
Read data for array of r-grid fields, with no header section.
bool hasGroup() const
Has a space group been declared externally ?
virtual void scaleFieldBasis(DArray< double > &field, double factor) const
Multiply a single field in basis format by a real scalar.
FFTT const & fft() const
Get FFT object by const reference.
void scaleFieldsRGrid(DArray< RFRT > &fields, double factor) const
Scale an array of r-grid fields by a real scalar.
void writeFieldHeader(std::ostream &out, int nMonomer, UnitCell< D > const &unitCell, bool isSymmetric=true) const
Write header for field file (fortran pscf format)
virtual bool hasSymmetry(RFKT const &in, double epsilon=1.0e-8, bool verbose=true) const
Check if a k-grid field has the declared space group symmetry.
virtual void expandRGridDimension(std::ostream &out, DArray< RFRT > const &fields, UnitCell< D > const &unitCell, int d, DArray< int > const &newGridDimensions) const
Expand dimension of an array of r-grid fields, write to ostream.
virtual void writeFieldsRGrid(std::ostream &out, DArray< RFRT > 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 ostream.
virtual void replicateUnitCell(std::ostream &out, DArray< RFRT > const &fields, UnitCell< D > const &unitCell, IntVec< D > const &replicas) const
Write r-grid fields in a replicated unit cell to std::ostream.
virtual void convertBasisToKGrid(DArray< double > const &components, RFKT &dft) const
Convert a field from symmetrized basis to Fourier grid (k-grid).
virtual void convertKGridToBasis(RFKT 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.
std::string const & groupName() const
Get associated group name string by const reference.
SpaceGroup< D > const & group() const
Get associated SpaceGroup<D> by const reference.
virtual void scaleFieldRGrid(RFRT &field, double factor) const
Multiply a single field in r-grid format by a real scalar.
void convertBasisToRGrid(DArray< double > const &in, RFRT &out) const
Convert a field from symmetrized basis to spatial grid (r-grid).
virtual void readFieldRGrid(std::istream &in, RFRT &field, UnitCell< D > &unitCell) const
Read single RField (field on an r-space grid) from an istream.
virtual ~FieldIoReal()
Destructor.
virtual void writeFieldsKGrid(std::ostream &out, DArray< RFKT > const &fields, UnitCell< D > const &unitCell, bool isSymmetric=true) const
Write array of RFieldDft objects (k-space fields) to file.
void convertRGridToKGrid(DArray< RFRT > const &in, DArray< RFKT > &out) const
Convert fields from spatial grid (r-grid) to k-grid format.
virtual void writeFieldRGrid(std::ostream &out, RFRT const &field, UnitCell< D > const &unitCell, bool writeHeader=true, bool isSymmetric=true) const
Write a single RField (field on an r-space grid) to ostream.
void readFieldHeader(std::istream &in, int &nMonomer, UnitCell< D > &unitCell, bool &isSymmetric) const
Reader header of field file (fortran pscf format)
Mesh< D > const & mesh() const
Get spatial discretization mesh by const reference.
UnitCell< D >::LatticeSystem const & lattice() const
Get the lattice type enum value by const reference.
void setFileMaster(FileMaster const &fileMaster)
Create an association with a FileMaster.
void convertRGridToBasis(RFRT const &in, DArray< double > &out, bool checkSymmetry=true, double epsilon=1.0e-8) const
Convert a field from spatial grid (r-grid) to symmetrized basis.
void readFieldBasis(std::istream &in, DArray< double > &field, UnitCell< D > &unitCell) const
Read single concentration or chemical potential field from file.
void readFieldsBasis(std::istream &in, DArray< DArray< double > > &fields, UnitCell< D > &unitCell) const
Read concentration or chemical potential fields from file.
FileMaster const & fileMaster() const
Get associated FileMaster by const reference.
virtual void readFieldsRGrid(std::istream &in, DArray< RFRT > &fields, UnitCell< D > &unitCell) const
Read array of RField objects (r-grid fields) from an istream.
void scaleFieldsBasis(DArray< DArray< double > > &fields, double factor) const
Scale an array of fields in basis format by a real scalar.
void convertKGridToRGrid(DArray< RFKT > const &in, DArray< RFRT > &out) const
Convert fields from k-grid (DFT) to real space (r-grid) format.
void associate(Mesh< D > const &mesh, FFTT const &fft, typename UnitCell< D >::LatticeSystem const &lattice, bool const &hasGroup, std::string const &groupName, SpaceGroup< D > const &group, Basis< D > &basis)
Create association with other objects in parent Domain.
virtual void readFieldsKGrid(std::istream &in, DArray< RFKT > &fields, UnitCell< D > &unitCell) const
Read array of RFieldDft objects (k-space fields) from istream.
void writeFieldsBasis(std::ostream &out, DArray< DArray< double > > const &fields, UnitCell< D > const &unitCell) const
Write concentration or chemical potential field components to file.
Basis< D > const & basis() const
Get the associated Basis by const reference.
void writeFieldBasis(std::string filename, DArray< double > const &field, UnitCell< D > const &unitCell) const
Write single concentration or chemical potential field to file.
Crystallographic space group.
Base template for UnitCell<D> classes, D=1, 2 or 3.
Dynamically allocatable contiguous array template.
A FileMaster manages input and output files for a simulation.
#define UTIL_ASSERT(condition)
Assertion macro suitable for debugging serial or parallel code.
Periodic fields and crystallography.
PSCF package top-level namespace.
Utility classes for scientific computation.