PSCF v1.1
|
File input/output operations and format conversions for fields. More...
#include <FieldIo.h>
Public Member Functions | |
FieldIo () | |
Constructor. More... | |
~FieldIo () | |
Destructor. More... | |
void | associate (Mesh< D > const &mesh, FFT< D > const &fft, typename UnitCell< D >::LatticeSystem &lattice, std::string &groupName, SpaceGroup< D > &group, Basis< D > &basis, FileMaster const &fileMaster) |
Get and store addresses of associated objects. More... | |
Field File IO - Symmetry Adapted Basis Format | |
void | readFieldBasis (std::istream &in, DArray< double > &field, UnitCell< D > &unitCell) const |
Read single concentration or chemical potential field from file. More... | |
void | readFieldBasis (std::string filename, DArray< double > &field, UnitCell< D > &unitCell) const |
Read single concentration or chemical potential field from file. More... | |
void | writeFieldBasis (std::ostream &out, DArray< double > const &field, UnitCell< D > const &unitCell) const |
Write single concentration or chemical potential field to output stream out. More... | |
void | writeFieldBasis (std::string filename, DArray< double > const &field, UnitCell< D > const &unitCell) const |
Write single concentration or chemical potential field to file. More... | |
void | readFieldsBasis (std::istream &in, DArray< DArray< double > > &fields, UnitCell< D > &unitCell) const |
Read concentration or chemical potential field components from file. More... | |
void | readFieldsBasis (std::string filename, DArray< DArray< double > > &fields, UnitCell< D > &unitCell) const |
Read concentration or chemical potential field components from file. More... | |
void | writeFieldsBasis (std::ostream &out, DArray< DArray< double > > const &fields, UnitCell< D > const &unitCell) const |
Write concentration or chemical potential field components to file. More... | |
void | writeFieldsBasis (std::string filename, DArray< DArray< double > > const &fields, UnitCell< D > const &unitCell) const |
Write concentration or chemical potential field components to file. More... | |
Field File IO - Real Space Grid Format | |
void | readFieldRGrid (std::istream &in, RField< D > &field, UnitCell< D > &unitCell) const |
Read single RField (field on an r-space grid) from istream. More... | |
void | readFieldRGrid (std::string filename, RField< D > &field, UnitCell< D > &unitCell) const |
Read single RField (field on an r-space grid) from named file. More... | |
void | readFieldsRGrid (std::istream &in, DArray< RField< D > > &fields, UnitCell< D > &unitCell) const |
Read array of RField objects (fields on r-space grid) from istream. More... | |
void | readFieldsRGrid (std::string filename, DArray< RField< D > > &fields, UnitCell< D > &unitCell) const |
Read array of RField objects (fields on an r-space grid) from file. More... | |
void | writeFieldRGrid (std::ostream &out, RField< D > const &field, UnitCell< D > const &unitCell, bool writeHeader=true) const |
Write a single RField (field on an r-space grid) to ostream. More... | |
void | writeFieldRGrid (std::string filename, RField< D > const &field, UnitCell< D > const &unitCell) const |
Write a single RField (fields on an r-space grid) to a file. More... | |
void | writeFieldsRGrid (std::ostream &out, DArray< RField< D > > const &fields, UnitCell< D > const &unitCell) const |
Write array of RField objects (fields on r-space grid) to ostream. More... | |
void | writeFieldsRGrid (std::string filename, DArray< RField< D > > const &fields, UnitCell< D > const &unitCell) const |
Write array of RField objects (fields on an r-space grid) to file. More... | |
Field File IO - Fourier Space (K-Space) Grid Format | |
void | readFieldsKGrid (std::istream &in, DArray< RFieldDft< D > > &fields, UnitCell< D > &unitCell) const |
Read array of RFieldDft objects (k-space fields) from file. More... | |
void | readFieldsKGrid (std::string filename, DArray< RFieldDft< D > > &fields, UnitCell< D > &unitCell) const |
Read array of RFieldDft objects (k-space fields) from file. More... | |
void | writeFieldsKGrid (std::ostream &out, DArray< RFieldDft< D > > const &fields, UnitCell< D > const &unitCell) const |
Write array of RFieldDft objects (k-space fields) to file. More... | |
void | writeFieldsKGrid (std::string filename, DArray< RFieldDft< D > > const &fields, UnitCell< D > const &unitCell) const |
Write array of RFieldDft objects (k-space fields) to a file. More... | |
File IO Utilities | |
void | readFieldHeader (std::istream &in, int &nMonomer, UnitCell< D > &unitCell) const |
Reader header of field file (fortran pscf format) More... | |
void | writeFieldHeader (std::ostream &out, int nMonomer, UnitCell< D > const &unitCell) const |
Write header for field file (fortran pscf format) More... | |
Field Format Conversion | |
void | convertBasisToKGrid (DArray< double > const &components, RFieldDft< D > &dft) const |
Convert a field from symmetrized basis to Fourier transform (k-grid). More... | |
void | convertBasisToKGrid (DArray< DArray< double > > const &in, DArray< RFieldDft< D > > &out) const |
Convert fields from symmetrized basis to Fourier transform (k-grid). More... | |
void | convertKGridToBasis (RFieldDft< D > const &in, DArray< double > &out, bool checkSymmetry=true, double epsilon=1.0e-8) const |
Convert a field from Fourier transform (kgrid) to symmetrized basis. More... | |
void | convertKGridToBasis (DArray< RFieldDft< D > > const &in, DArray< DArray< double > > &out, bool checkSymmetry=true, double epsilon=1.0e-8) const |
Convert fields from Fourier transform (k-grid) to symmetrized basis. More... | |
void | convertBasisToRGrid (DArray< double > const &in, RField< D > &out) const |
Convert a field from symmetrized basis to spatial grid (r-grid). More... | |
void | convertBasisToRGrid (DArray< DArray< double > > const &in, DArray< RField< D > > &out) const |
Convert fields from symmetrized basis to spatial grid (r-grid). More... | |
void | convertRGridToBasis (RField< D > 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. More... | |
void | convertRGridToBasis (DArray< RField< D > > const &in, DArray< DArray< double > > &out, bool checkSymmetry=true, double epsilon=1.0e-8) const |
Convert fields from spatial grid (r-grid) to symmetrized basis. More... | |
void | convertKGridToRGrid (DArray< RFieldDft< D > > &in, DArray< RField< D > > &out) const |
Convert fields from k-grid (DFT) to real space (r-grid) format. More... | |
void | convertKGridToRGrid (RFieldDft< D > &in, RField< D > &out) const |
Convert a field from k-grid (DFT) to real space (r-grid) format. More... | |
void | convertRGridToKGrid (DArray< RField< D > > const &in, DArray< RFieldDft< D > > &out) const |
Convert fields from spatial grid (r-grid) to k-grid format. More... | |
void | convertRGridToKGrid (RField< D > const &in, RFieldDft< D > &out) const |
Convert a field from spatial grid (r-grid) to k-grid format. More... | |
Test Space Group Symmetry | |
bool | hasSymmetry (RField< D > const &in, double epsilon=1.0e-8, bool verbose=true) const |
Check if an r-grid field has the declared space group symmetry. More... | |
bool | hasSymmetry (RFieldDft< D > const &in, double epsilon=1.0e-8, bool verbose=true) const |
Check if a k-grid field has declared space group symmetry. More... | |
File input/output operations and format conversions for fields.
This class provides functions to read and write arrays that contain fields in any of three representations (symmetry-adapted basis, r-space grid, or Fourier k-space grid), and to convert among these representations. The functions that implement IO operations define file formats for these field representations.
Definition at line 42 of file pspc/field/FieldIo.h.
Pscf::Pspc::FieldIo< D >::FieldIo |
Constructor.
Definition at line 35 of file pspc/field/FieldIo.tpp.
Pscf::Pspc::FieldIo< D >::~FieldIo |
Destructor.
Definition at line 48 of file pspc/field/FieldIo.tpp.
void Pscf::Pspc::FieldIo< D >::associate | ( | Mesh< D > const & | mesh, |
FFT< D > const & | fft, | ||
typename UnitCell< D >::LatticeSystem & | lattice, | ||
std::string & | groupName, | ||
SpaceGroup< D > & | group, | ||
Basis< D > & | basis, | ||
FileMaster const & | fileMaster | ||
) |
Get and store addresses of associated objects.
mesh | associated spatial discretization Mesh<D> |
fft | associated FFT object for fast transforms |
lattice | lattice system type (enumeration value) |
groupName | space group name string |
group | associated SpaceGroup object |
basis | associated Basis object |
fileMaster | associated FileMaster (for file paths) |
Definition at line 56 of file pspc/field/FieldIo.tpp.
void Pscf::Pspc::FieldIo< D >::readFieldBasis | ( | std::istream & | in, |
DArray< double > & | field, | ||
UnitCell< D > & | unitCell | ||
) | const |
Read single concentration or chemical potential field from file.
This function reads the field in symmetry adapted basis format from input stream in.
in | input stream (i.e., input file) |
field | array to store the field (basis format) |
unitCell | associated crystallographic unit cell |
Definition at line 74 of file pspc/field/FieldIo.tpp.
References Util::DArray< Data >::allocate(), Util::Array< Data >::capacity(), Util::DArray< Data >::isAllocated(), and UTIL_CHECK.
void Pscf::Pspc::FieldIo< D >::readFieldBasis | ( | std::string | filename, |
DArray< double > & | field, | ||
UnitCell< D > & | unitCell | ||
) | const |
Read single concentration or chemical potential field from file.
This function opens an input file with the specified filename, reads field in symmetry adapted basis format from that file, and closes the file.
filename | name of input file |
field | array to store the field (basis format) |
unitCell | associated crystallographic unit cell |
Definition at line 90 of file pspc/field/FieldIo.tpp.
References Util::DArray< Data >::allocate(), Util::Array< Data >::capacity(), Util::DArray< Data >::isAllocated(), and UTIL_CHECK.
void Pscf::Pspc::FieldIo< D >::writeFieldBasis | ( | std::ostream & | out, |
DArray< double > const & | field, | ||
UnitCell< D > const & | unitCell | ||
) | const |
Write single concentration or chemical potential field to output stream out.
This function writes the field in symmetry adapted basis format.
out | output stream (i.e., output file) |
field | field to be written (symmetry adapted basis format) |
unitCell | associated crystallographic unit cell |
Definition at line 106 of file pspc/field/FieldIo.tpp.
References Util::DArray< Data >::allocate(), and Util::Array< Data >::capacity().
void Pscf::Pspc::FieldIo< D >::writeFieldBasis | ( | std::string | filename, |
DArray< double > const & | field, | ||
UnitCell< D > const & | unitCell | ||
) | const |
Write single concentration or chemical potential field to file.
This function opens an output file with the specified filename, writes the field in symmetry adapted basis format to that file, and closes the file.
filename | name of output file |
field | field to be written (symmetry adapted basis format) |
unitCell | associated crystallographic unit cell |
Definition at line 119 of file pspc/field/FieldIo.tpp.
References Util::DArray< Data >::allocate(), and Util::Array< Data >::capacity().
void Pscf::Pspc::FieldIo< D >::readFieldsBasis | ( | std::istream & | in, |
DArray< DArray< double > > & | fields, | ||
UnitCell< D > & | unitCell | ||
) | const |
Read concentration or chemical potential field components from file.
This function reads fields in a symmetry adapted basis from input stream in.
The capacity of DArray fields is equal to nMonomer, and element fields[i] is a DArray containing components of the field associated with monomer type i.
in | input stream (i.e., input file) |
fields | array of fields (symmetry adapted basis components) |
unitCell | associated crystallographic unit cell |
Definition at line 132 of file pspc/field/FieldIo.tpp.
References Util::DArray< Data >::allocate(), Pscf::Basis< D >::Star::basisId, Pscf::Basis< D >::Star::beginId, Pscf::Basis< D >::Star::cancel, Util::Log::file(), Pscf::Basis< D >::Star::invertFlag, Pscf::Vec< D, T >::negate(), Pscf::Pspc::FieldIo< D >::readFieldHeader(), Pscf::Basis< D >::Star::size, UTIL_CHECK, UTIL_THROW, and Pscf::Basis< D >::Star::waveBz.
void Pscf::Pspc::FieldIo< D >::readFieldsBasis | ( | std::string | filename, |
DArray< DArray< double > > & | fields, | ||
UnitCell< D > & | unitCell | ||
) | const |
Read concentration or chemical potential field components from file.
This function opens an input file with the specified filename, reads components in symmetry-adapted form from that file, and closes the file.
filename | name of input file |
fields | array of fields (symmetry adapted basis components) |
unitCell | associated crystallographic unit cell |
Definition at line 416 of file pspc/field/FieldIo.tpp.
void Pscf::Pspc::FieldIo< D >::writeFieldsBasis | ( | std::ostream & | out, |
DArray< DArray< double > > const & | fields, | ||
UnitCell< D > const & | unitCell | ||
) | const |
Write concentration or chemical potential field components to file.
This function writes components in a symmetry adapted basis.
out | output stream (i.e., output file) |
fields | array of fields (symmetry adapted basis components) |
unitCell | associated crystallographic unit cell |
Definition at line 430 of file pspc/field/FieldIo.tpp.
References UTIL_CHECK.
void Pscf::Pspc::FieldIo< D >::writeFieldsBasis | ( | std::string | filename, |
DArray< DArray< double > > const & | fields, | ||
UnitCell< D > const & | unitCell | ||
) | const |
Write concentration or chemical potential field components to file.
This function opens an output file with the specified filename, writes components in symmetry-adapted form to that file, and then closes the file.
filename | name of input file |
fields | array of fields (symmetry adapted basis components) |
unitCell | associated crystallographic unit cell |
Definition at line 466 of file pspc/field/FieldIo.tpp.
void Pscf::Pspc::FieldIo< D >::readFieldRGrid | ( | std::istream & | in, |
RField< D > & | field, | ||
UnitCell< D > & | unitCell | ||
) | const |
Read single RField (field on an r-space grid) from istream.
in | input stream (i.e., input file) |
field | fields defined on r-space grid |
unitCell | associated crystallographic unit cell |
Definition at line 715 of file pspc/field/FieldIo.tpp.
References Pscf::Pspc::RField< D >::allocate(), Pscf::MeshIterator< D >::atEnd(), Pscf::MeshIterator< D >::begin(), Util::Log::file(), Util::DArray< Data >::isAllocated(), Pscf::Pspc::RField< D >::meshDimensions(), Pscf::MeshIterator< D >::rank(), Pscf::Pspc::FieldIo< D >::readFieldHeader(), UTIL_CHECK, and UTIL_THROW.
void Pscf::Pspc::FieldIo< D >::readFieldRGrid | ( | std::string | filename, |
RField< D > & | field, | ||
UnitCell< D > & | unitCell | ||
) | const |
Read single RField (field on an r-space grid) from named file.
This function opens an input file with the specified filename, reads a field in RField<D> real-space grid format, and closes the file.
filename | name of input file |
field | fields defined on r-space grid |
unitCell | associated crystallographic unit cell |
Definition at line 820 of file pspc/field/FieldIo.tpp.
void Pscf::Pspc::FieldIo< D >::readFieldsRGrid | ( | std::istream & | in, |
DArray< RField< D > > & | fields, | ||
UnitCell< D > & | unitCell | ||
) | const |
Read array of RField objects (fields on r-space grid) from istream.
The capacity of array fields is equal to nMonomer, and element fields[i] is the RField<D> associated with monomer type i.
in | input stream (i.e., input file) |
fields | array of RField fields (r-space grid) |
unitCell | associated crystallographic unit cell |
Definition at line 478 of file pspc/field/FieldIo.tpp.
References Util::DArray< Data >::allocate(), Pscf::MeshIterator< D >::atEnd(), Pscf::MeshIterator< D >::begin(), Util::Log::file(), Pscf::MeshIterator< D >::rank(), Pscf::Pspc::FieldIo< D >::readFieldHeader(), UTIL_CHECK, and UTIL_THROW.
void Pscf::Pspc::FieldIo< D >::readFieldsRGrid | ( | std::string | filename, |
DArray< RField< D > > & | fields, | ||
UnitCell< D > & | unitCell | ||
) | const |
Read array of RField objects (fields on an r-space grid) from file.
The capacity of array fields is equal to nMonomer, and element fields[i] is the RField<D> associated with monomer type i.
This function opens an input file with the specified filename, reads fields in RField<D> real-space grid format from that file, and then closes the file.
filename | name of input file |
fields | array of RField fields (r-space grid) |
unitCell | associated crystallographic unit cell |
Definition at line 602 of file pspc/field/FieldIo.tpp.
void Pscf::Pspc::FieldIo< D >::writeFieldRGrid | ( | std::ostream & | out, |
RField< D > const & | field, | ||
UnitCell< D > const & | unitCell, | ||
bool | writeHeader = true |
||
) | const |
Write a single RField (field on an r-space grid) to ostream.
out | output stream |
field | field defined on r-space grid |
unitCell | associated crystallographic unit cell |
writeHeader | should a file header be written? |
Definition at line 832 of file pspc/field/FieldIo.tpp.
References Pscf::Pspc::RField< D >::allocate(), Pscf::MeshIterator< D >::atEnd(), Pscf::MeshIterator< D >::begin(), Util::Log::file(), and Pscf::MeshIterator< D >::rank().
void Pscf::Pspc::FieldIo< D >::writeFieldRGrid | ( | std::string | filename, |
RField< D > const & | field, | ||
UnitCell< D > const & | unitCell | ||
) | const |
Write a single RField (fields on an r-space grid) to a file.
This function opens an output file with the specified filename, write a field in RField<D> real-space grid format to that file, and then closes the file.
filename | name of output file |
field | field defined on r-space grid |
unitCell | associated crystallographic unit cell |
Definition at line 909 of file pspc/field/FieldIo.tpp.
void Pscf::Pspc::FieldIo< D >::writeFieldsRGrid | ( | std::ostream & | out, |
DArray< RField< D > > const & | fields, | ||
UnitCell< D > const & | unitCell | ||
) | const |
Write array of RField objects (fields on r-space grid) to ostream.
out | output stream (i.e., output file) |
fields | array of RField fields (r-space grid) |
unitCell | associated crystallographic unit cell |
Definition at line 614 of file pspc/field/FieldIo.tpp.
References Util::DArray< Data >::allocate(), Pscf::MeshIterator< D >::atEnd(), Pscf::MeshIterator< D >::begin(), Util::Log::file(), Pscf::MeshIterator< D >::rank(), and UTIL_CHECK.
void Pscf::Pspc::FieldIo< D >::writeFieldsRGrid | ( | std::string | filename, |
DArray< RField< D > > const & | fields, | ||
UnitCell< D > const & | unitCell | ||
) | const |
Write array of RField objects (fields on an r-space grid) to file.
This function opens an output file with the specified filename, writes fields in RField<D> real-space grid format to that file, and then closes the file.
filename | name of output file |
fields | array of RField fields (r-space grid) |
unitCell | associated crystallographic unit cell |
Definition at line 703 of file pspc/field/FieldIo.tpp.
void Pscf::Pspc::FieldIo< D >::readFieldsKGrid | ( | std::istream & | in, |
DArray< RFieldDft< D > > & | fields, | ||
UnitCell< D > & | unitCell | ||
) | const |
Read array of RFieldDft objects (k-space fields) from file.
The capacity of the array is equal to nMonomer, and element fields[i] is the discrete Fourier transform of the field for monomer type i.
in | input stream (i.e., input file) |
fields | array of RFieldDft fields (k-space grid) |
unitCell | associated crystallographic unit cell |
Definition at line 921 of file pspc/field/FieldIo.tpp.
References Pscf::MeshIterator< D >::atEnd(), Pscf::MeshIterator< D >::begin(), Pscf::MeshIterator< D >::rank(), Pscf::Pspc::FieldIo< D >::readFieldHeader(), UTIL_CHECK, and UTIL_THROW.
void Pscf::Pspc::FieldIo< D >::readFieldsKGrid | ( | std::string | filename, |
DArray< RFieldDft< D > > & | fields, | ||
UnitCell< D > & | unitCell | ||
) | const |
Read array of RFieldDft objects (k-space fields) from file.
This function opens a file with name filename, reads discrete Fourier components (Dft) of fields from that file, and closes the file.
The capacity of the array is equal to nMonomer, and element fields[i] is the discrete Fourier transform of the field for monomer type i.
filename | name of input file |
fields | array of RFieldDft fields (k-space grid) |
unitCell | associated crystallographic unit cell |
Definition at line 985 of file pspc/field/FieldIo.tpp.
void Pscf::Pspc::FieldIo< D >::writeFieldsKGrid | ( | std::ostream & | out, |
DArray< RFieldDft< D > > const & | fields, | ||
UnitCell< D > const & | unitCell | ||
) | const |
Write array of RFieldDft objects (k-space fields) to file.
The capacity of the array fields is equal to nMonomer. Element fields[i] is the discrete Fourier transform of the field for monomer type i.
out | output stream (i.e., output file) |
fields | array of RFieldDft fields |
unitCell | associated crystallographic unit cell |
Definition at line 997 of file pspc/field/FieldIo.tpp.
References Pscf::MeshIterator< D >::atEnd(), Pscf::MeshIterator< D >::begin(), Pscf::MeshIterator< D >::rank(), and UTIL_CHECK.
void Pscf::Pspc::FieldIo< D >::writeFieldsKGrid | ( | std::string | filename, |
DArray< RFieldDft< D > > const & | fields, | ||
UnitCell< D > const & | unitCell | ||
) | const |
Write array of RFieldDft objects (k-space fields) to a file.
This function opens a file with name filename, writes discrete Fourier transform components (DFT) components of fields to that file, and closes the file.
filename | name of output file. |
fields | array of RFieldDft fields (k-space grid) |
unitCell | associated crystallographic unit cell |
Definition at line 1031 of file pspc/field/FieldIo.tpp.
void Pscf::Pspc::FieldIo< D >::readFieldHeader | ( | std::istream & | in, |
int & | nMonomer, | ||
UnitCell< D > & | unitCell | ||
) | const |
Reader header of field file (fortran pscf format)
This reads the common part of the header for all field file formats. This contains the dimension of space, the unit cell, the group name and the the number of monomers. The unit cell data is read into the associated UnitCell<D>, which is thus updated.
If the associated basis is not initialized, this function will attempt to initialize it using the unit cell read from file and the associated group (if available) or group name.
This function throws an exception if the values of "dim" read from file do not match the FieldIo template parameter D.
The function does not impose any requirements on the value of the input parameter nMonomer; it is overwritten and will contain the value of "N_monomer" from the field file header at termination of the function.
If the UnitCell object passed to this function already contains unit cell data, the function will check to ensure that the crystal system and space group in the field file header match the data already stored. A warning will also be printed if the lattice parameters do not match. If, instead, the function is passed an empty UnitCell object, we assume that the UnitCell data is unknown or that the field file header does not need to be cross-checked with existing data. In this case, the field file header data is stored directly in the UnitCell object that was passed in.
in | input stream (i.e., input file) |
nMonomer | number of fields contained in the field file |
unitCell | associated crystallographic unit cell |
Definition at line 1047 of file pspc/field/FieldIo.tpp.
References Util::Log::file(), Pscf::UnitCellBase< D >::isInitialized(), Pscf::UnitCellBase< D >::nParameter(), UTIL_CHECK, and UTIL_THROW.
Referenced by Pscf::Pspc::FieldIo< D >::readFieldRGrid(), Pscf::Pspc::FieldIo< D >::readFieldsBasis(), Pscf::Pspc::FieldIo< D >::readFieldsKGrid(), and Pscf::Pspc::FieldIo< D >::readFieldsRGrid().
void Pscf::Pspc::FieldIo< D >::writeFieldHeader | ( | std::ostream & | out, |
int | nMonomer, | ||
UnitCell< D > const & | unitCell | ||
) | const |
Write header for field file (fortran pscf format)
out | output stream (i.e., output file) |
nMonomer | number of monomer types or fields |
unitCell | associated crystallographic unit cell |
Definition at line 1126 of file pspc/field/FieldIo.tpp.
void Pscf::Pspc::FieldIo< D >::convertBasisToKGrid | ( | DArray< double > const & | components, |
RFieldDft< D > & | dft | ||
) | const |
Convert a field from symmetrized basis to Fourier transform (k-grid).
components | coefficients of symmetry-adapted basis functions |
dft | discrete Fourier transform of a real field |
Definition at line 1137 of file pspc/field/FieldIo.tpp.
References Pscf::Basis< D >::Star::basisId, Pscf::Basis< D >::Star::beginId, Pscf::Basis< D >::Star::cancel, Pscf::Basis< D >::Wave::coeff, Pscf::Pspc::RFieldDft< D >::dftDimensions(), Pscf::Basis< D >::Wave::implicit, Pscf::Basis< D >::Wave::indicesDft, Pscf::Basis< D >::Star::invertFlag, Pscf::Mesh< D >::rank(), Pscf::Mesh< D >::size(), UTIL_CHECK, and UTIL_THROW.
void Pscf::Pspc::FieldIo< D >::convertBasisToKGrid | ( | DArray< DArray< double > > const & | in, |
DArray< RFieldDft< D > > & | out | ||
) | const |
Convert fields from symmetrized basis to Fourier transform (k-grid).
The in and out parameters are arrays of fields, in which element number i is the field associated with monomer type i.
in | fields expanded in symmetry-adapted Fourier basis |
out | fields defined as discrete Fourier transforms (k-grid) |
Definition at line 1359 of file pspc/field/FieldIo.tpp.
References UTIL_ASSERT.
void Pscf::Pspc::FieldIo< D >::convertKGridToBasis | ( | RFieldDft< D > const & | in, |
DArray< double > & | out, | ||
bool | checkSymmetry = true , |
||
double | epsilon = 1.0e-8 |
||
) | const |
Convert a field from Fourier transform (kgrid) to symmetrized basis.
If the checkSymmetry parameter is true, this function checks if the input field satisfies the space group symmetry to within a tolerance given by the epsilon parameter, and prints a warning to Log::file() if it does not.
in | discrete Fourier transform (k-grid) of a field |
out | components of field in asymmetry-adapted Fourier basis |
checkSymmetry | flag indicating whether to check symmetry |
epsilon | error tolerance for symmetry test (if any) |
Definition at line 1240 of file pspc/field/FieldIo.tpp.
References Pscf::Basis< D >::Star::basisId, Pscf::Basis< D >::Star::beginId, Pscf::Basis< D >::Star::cancel, Pscf::Basis< D >::Wave::coeff, Pscf::Pspc::RFieldDft< D >::dftDimensions(), Pscf::Basis< D >::Star::endId, Util::Log::file(), Pscf::Basis< D >::Wave::implicit, Pscf::Basis< D >::Wave::indicesDft, Pscf::Basis< D >::Star::invertFlag, Pscf::Mesh< D >::rank(), Pscf::Basis< D >::Wave::starId, UTIL_CHECK, and UTIL_THROW.
void Pscf::Pspc::FieldIo< D >::convertKGridToBasis | ( | DArray< RFieldDft< D > > const & | in, |
DArray< DArray< double > > & | out, | ||
bool | checkSymmetry = true , |
||
double | epsilon = 1.0e-8 |
||
) | const |
Convert fields from Fourier transform (k-grid) to symmetrized basis.
The in and out parameters are each an array of fields, in which element i is the field associated with monomer type i.
If the checkSymmetry parameter is true, this function checks if the input fields all satisfies the space group symmetry to within a tolerance given by the parameter epsilon, and prints a warning to Log::file() if one or more fields do not.
in | fields defined as discrete Fourier transforms (k-grid) |
out | components of fields in symmetry adapted basis |
checkSymmetry | flag indicate whether to check symmetry |
epsilon | error tolerance for symmetry test (if any) |
Definition at line 1370 of file pspc/field/FieldIo.tpp.
References Util::Log::file(), and UTIL_ASSERT.
void Pscf::Pspc::FieldIo< D >::convertBasisToRGrid | ( | DArray< double > const & | in, |
RField< D > & | out | ||
) | const |
Convert a field from symmetrized basis to spatial grid (r-grid).
in | field in symmetry adapted basis form |
out | field defined on real-space grid |
Definition at line 1403 of file pspc/field/FieldIo.tpp.
void Pscf::Pspc::FieldIo< D >::convertBasisToRGrid | ( | DArray< DArray< double > > const & | in, |
DArray< RField< D > > & | out | ||
) | const |
Convert fields from symmetrized basis to spatial grid (r-grid).
in | fields in symmetry adapted basis form |
out | fields defined on real-space grid |
Definition at line 1413 of file pspc/field/FieldIo.tpp.
References UTIL_ASSERT.
void Pscf::Pspc::FieldIo< D >::convertRGridToBasis | ( | RField< D > 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.
in | field defined on real-space grid |
out | field in symmetry adapted basis form |
checkSymmetry | boolean indicating whether to check that the symmetry of the input field matches the space group symmetry. If input does not have correct symmetry, prints warning to Log::file() |
epsilon | if checkSymmetry = true, epsilon is the error threshold used when comparing the k-grid and symmetry-adapted formats to determine whether field has the declared space group symmetry |
Definition at line 1428 of file pspc/field/FieldIo.tpp.
void Pscf::Pspc::FieldIo< D >::convertRGridToBasis | ( | DArray< RField< D > > const & | in, |
DArray< DArray< double > > & | out, | ||
bool | checkSymmetry = true , |
||
double | epsilon = 1.0e-8 |
||
) | const |
Convert fields from spatial grid (r-grid) to symmetrized basis.
in | fields defined on real-space grid |
out | fields in symmetry adapted basis form |
checkSymmetry | boolean indicating whether to check that the symmetry of the input field matches the space group symmetry. If input does not have correct symmetry, prints warning to Log::file() |
epsilon | if checkSymmetry = true, epsilon is the error threshold used when comparing the k-grid and symmetry-adapted formats to determine whether field has the declared space group symmetry |
Definition at line 1440 of file pspc/field/FieldIo.tpp.
References Util::Log::file(), and UTIL_ASSERT.
void Pscf::Pspc::FieldIo< D >::convertKGridToRGrid | ( | DArray< RFieldDft< D > > & | in, |
DArray< RField< D > > & | out | ||
) | const |
Convert fields from k-grid (DFT) to real space (r-grid) format.
This function simply calls the inverse FFT for an array of fields. The inverse FFT provided by the underlying FFTW library overwrites its input, which is why argument "in" not a const reference.
in | fields in discrete Fourier format (k-grid) |
out | fields defined on real-space grid (r-grid) |
Definition at line 1480 of file pspc/field/FieldIo.tpp.
References UTIL_ASSERT.
void Pscf::Pspc::FieldIo< D >::convertKGridToRGrid | ( | RFieldDft< D > & | in, |
RField< D > & | out | ||
) | const |
Convert a field from k-grid (DFT) to real space (r-grid) format.
This function simply calls the inverse FFT for a single field. The inverse FFT provided by the underlying FFTW library overwrites its input, which is why argument "in" not a const reference.
in | field in discrete Fourier format (k-grid) |
out | field defined on real-space grid (r-grid) |
Definition at line 1495 of file pspc/field/FieldIo.tpp.
void Pscf::Pspc::FieldIo< D >::convertRGridToKGrid | ( | DArray< RField< D > > const & | in, |
DArray< RFieldDft< D > > & | out | ||
) | const |
Convert fields from spatial grid (r-grid) to k-grid format.
in | fields defined on real-space grid (r-grid) |
out | fields in discrete Fourier format (k-grid) |
Definition at line 1505 of file pspc/field/FieldIo.tpp.
References UTIL_ASSERT.
void Pscf::Pspc::FieldIo< D >::convertRGridToKGrid | ( | RField< D > const & | in, |
RFieldDft< D > & | out | ||
) | const |
Convert a field from spatial grid (r-grid) to k-grid format.
in | field defined on real-space grid (r-grid) |
out | field in discrete Fourier format (k-grid) |
Definition at line 1520 of file pspc/field/FieldIo.tpp.
bool Pscf::Pspc::FieldIo< D >::hasSymmetry | ( | RField< D > const & | in, |
double | epsilon = 1.0e-8 , |
||
bool | verbose = true |
||
) | const |
Check if an r-grid field has the declared space group symmetry.
in | field in real space grid (r-grid) format |
epsilon | error threshold used when comparing the k-grid and symmetry-adapted formats to determine whether field has the declared space group symmetry. |
verbose | if field does not have symmetry and verbose = true, function will write error values to Log::file(). |
Definition at line 1532 of file pspc/field/FieldIo.tpp.
bool Pscf::Pspc::FieldIo< D >::hasSymmetry | ( | RFieldDft< D > const & | in, |
double | epsilon = 1.0e-8 , |
||
bool | verbose = true |
||
) | const |
Check if a k-grid field has declared space group symmetry.
in | field in real space grid (r-grid) format |
epsilon | error threshold used when comparing the k-grid and symmetry-adapted formats to determine whether field has the declared space group symmetry. |
verbose | if field does not have symmetry and verbose = true, function will write error values to Log::file(). |
Definition at line 1546 of file pspc/field/FieldIo.tpp.
References Pscf::Basis< D >::Star::beginId, Pscf::Basis< D >::Star::cancel, Pscf::Basis< D >::Wave::coeff, Pscf::Pspc::RFieldDft< D >::dftDimensions(), Pscf::Basis< D >::Star::endId, Util::Log::file(), Pscf::Basis< D >::Wave::implicit, Pscf::Basis< D >::Wave::indicesDft, Pscf::Mesh< D >::rank(), and UTIL_CHECK.