Quantum 3xplorer (Q3)
An AI-native quantum simulation engine
Loading...
Searching...
No Matches
q3::PlanewaveFFTPair Class Reference

#include <pair.hpp>

Public Member Functions

FFTGrid & fft_rho ()
 
const FFTGrid & fft_rho () const
 
FFTGrid & fft_wave ()
 
const FFTGrid & fft_wave () const
 
const SerialFFTGrid & fft_wave_serial () const
 
void initialize (const FFTGridFactory &fft_grid_factory, const Crystal &crystal_structure, Real energy_cutoff_charge_density, Real energy_cutoff_wavefunction, bool use_measured_fft_planning=true, bool use_exact_wavefunction_grid=false)
 

Detailed Description

Definition at line 16 of file pair.hpp.

Member Function Documentation

◆ fft_rho() [1/2]

◆ fft_rho() [2/2]

const FFTGrid & q3::PlanewaveFFTPair::fft_rho ( ) const
inline

Definition at line 108 of file pair.hpp.

◆ fft_wave() [1/2]

◆ fft_wave() [2/2]

const FFTGrid & q3::PlanewaveFFTPair::fft_wave ( ) const
inline

Definition at line 114 of file pair.hpp.

◆ fft_wave_serial()

const SerialFFTGrid & q3::PlanewaveFFTPair::fft_wave_serial ( ) const
inline

Serial (non-MPI) wave FFT grid for band-distributed parallelism. Identical dimensions to fft_wave() but runs locally on each rank.

Definition at line 121 of file pair.hpp.

Referenced by q3::PlanewaveBasis::fft_wave_serial().

◆ initialize()

void q3::PlanewaveFFTPair::initialize ( const FFTGridFactory &  fft_grid_factory,
const Crystal &  crystal_structure,
Real  energy_cutoff_charge_density,
Real  energy_cutoff_wavefunction,
bool  use_measured_fft_planning = true,
bool  use_exact_wavefunction_grid = false 
)
inline
Parameters
use_exact_wavefunction_gridfalse (default) sizes the wavefunction grid for 2 x ecutwfc; true sizes it exactly, for 4 x ecutwfc, as pw.x does. See InputData::use_exact_wavefunction_grid.

Rho grid uses FFTW_MEASURE by default (use_measured_fft_planning=true); pass false for bit-reproducible FFTW_ESTIMATE planning (see InputData::use_deterministic_fft_planning).

The smooth (wavefunction) FFT grid carries two products, V(r)ψ(r) and |ψ(r)|². A wavefunction holds plane waves out to G_max = sqrt(ecutwfc), so |ψ|² reaches 2 G_max, and a grid that holds the sphere of radius 2 G_max – a 4 x ecutwfc cutoff – takes both products without aliasing: |ψ|² fits whole, and any component of Vψ that wraps around lands outside the wavefunction sphere, where it is discarded. That is the exact grid, and the one pw.x builds; enlarging it changes nothing.

The default grid holds only √2 G_max (2 x ecutwfc). Parts of |ψ|² and of Vψ wrap onto components that are kept, so it is faster but approximate: harmless where the wavefunctions have little weight near the cutoff, and up to mRy off pw.x on a hard deck at a low cutoff – 9.5 mRy on a Ni/CO slab at 20 Ry. The exact grid costs 1.4x to 2.3x the solver time on the silicon and copper examples, depending on the thread count.

Either is capped at the dense grid, which already holds everything the density can carry.

Serial wave grid for band-distributed parallelism (task groups). Every rank gets a full-sized serial grid so each can do independent FFTs for its assigned bands without MPI collective calls.

Definition at line 23 of file pair.hpp.

References q3::FFTGridSizer::calculate_grid_dimensions(), q3::FFTGridSizer::compute_fft_factors(), q3::FFTGridFactory::create_fft_grid(), q3::Crystal::lattice_vectors(), q3::Crystal::reciprocal_lattice_vectors(), and q3::Crystal::two_pi_over_lattice_parameter_squared().

Referenced by q3::PlanewaveBasis::generate().


The documentation for this class was generated from the following file: