1#ifndef PRDC_CPU_WAVE_LIST_TPP
2#define PRDC_CPU_WAVE_LIST_TPP
13#include <prdc/cpu/FFT.h>
14#include <prdc/crystal/UnitCell.h>
15#include <prdc/crystal/shiftToMinimum.h>
16#include <prdc/crystal/hasVariableAngle.h>
18#include <pscf/mesh/MeshIterator.h>
19#include <pscf/mesh/Mesh.h>
35 unitCellPtr_(nullptr),
61 int nParams = unitCell().nParameter();
62 IntVec<D> const & meshDimensions = mesh().dimensions();
68 kMeshDimensions_ = meshDimensions;
69 kSize_ = mesh().size();
73 minImages_.allocate(kSize_);
74 kSq_.allocate(kMeshDimensions_);
75 dKSq_.allocate(nParams);
76 for (
int i = 0; i < nParams; i++) {
77 dKSq_[i].allocate(kMeshDimensions_);
83 implicitInverse_.allocate(kSize_);
90 implicitInverse_[rank] =
108 hasMinImages_ =
false;
118 if (hasMinImages_)
return;
130 minImages_[rank] = shiftToMinimum(kItr.
position(),
131 mesh().dimensions(), unitCell());
132 kSq_[rank] = unitCell().ksq(minImages_[rank]);
135 hasMinImages_ =
true;
149 if (!hasMinImages_) {
165 kSq_[rank] = unitCell().ksq(minImages_[rank]);
177 if (hasdKSq_)
return;
180 if (!hasMinImages_) {
192 for (i = 0 ; i < unitCell().nParameter(); ++i) {
196 dksq[rank] = unitCell().dksq(minImages_[rank], i);
198 if (implicitInverse_[rank]) {
An IntVec<D, T> is a D-component vector of elements of integer type T.
Iterator over points in a Mesh<D>.
int rank() const
Get the rank of current element.
void begin()
Set iterator to the first point in the mesh.
bool atEnd() const
Is this the end (i.e., one past the last point)?
IntVec< D > position() const
Get current position in the grid, as integer vector.
Description of a regular grid of points in a periodic domain.
int size() const
Get total number of grid points.
static void computeKMesh(IntVec< D > const &rMeshDimensions, IntVec< D > &kMeshDimensions, int &kSize)
Compute dimensions and size of k-space mesh for DFT of real data.
static bool hasImplicitInverse(IntVec< D > const &wavevector, IntVec< D > const &meshDimensions)
Does this wavevector have implicit inverse in DFT or real data?
Field of real double precision values on an FFT mesh.
void clearUnitCellData()
Clear all internal data that depends on lattice parameters.
void computedKSq()
Compute derivatives of |k|^2 w/ respect to unit cell parameters.
WaveList(bool isRealField=true)
Constructor.
void computeMinimumImages()
Compute minimum images of wavevectors.
void allocate(Mesh< D > const &m, UnitCell< D > const &c)
Allocate memory and set association with a Mesh and UnitCell object.
void computeKSq()
Compute sq.
bool isRealField() const
Does this WaveList correspond to real-valued fields?
int nParameter() const
Get the number of parameters in the unit cell.
Base template for UnitCell<D> classes, D=1, 2 or 3.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Fields and FFTs for periodic boundary conditions (CPU)
Periodic fields and crystallography.
bool hasVariableAngle(typename UnitCell< D >::LatticeSystem lattice)
Return true if lattice type has variable angle parameters.
PSCF package top-level namespace.