PSCF v1.2

Classes

class  Pscf::Prdc::FieldIoReal< D, RFRT, RFKT, FFTT >
 File input/output operations and format conversions for fields. More...
 
class  Pscf::Prdc::MaskTmpl< D, FieldIo, RField >
 Container for a field to which the total density is constrained. More...
 

Functions

template<int D, class FT >
void Pscf::Prdc::checkAllocateField (FT &field, IntVec< D > const &dimensions)
 Check allocation of a single field, allocate if necessary.
 
template<int D, class FT >
void Pscf::Prdc::checkAllocateFields (DArray< FT > &fields, int nMonomer, IntVec< D > const &dimensions)
 Check allocation of an array of fields, allocate if necessary.
 
template<int D, class FT >
void Pscf::Prdc::inspectFields (DArray< FT > const &fields, int &nMonomer, IntVec< D > &dimensions)
 Inspect dimensions of a DArray of fields, each of type FT.
 
template<int D, class AT >
void Pscf::Prdc::checkAllocateArrays (DArray< AT > &arrays, int nMonomer, int capacity)
 Check allocation of a DArray of 1D arrays, allocate if necessary.
 
template<class AT >
void Pscf::Prdc::inspectArrays (DArray< AT > const &arrays, int &nMonomer, int &capacity)
 Inspect dimensions of a DArray of 1D arrays, each of type AT.
 
template<int D>
void Pscf::Prdc::readMeshDimensions (std::istream &in, IntVec< D > const &meshDimensions)
 Read mesh dimensions from a field file header.
 
template<int D>
void Pscf::Prdc::writeMeshDimensions (std::ostream &out, IntVec< D > const &meshDimensions)
 Write mesh dimensions to a field file header.
 
template<int D, class AT >
void Pscf::Prdc::readRGridData (std::istream &in, DArray< AT > &fields, int nMonomer, IntVec< D > const &dimensions)
 Read data for array of r-grid fields, with no header section.
 
template<int D, class AT >
void Pscf::Prdc::readRGridData (std::istream &in, AT &field, IntVec< D > const &dimensions)
 Read data for a single r-grid field, with no header section.
 
template<int D, class AT >
void Pscf::Prdc::writeRGridData (std::ostream &out, DArray< AT > const &fields, int nMonomer, IntVec< D > const &dimensions)
 Write data for array of r-grid fields, with no header section.
 
template<int D, class AT >
void Pscf::Prdc::writeRGridData (std::ostream &out, AT const &field, IntVec< D > const &dimensions)
 Write data for a single r-grid field, with no header section.
 
template<int D, class AT >
void Pscf::Prdc::readKGridData (std::istream &in, DArray< AT > &fields, int nMonomer, IntVec< D > const &dftDimensions)
 Read data for array of k-grid fields, with no header section.
 
template<int D, class AT >
void Pscf::Prdc::readKGridData (std::istream &in, AT &field, IntVec< D > const &dftDimensions)
 Read data for a single k-grid field, with no header section.
 
template<int D, class AT >
void Pscf::Prdc::writeKGridData (std::ostream &out, DArray< AT > const &fields, int nMonomer, IntVec< D > const &dftDimensions)
 Write data for array of k-grid fields, with no header section.
 
template<int D, class AT >
void Pscf::Prdc::writeKGridData (std::ostream &in, AT const &field, IntVec< D > const &dftDimensions)
 Write data for a single k-grid field, with no header section.
 
int Pscf::Prdc::readNBasis (std::istream &in)
 Read the number of basis functions from a basis field file header.
 
void Pscf::Prdc::writeNBasis (std::ostream &out, int nBasis)
 Write the number of basis functions to a basis field file header.
 
template<int D>
void Pscf::Prdc::readBasisData (std::istream &in, DArray< DArray< double > > &fields, UnitCell< D > const &unitCell, Mesh< D > const &mesh, Basis< D > const &basis, int nStarIn)
 Read a set of fields in basis format.
 
template<int D>
void Pscf::Prdc::writeBasisData (std::ostream &out, DArray< DArray< double > > const &fields, Basis< D > const &basis)
 Write array of fields in basis format, without a header.
 
template<int D, class AT >
void Pscf::Prdc::convertBasisToKGrid (DArray< double > const &components, AT &dft, Basis< D > const &basis, IntVec< D > const &dftDimensions)
 Convert a real field from symmetrized basis to Fourier grid.
 
template<int D, class AT >
void Pscf::Prdc::convertKGridToBasis (AT const &in, DArray< double > &out, Basis< D > const &basis, IntVec< D > const &dftDimensions, bool checkSymmetry=true, double epsilon=1.0e-8)
 Convert a real field from Fourier grid to symmetrized basis.
 
template<int D, class AT >
bool Pscf::Prdc::hasSymmetry (AT const &in, Basis< D > const &basis, IntVec< D > const &dftDimensions, double epsilon=1.0e-8, bool verbose=true)
 Check if a k-grid field has the declared space group symmetry.
 
template<int D, class AT >
void Pscf::Prdc::replicateUnitCell (std::ostream &out, DArray< AT > const &fields, IntVec< D > const &meshDimensions, UnitCell< D > const &unitCell, IntVec< D > const &replicas)
 Write r-grid fields in a replicated unit cell to std::ostream.
 
template<int D, class AT >
void Pscf::Prdc::expandRGridDimension (std::ostream &out, DArray< AT > const &fields, IntVec< D > const &meshDimensions, UnitCell< D > const &unitCell, int d, DArray< int > newGridDimensions)
 Expand the dimensionality of space from D to d.
 

Detailed Description

Utilities for field IO operations.

Function Documentation

◆ checkAllocateField()

template<int D, class FT >
void Pscf::Prdc::checkAllocateField ( FT & field,
IntVec< D > const & dimensions )

Check allocation of a single field, allocate if necessary.

Template parameter FT is a field type, such as RField<D> or RFieldDft<D>, that has an allocate function that takes an IntVec<D> of mesh dimensions, and a dimensions function that returns an IntVec<D> of mesh dimensions.

On successful exit, the mesh dimensions for the field are equal to those given in parameter meshDimensions.

If the field is allocated on entry, the above condition is checked, and an Exception is thrown if is violated. If the fields is not allocated on entry, it is allocated with the correct dimensions.

Parameters
fieldfield object of type FT
dimensionsrequired mesh dimensions

Definition at line 37 of file fieldIoUtil.tpp.

References UTIL_CHECK.

Referenced by Pscf::Prdc::FieldIoReal< D, RFRT, RFKT, FFTT >::convertBasisToRGrid(), Pscf::Prdc::FieldIoReal< D, RFRT, RFKT, FFTT >::convertRGridToBasis(), Pscf::Prdc::FieldIoReal< D, RFRT, RFKT, FFTT >::hasSymmetry(), Pscf::Rpc::FieldIo< D >::readFieldRGrid(), Pscf::Rpg::FieldIo< D >::readFieldRGrid(), and Pscf::Prdc::FieldIoReal< D, RField< D >, RFieldDft< D >, FFT< D > >::readFieldsRGrid().

◆ checkAllocateFields()

template<int D, class FT >
void Pscf::Prdc::checkAllocateFields ( DArray< FT > & fields,
int nMonomer,
IntVec< D > const & dimensions )

Check allocation of an array of fields, allocate if necessary.

Template parameter FT is a field type, such as RField<D> or RFieldDft<D>, that has an allocate function that takes an IntVec<D> of mesh dimensions, and a dimensions function that returns an IntVec<D> of mesh dimensions.

On successful exit, the capacity of the DArray fields is equal to nMonomer, and the mesh dimensions for each field are equal to those given in parameter meshDimensions.

If the fields array is allocated on entry, the above conditions are checked, and an Exception is thrown if any are not met. If the arrray is not allocated on entry, it is allocated with the required dimensions.

Parameters
fieldsDArray of fields of type FT (in/out)
nMonomerrequired number of monomer types (in)
dimensionsrequired mesh dimensions (in)

Definition at line 51 of file fieldIoUtil.tpp.

References Util::DArray< T >::allocate(), Util::Array< Data >::capacity(), Util::DArray< T >::isAllocated(), and UTIL_CHECK.

Referenced by Pscf::Rpc::FieldIo< D >::readFieldsKGrid(), Pscf::Rpg::FieldIo< D >::readFieldsKGrid(), Pscf::Rpc::FieldIo< D >::readFieldsRGrid(), Pscf::Rpg::FieldIo< D >::readFieldsRGrid(), Pscf::Rpc::FieldIo< D >::readFieldsRGridData(), and Pscf::Rpg::FieldIo< D >::readFieldsRGridData().

◆ inspectFields()

template<int D, class FT >
void Pscf::Prdc::inspectFields ( DArray< FT > const & fields,
int & nMonomer,
IntVec< D > & dimensions )

Inspect dimensions of a DArray of fields, each of type FT.

Template parameter AT is an allocatable array type, such as Util::DArray<double> or Pscf::HostDArray<double>, that has an allocate function that takes an integer capacity as its only parameter.

An Exception is thrown if fields is not allocated, or if the fields do not all have the same positive list of dimensions.

Parameters
fieldsDArray of fields (in)
nMonomernumber of fields, or monomer types (out)
dimensionsdimensions mesh for each field (out)

Definition at line 74 of file fieldIoUtil.tpp.

References Util::Array< Data >::capacity(), Util::DArray< T >::isAllocated(), and UTIL_CHECK.

Referenced by Pscf::Prdc::FieldIoReal< D, RFRT, RFKT, FFTT >::convertKGridToBasis(), Pscf::Prdc::FieldIoReal< D, RFRT, RFKT, FFTT >::convertRGridToBasis(), Pscf::Rpg::FieldIo< D >::expandRGridDimension(), Pscf::Rpc::FieldIo< D >::replicateUnitCell(), Pscf::Rpg::FieldIo< D >::replicateUnitCell(), Pscf::Prdc::FieldIoReal< D, RField< D >, RFieldDft< D >, FFT< D > >::writeFieldsBasis(), Pscf::Rpc::FieldIo< D >::writeFieldsKGrid(), Pscf::Rpg::FieldIo< D >::writeFieldsKGrid(), Pscf::Rpc::FieldIo< D >::writeFieldsRGrid(), and Pscf::Rpg::FieldIo< D >::writeFieldsRGrid().

◆ checkAllocateArrays()

template<int D, class AT >
void Pscf::Prdc::checkAllocateArrays ( DArray< AT > & arrays,
int nMonomer,
int capacity )

Check allocation of a DArray of 1D arrays, allocate if necessary.

Template parameter AT is an allocatable array type, such as Util::DArray<double> or Pscf::HostDArray<double>, that has an allocate function that takes an integer capacity as its only parameter.

On successful exit, the capacity of the arrays container is equal to the parameter nMonomer, and the capacity for each element of type AT is equal to the parameter capacity.

If the container arrays is allocated on entry, the above conditions are checked, and an Exception is thrown if any are violated. If arrays is not allocated on entry, it is allocated with the required dimensions.

Parameters
arraysDArray of arrays, each of type AT (in/out)
nMonomerrequired number of arrays, or monomer types (in)
capacityrequired capacity of each array (in)

◆ inspectArrays()

template<class AT >
void Pscf::Prdc::inspectArrays ( DArray< AT > const & arrays,
int & nMonomer,
int & capacity )

Inspect dimensions of a DArray of 1D arrays, each of type AT.

An Exception is thrown if the arrays container is not allocated, or if the 1D arrays do not all have the same positive capacity.

Parameters
arraysDArray of arrays (in)
nMonomernumber of arrays, or monomer types (out)
capacitycapacity of each array (out)

Definition at line 115 of file fieldIoUtil.tpp.

References Util::Array< Data >::capacity(), Util::DArray< T >::isAllocated(), and UTIL_CHECK.

Referenced by Pscf::Prdc::FieldIoReal< D, RFRT, RFKT, FFTT >::convertKGridToBasis(), Pscf::Prdc::FieldIoReal< D, RFRT, RFKT, FFTT >::convertRGridToBasis(), Pscf::Prdc::FieldIoReal< D, RField< D >, RFieldDft< D >, FFT< D > >::setFileMaster(), Pscf::Prdc::FieldIoReal< D, RFRT, RFKT, FFTT >::writeFieldsBasis(), and Pscf::Prdc::FieldIoReal< D, RField< D >, RFieldDft< D >, FFT< D > >::writeFieldsBasis().

◆ readMeshDimensions()

template<int D>
void Pscf::Prdc::readMeshDimensions ( std::istream & in,
IntVec< D > const & meshDimensions )

Read mesh dimensions from a field file header.

An Exception is thrown if the mesh dimensions in the file do not match those given by the input vector meshDimensions.

Parameters
ininput stream
meshDimensionsexpected values for mesh dimensions

Definition at line 133 of file fieldIoUtil.tpp.

References Util::Log::file(), and UTIL_THROW.

Referenced by Pscf::Rpc::FieldIo< D >::readFieldRGrid(), Pscf::Rpg::FieldIo< D >::readFieldRGrid(), Pscf::Rpc::FieldIo< D >::readFieldsKGrid(), Pscf::Rpg::FieldIo< D >::readFieldsKGrid(), Pscf::Rpc::FieldIo< D >::readFieldsRGrid(), and Pscf::Rpg::FieldIo< D >::readFieldsRGrid().

◆ writeMeshDimensions()

template<int D>
void Pscf::Prdc::writeMeshDimensions ( std::ostream & out,
IntVec< D > const & meshDimensions )

Write mesh dimensions to a field file header.

Parameters
outoutput stream
meshDimensionsvector of integer mesh dimensions

Definition at line 159 of file fieldIoUtil.tpp.

Referenced by Pscf::Rpc::FieldIo< D >::writeFieldRGrid(), Pscf::Rpg::FieldIo< D >::writeFieldRGrid(), Pscf::Rpc::FieldIo< D >::writeFieldsKGrid(), Pscf::Rpg::FieldIo< D >::writeFieldsKGrid(), Pscf::Rpc::FieldIo< D >::writeFieldsRGrid(), and Pscf::Rpg::FieldIo< D >::writeFieldsRGrid().

◆ readRGridData() [1/2]

template<int D, class AT >
void Pscf::Prdc::readRGridData ( std::istream & in,
DArray< AT > & fields,
int nMonomer,
IntVec< D > const & dimensions )

Read data for array of r-grid fields, with no header section.

This function reads the data section of the rgrid-field format for multiple monomer types, with no header.

The template parameter AT must be an array type that provides an overloaded [] subscript operator.

Parameters
ininput file stream
fieldsarray of r-grid fields (r-space grid) (out)
nMonomernumber of monomer types (in)
dimensionsvector of mesh dimensions (in)

Referenced by Pscf::Rpc::FieldIo< D >::readFieldRGrid(), Pscf::Rpg::FieldIo< D >::readFieldRGrid(), Pscf::Rpc::FieldIo< D >::readFieldsRGrid(), Pscf::Rpg::FieldIo< D >::readFieldsRGrid(), Pscf::Rpc::FieldIo< D >::readFieldsRGridData(), and Pscf::Rpg::FieldIo< D >::readFieldsRGridData().

◆ readRGridData() [2/2]

template<int D, class AT >
void Pscf::Prdc::readRGridData ( std::istream & in,
AT & field,
IntVec< D > const & dimensions )

Read data for a single r-grid field, with no header section.

This function reads the data section of an rgrid-field format for a single monomer type, with no header.

The template parameter AT must be an array type that provides an overloaded [] subscript operator.

Parameters
ininput file stream
fieldarray containing a single r-grid field (out)
dimensionsvector of mesh dimensions (in)

◆ writeRGridData() [1/2]

template<int D, class AT >
void Pscf::Prdc::writeRGridData ( std::ostream & out,
DArray< AT > const & fields,
int nMonomer,
IntVec< D > const & dimensions )

Write data for array of r-grid fields, with no header section.

This function writes the data section of the rgrid-field format for a multiple monomer types, with no header section.

The template parameter AT must be an array type that provides an overloaded [] subscript operator.

Parameters
outoutput file stream
fieldsarray of r-grid fields (r-space grid) (in)
nMonomernumber of monomer types (in)
dimensionsvector of mesh dimensions (in)

Referenced by Pscf::Rpc::FieldIo< D >::writeFieldRGrid(), Pscf::Rpg::FieldIo< D >::writeFieldRGrid(), Pscf::Rpc::FieldIo< D >::writeFieldsRGrid(), and Pscf::Rpg::FieldIo< D >::writeFieldsRGrid().

◆ writeRGridData() [2/2]

template<int D, class AT >
void Pscf::Prdc::writeRGridData ( std::ostream & out,
AT const & field,
IntVec< D > const & dimensions )

Write data for a single r-grid field, with no header section.

This function writes the data section of an rgrid-field format for a single monomer type, with no header.

The template parameter AT must be an array type that provides an overloaded [] subscript operator.

Parameters
outoutput file stream
fieldarray containing a single r-grid field (out)
dimensionsvector of mesh dimensions

◆ readKGridData() [1/2]

template<int D, class AT >
void Pscf::Prdc::readKGridData ( std::istream & in,
DArray< AT > & fields,
int nMonomer,
IntVec< D > const & dftDimensions )

Read data for array of k-grid fields, with no header section.

This function reads the data section of the kgrid-field format for multiple monomer types, with no header.

The template parameter AT must be an array type that provides an overloaded [] subscript operator.

Parameters
ininput file stream
fieldsarray of k-grid fields (r-space grid) (out)
nMonomernumber of monomer types (in)
dftDimensionsdimensions of real DFT mesh (in)

Referenced by Pscf::Rpc::FieldIo< D >::readFieldsKGrid(), and Pscf::Rpg::FieldIo< D >::readFieldsKGrid().

◆ readKGridData() [2/2]

template<int D, class AT >
void Pscf::Prdc::readKGridData ( std::istream & in,
AT & field,
IntVec< D > const & dftDimensions )

Read data for a single k-grid field, with no header section.

This function reads the data section of an kgrid-field format for a single monomer type, with no header.

The template parameter AT must be an array type that provides an overloaded [] subscript operator.

Parameters
ininput file stream
fieldarray containing a single k-grid field (out)
dftDimensionsdimensions of real DFT mesh (in)

◆ writeKGridData() [1/2]

template<int D, class AT >
void Pscf::Prdc::writeKGridData ( std::ostream & out,
DArray< AT > const & fields,
int nMonomer,
IntVec< D > const & dftDimensions )

Write data for array of k-grid fields, with no header section.

This function writes the data section of a k-grid field file for a a multiple monomer type, with no header section.

The template parameter AT must be an array type that provides an overloaded [] subscript operator.

Parameters
outoutput file stream
fieldsarray of k-grid fields (r-space grid) (in)
nMonomernumber of monomer types (in)
dftDimensionsdimensions of real DFT mesh (in)

Referenced by Pscf::Rpc::FieldIo< D >::writeFieldsKGrid(), and Pscf::Rpg::FieldIo< D >::writeFieldsKGrid().

◆ writeKGridData() [2/2]

template<int D, class AT >
void Pscf::Prdc::writeKGridData ( std::ostream & in,
AT const & field,
IntVec< D > const & dftDimensions )

Write data for a single k-grid field, with no header section.

This function writes the data section of a k-grid field file for a single monomer type, with no header.

The template parameter AT must be an array type that provides an overloaded [] subscript operator.

Parameters
ininput file stream
fieldarray containing a single k-grid field (in)
dftDimensionsdimensions of real DFT mesh (in)

◆ readNBasis()

int Pscf::Prdc::readNBasis ( std::istream & in)

Read the number of basis functions from a basis field file header.

Parameters
ininput stream
Returns
value of nBasis obtained from the file

Definition at line 352 of file fieldIoUtil.tpp.

References UTIL_CHECK, and UTIL_THROW.

Referenced by Pscf::Prdc::FieldIoReal< D, RField< D >, RFieldDft< D >, FFT< D > >::setFileMaster().

◆ writeNBasis()

void Pscf::Prdc::writeNBasis ( std::ostream & out,
int nBasis )

Write the number of basis functions to a basis field file header.

Parameters
outoutput stream
nBasisnumber of basis functions

Definition at line 378 of file fieldIoUtil.tpp.

◆ readBasisData()

template<int D>
void Pscf::Prdc::readBasisData ( std::istream & in,
DArray< DArray< double > > & fields,
UnitCell< D > const & unitCell,
Mesh< D > const & mesh,
Basis< D > const & basis,
int nStarIn )

Read a set of fields in basis format.

The field header should be read before calling this function to obtain the number of basis functions in the input file, which is passed to this function as parameter nStarIn.

On input, the capacity of the fields array must equal the number of monomer types represented by data columns in the input file. The DArray<double> arrays associated with different monomer types must all of the same nonzero capacity, denoted by fieldCapacity. The number of basis functions that are processes is the smallar of nStarIn (the number available in the file) and fieldCapacity (the number for which there is room in the arrays).

Parameters
ininput file stream
fieldsarray of field components
unitCellassociated crystallographic unit cell
meshassociated computational mesh
basisassociated symmetry adapted basis
nStarInnumber of stars declared in headers

Definition at line 388 of file fieldIoUtil.tpp.

References Util::DArray< T >::allocate(), Pscf::Prdc::Basis< D >::Star::basisId, Pscf::Prdc::Basis< D >::Star::beginId, Pscf::Prdc::Basis< D >::Star::cancel, Util::Array< Data >::capacity(), Pscf::Prdc::Basis< D >::Wave::coeff, Pscf::Mesh< D >::dimensions(), Util::Log::file(), Pscf::imag(), Pscf::Prdc::Basis< D >::Star::invertFlag, Util::DArray< T >::isAllocated(), Pscf::Prdc::Basis< D >::isInitialized(), Pscf::Vec< D, T >::negate(), Pscf::real(), Pscf::Mesh< D >::shift(), Pscf::Prdc::Basis< D >::Star::size, Pscf::Prdc::Basis< D >::star(), Pscf::Prdc::Basis< D >::Wave::starId, UTIL_CHECK, UTIL_THROW, Pscf::Prdc::Basis< D >::wave(), Pscf::Prdc::Basis< D >::Star::waveBz, and Pscf::Prdc::Basis< D >::waveId().

◆ writeBasisData()

template<int D>
void Pscf::Prdc::writeBasisData ( std::ostream & out,
DArray< DArray< double > > const & fields,
Basis< D > const & basis )

Write array of fields in basis format, without a header.

The number of monomer types is given by the capacity of the fields array. On entry, the DArray<double> arrays associated with different monomer types must all of the same nonzero capacity, denoted by fieldCapacity. The number of basis functions written is the lesser fieldCapacity and the number of uncancelled basis functions in the basis.

Parameters
outoutput file stream
fieldsarray of field components
basisassociated symmetry adapted basis

Definition at line 639 of file fieldIoUtil.tpp.

References Pscf::Prdc::Basis< D >::Star::cancel, Util::Array< Data >::capacity(), Pscf::Prdc::Basis< D >::isInitialized(), Pscf::Prdc::Basis< D >::nStar(), Pscf::Prdc::Basis< D >::Star::size, Pscf::Prdc::Basis< D >::star(), UTIL_CHECK, and Pscf::Prdc::Basis< D >::Star::waveBz.

◆ convertBasisToKGrid()

template<int D, class AT >
void Pscf::Prdc::convertBasisToKGrid ( DArray< double > const & components,
AT & dft,
Basis< D > const & basis,
IntVec< D > const & dftDimensions )

Convert a real field from symmetrized basis to Fourier grid.

Parameters
componentscoefficients of symmetry-adapted basis functions
dftdiscrete Fourier transform of a real field
basisassociated symmetry adapted basis (in)
dftDimensionsdimensions of real DFT mesh (in)

Referenced by Pscf::Rpc::FieldIo< D >::convertBasisToKGrid(), Pscf::Rpg::FieldIo< D >::convertBasisToKGrid(), Pscf::Prdc::FieldIoReal< D, RField< D >, RFieldDft< D >, FFT< D > >::readFieldsRGrid(), and Pscf::Prdc::FieldIoReal< D, RField< D >, RFieldDft< D >, FFT< D > >::writeFieldsBasis().

◆ convertKGridToBasis()

template<int D, class AT >
void Pscf::Prdc::convertKGridToBasis ( AT const & in,
DArray< double > & out,
Basis< D > const & basis,
IntVec< D > const & dftDimensions,
bool checkSymmetry = true,
double epsilon = 1.0e-8 )

Convert a real field from Fourier grid 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.

Parameters
indiscrete Fourier transform (k-grid) of a field
outcomponents of field in asymmetry-adapted Fourier basis
basisassociated symmetry adapted basis (in)
dftDimensionsdimensions of real DFT mesh (in)
checkSymmetryflag indicating whether to check symmetry
epsilonerror tolerance for symmetry test (if any)

Referenced by Pscf::Prdc::FieldIoReal< D, RFRT, RFKT, FFTT >::convertKGridToBasis(), Pscf::Rpc::FieldIo< D >::convertKGridToBasis(), Pscf::Rpg::FieldIo< D >::convertKGridToBasis(), and Pscf::Prdc::FieldIoReal< D, RFRT, RFKT, FFTT >::convertRGridToBasis().

◆ hasSymmetry()

template<int D, class AT >
bool Pscf::Prdc::hasSymmetry ( AT const & in,
Basis< D > const & basis,
IntVec< D > const & dftDimensions,
double epsilon = 1.0e-8,
bool verbose = true )

Check if a k-grid field has the declared space group symmetry.

This function checks whether the discrete Fourier transform of a real field satisfies all the symmetries of a space group to within an error threshhold given by parameter epsilon. If the parameter verbose is true and the deviation from symmetry exceeds the error threshhold, errors are written to Log::file().

Parameters
infield in real space grid (r-grid) format
basisassociated symmetry adapted basis
dftDimensionsdimensions of real DFT mesh
epsilonerror threshold used to test for symmetry
verboseif true, write error to Log::file()
Returns
true if the field is symmetric, false otherwise

Referenced by Pscf::Prdc::FieldIoReal< D, RFRT, RFKT, FFTT >::hasSymmetry(), Pscf::Rpc::FieldIo< D >::hasSymmetry(), Pscf::Rpg::FieldIo< D >::hasSymmetry(), Pscf::Rpc::System< D >::readCommands(), Pscf::Rpg::System< D >::readCommands(), Pscf::Rpc::RGridTrajectoryReader< D >::readHeader(), and Pscf::Rpg::TrajectoryWriter< D >::writeHeader().

◆ replicateUnitCell()

template<int D, class AT >
void Pscf::Prdc::replicateUnitCell ( std::ostream & out,
DArray< AT > const & fields,
IntVec< D > const & meshDimensions,
UnitCell< D > const & unitCell,
IntVec< D > const & replicas )

Write r-grid fields in a replicated unit cell to std::ostream.

This function takes an input array of periodic fields and outputs them within an expanded unit cell in which the original input unit cell has been replicated a specified number of times in each direction. Results are written to an std::ostream output stream.

Element i of the IntVec<D> parameter named "replicas" contains the number of unit cell replicas along direction i.

Parameters
outoutput stream (i.e., output file)
fieldsarray of RField (r-space) fields to be replicated
meshDimensionsdimensions of original mesh for fields
unitCelloriginal crystallographic unit cell
replicasnumber of unit cell replicas in each direction

Referenced by Pscf::Prdc::FieldIoReal< D, RField< D >, RFieldDft< D >, FFT< D > >::convertBasisToRGrid(), Pscf::Rpc::System< D >::readCommands(), Pscf::Rpg::System< D >::readCommands(), Pscf::Rpc::FieldIo< D >::replicateUnitCell(), and Pscf::Rpg::FieldIo< D >::replicateUnitCell().

◆ expandRGridDimension()

template<int D, class AT >
void Pscf::Prdc::expandRGridDimension ( std::ostream & out,
DArray< AT > const & fields,
IntVec< D > const & meshDimensions,
UnitCell< D > const & unitCell,
int d,
DArray< int > newGridDimensions )

Expand the dimensionality of space from D to d.

The functions takes a list of fields defined in a D dimensional unit cell and creates and writes a set of fields in a d dimensional unit cell, for D < d <= 3, by adding (d-D) additional Bravais lattice vectors along directions orthogonal to the original D lattice vectors. The output fields, which are defined on a d dimensional mesh are taken to be independent of the coordinates associated with these d-D added directions. The resulting d dimensional fields are written to an output stream in r-grid field file format.

For example, this can be used to take a SCFT solution for a 1D lamellar structure and generate a corresponding 1D solution in 2D or 3D space. Similarly, a 2D hexagonal SCFT solution can be used to generate a hexagonal solution in 3D space.

The DArray<int> parameter newGridDimensions must have a capacity d-D, and each element contains the number of grid points in one added direction. The spacing between grid points in the added directions is taken to be the same as that associated with the first Bravais lattice vector of the D dimensional unit cell of the input fields.

Parameters
outoutput stream
fieldsinput fields defined on a D dimensional grid
meshDimensionsdimensions of mesh for input fields
unitCellunit cell for input fields
ddimensionality of expanded space (d > D)
newGridDimensionsnumbers of grid points in added directions

Referenced by Pscf::Prdc::FieldIoReal< D, RFRT, RFKT, FFTT >::expandRGridDimension(), Pscf::Rpc::FieldIo< D >::expandRGridDimension(), Pscf::Rpg::FieldIo< D >::expandRGridDimension(), Pscf::Rpc::System< D >::readCommands(), and Pscf::Rpg::System< D >::readCommands().