9#include <prdc/cpu/FFT.h>
10#include <prdc/crystal/shiftToMinimum.h>
11#include <prdc/crystal/UnitCell.h>
12#include <pscf/mesh/MeshIterator.h>
13#include <pscf/math/IntVec.h>
39 kMeshDimensions, kMeshSize);
42 for (
int i = 0; i < D; ++i) {
43 kMeshDimensions[i] = meshDimensions[i];
44 kMeshSize *= meshDimensions[i];
50 items.reserve(kMeshSize);
57 v = shiftToMinimum(v, meshDimensions, cell);
58 item.value = cell.
ksq(v);
59 items.push_back(item);
72 void sortWaves<1>(UnitCell<1>
const &,
IntVec<1> const &,
76 void sortWaves<2>(UnitCell<2>
const &,
IntVec<2> const &,
80 void sortWaves<3>(UnitCell<3>
const &,
IntVec<3> const &,
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.
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.
virtual double ksq(IntVec< D > const &k) const
Compute square magnitude of reciprocal lattice vector.
Base template for UnitCell<D> classes, D=1, 2 or 3.
An automatically growable array, analogous to a std::vector.
void clear()
Reset to empty state.
void sortWaves(UnitCell< D > const &cell, IntVec< D > const &meshDimensions, std::vector< Sort::Item< double > > &items, GArray< Sort::Bunch > &bunches, double epsilon, bool isRealField)
Sorted waves and identify bunches of equal magnitude.
void findBunches(std::vector< Item< T > > const &items, GArray< Bunch > &bunches, T epsilon)
Identify "bunches" of equal values within a sorted vector.
void sort(std::vector< Item< T > > &items)
Sort a std::vector< Item<T> > by ascending item value.
Periodic fields and crystallography.
PSCF package top-level namespace.
Struct with value and index, to keep track of permutation.