#include <plane_wave_selector.hpp>
Static Public Member Functions | |
| static void | select (const GVectorsGrid &g_vectors_grid, const Vector3D &k_coordinates, const Crystal &crystal_structure, Real energy_cutoff_wavefunction, std::vector< int > &g_vector_indices, std::vector< Real > &kinetic_energy_squared, const FFTGrid *fft_wave=nullptr, int band_size=1) |
Definition at line 27 of file plane_wave_selector.hpp.
|
inlinestatic |
Compute |k+G|² for all G-vectors at a k-point. Returns sorted indices and kinetic energies.
When fft_wave is non-null and band_size > 1, only G-vectors whose first Miller index falls into the local FFT slab are selected. This gives each band rank its own subset of plane waves for the wavefunction.
Safety: if slab filtering would yield zero plane waves, the filter is disabled and ALL qualifying G-vectors are returned (replicated mode). This prevents zero-dimension BLAS crashes on small systems.
Under a shared pool each rank keeps only the G-vectors on the sticks it owns. The grid decides ownership; this used to encode the slab rule here, which is one reason the slab layout was hard to replace. Ownership is checked against the wavefunction grid, where the transforms run, not the density grid the G-vectors were generated on.
Definition at line 41 of file plane_wave_selector.hpp.
References q3::math::tolerances::energy_cutoff_rounding_tolerance, q3::GVectorsGrid::g_vectors(), q3::Vector3D::norm2(), q3::Crystal::reciprocal_lattice_vectors(), q3::Crystal::two_pi_over_lattice_parameter_squared(), q3::Vector3D::x, q3::Vector3D::y, and q3::Vector3D::z.
Referenced by q3::PlanewaveBasis::compute_gk(), and q3::PlaneWaveTable::initialize().