PSCF v1.3
|
Class to calculate and store properties of wavevectors. More...
#include <WaveList.h>
Public Member Functions | |
WaveList (bool isRealField=true) | |
Constructor. | |
~WaveList () | |
Destructor. | |
void | allocate (Mesh< D > const &m, UnitCell< D > const &c) |
Allocate memory and set association with a Mesh and UnitCell object. | |
void | clearUnitCellData () |
Clear all internal data that depends on lattice parameters. | |
void | computeMinimumImages () |
Compute minimum images of wavevectors. | |
void | computeKSq () |
Compute sq. | |
void | computedKSq () |
Compute derivatives of |k|^2 w/ respect to unit cell parameters. | |
DArray< IntVec< D > > const & | minImages () const |
Get the array of minimum image vectors by const reference. | |
RField< D > const & | kSq () const |
Get the kSq array on the device by const reference. | |
RField< D > const & | dKSq (int i) const |
Get derivatives of kSq with respect to unit cell parameter i. | |
DArray< RField< D > > const & | dKSq () const |
Get all derivatives of kSq with respect to unit cell parameters. | |
DArray< bool > const & | implicitInverse () const |
Get the implicitInverse array by reference. | |
bool | isAllocated () const |
Has memory been allocated for arrays? | |
bool | hasMinImages () const |
Have minimum images been computed? | |
bool | hasKSq () const |
Has the kSq array been computed? | |
bool | hasdKSq () const |
Has the dKSq array been computed? | |
bool | isRealField () const |
Does this WaveList correspond to real-valued fields? |
Class to calculate and store properties of wavevectors.
In particular, minimum images, square norms of wavevectors (kSq), and derivatives of the square norms of wavevectors with respect to the lattice parameters (dKSq) are calculated and stored by this class.
Any time the lattice parameters change the clearUnitCellData() method should be called, which will effectively reset the WaveList object so that the wavevector properties will need to be recalculated before being used.
This object calculates these wavevector properties for a mesh of grid points in k-space. If a calculation only requires real-valued fields, PSCF uses a reduced-size k-space mesh, as output by FFTW. However, a full-sized k-space mesh (the same size as the real-space mesh) is necessary when dealing with complex-valued fields. The k-space mesh used by a WaveList object is determined by the parameter isRealField, which is assigned in the constructor and cannot later be changed.
Definition at line 46 of file cpu/WaveList.h.
Pscf::Prdc::Cuda::WaveList< D >::WaveList | ( | bool | isRealField = true | ) |
Constructor.
isRealField | Will this WaveList be used for real-valued fields? |
Definition at line 29 of file cpu/WaveList.tpp.
References isRealField().
Pscf::Prdc::Cuda::WaveList< D >::~WaveList | ( | ) |
Destructor.
Definition at line 43 of file cpu/WaveList.tpp.
void Pscf::Prdc::Cuda::WaveList< D >::allocate | ( | Mesh< D > const & | m, |
UnitCell< D > const & | c ) |
Allocate memory and set association with a Mesh and UnitCell object.
m | spatial discretization mesh (input) |
c | crystallographic unit cell (input) |
Definition at line 50 of file cpu/WaveList.tpp.
References Pscf::MeshIterator< D >::atEnd(), Pscf::MeshIterator< D >::begin(), clearUnitCellData(), Pscf::Prdc::Cpu::FFT< D >::computeKMesh(), Pscf::Prdc::Cpu::FFT< D >::hasImplicitInverse(), Pscf::Prdc::UnitCellBase< D >::nParameter(), Pscf::MeshIterator< D >::position(), Pscf::MeshIterator< D >::rank(), Pscf::Mesh< D >::size(), and UTIL_CHECK.
void Pscf::Prdc::Cuda::WaveList< D >::clearUnitCellData | ( | ) |
Clear all internal data that depends on lattice parameters.
Sets hasKSq_ and hasdKSq_ to false. Sets hasMinImages_ to false only if the unit cell type has variable angles.
Definition at line 103 of file cpu/WaveList.tpp.
References Pscf::Prdc::hasVariableAngle().
Referenced by allocate().
void Pscf::Prdc::Cuda::WaveList< D >::computeMinimumImages | ( | ) |
Compute minimum images of wavevectors.
(Also calculates kSq.)
The minimum images may change if a lattice angle in the unit cell is changed, so this method should be called whenever such changes occur.
In the process of computing the minimum images, the square norm |k|^2 for all wavevectors is also calculated and stored, so it is not necessary to call computeKSq after calling this method. computeKSq is provided to allow calculation of kSq without recalculating minimum images.
Definition at line 116 of file cpu/WaveList.tpp.
References Pscf::MeshIterator< D >::atEnd(), Pscf::MeshIterator< D >::begin(), Pscf::MeshIterator< D >::position(), Pscf::MeshIterator< D >::rank(), and UTIL_CHECK.
Referenced by computedKSq(), and computeKSq().
void Pscf::Prdc::Cuda::WaveList< D >::computeKSq | ( | ) |
Compute sq.
norm |k|^2 for all wavevectors, using existing min images.
Definition at line 143 of file cpu/WaveList.tpp.
References Pscf::MeshIterator< D >::atEnd(), Pscf::MeshIterator< D >::begin(), computeMinimumImages(), Pscf::MeshIterator< D >::rank(), and UTIL_CHECK.
void Pscf::Prdc::Cuda::WaveList< D >::computedKSq | ( | ) |
Compute derivatives of |k|^2 w/ respect to unit cell parameters.
Definition at line 175 of file cpu/WaveList.tpp.
References Pscf::MeshIterator< D >::atEnd(), Pscf::MeshIterator< D >::begin(), computeMinimumImages(), Pscf::MeshIterator< D >::rank(), and UTIL_CHECK.
|
inline |
Get the array of minimum image vectors by const reference.
This function returns an array in which each element is an IntVec<D> containing the integer coordinates of the minimum image of one wavevector in the k-space mesh used for the DFT. If isRealField is true, this k-space mesh is smaller than the real-space mesh. Otherwise, it is the same size.
Definition at line 260 of file cpu/WaveList.h.
References UTIL_CHECK.
|
inline |
Get the kSq array on the device by const reference.
This function returns an array in which each element is the square magnitude |k|^2 of a wavevector k in the k-space mesh used for the DFT. If isRealField is true, this k-space mesh is smaller than the real-space mesh. Otherwise, it is the same size.
Definition at line 269 of file cpu/WaveList.h.
References UTIL_CHECK.
|
inline |
Get derivatives of kSq with respect to unit cell parameter i.
Each element contains the derivative of the square-wavevector with respect to unit cell parameter i, multiplied by a prefactor. The prefactor is 2.0 for waves that have an implicit inverse and 1.0 otherwise. The choice of prefactor is designed to simplify use of the array to compute stress.
Each element corresponds to one wavevector k in the k-space mesh used for the DFT. If isRealField is true, this k-space mesh is smaller than the real-space mesh. Otherwise, it is the same size. In the latter case, there are no implicit waves, so the prefactor is always 1.0.
i | index of lattice parameter |
Definition at line 278 of file cpu/WaveList.h.
References UTIL_CHECK.
|
inline |
Get all derivatives of kSq with respect to unit cell parameters.
Element i of the DArray is the RField<D> that can also be obtained from member function dKSq(int i).
Definition at line 287 of file cpu/WaveList.h.
References UTIL_CHECK.
|
inline |
Get the implicitInverse array by reference.
This array is defined on a k-grid mesh, with a boolean value for each gridpoint. The boolean represents whether the inverse of the wave at the given gridpoint is an implicit wave. Implicit here is used to mean any wave that is outside the bounds of the k-grid.
This method will throw an error if isRealField == false, because there are no implicit inverses in such a case.
Definition at line 296 of file cpu/WaveList.h.
References UTIL_CHECK.
|
inline |
Has memory been allocated for arrays?
Definition at line 167 of file cpu/WaveList.h.
|
inline |
Have minimum images been computed?
Definition at line 173 of file cpu/WaveList.h.
|
inline |
Has the kSq array been computed?
Definition at line 179 of file cpu/WaveList.h.
|
inline |
Has the dKSq array been computed?
Definition at line 185 of file cpu/WaveList.h.
|
inline |
Does this WaveList correspond to real-valued fields?
Definition at line 191 of file cpu/WaveList.h.
Referenced by WaveList().