|
Quantum 3xplorer (Q3)
An AI-native quantum simulation engine
|
#include <init.hpp>
Public Member Functions | |
| PlanewaveBasis ()=default | |
| PlanewaveBasis (PlanewaveBasisConfig config) | |
| Real | charge_density_energy_cutoff () const |
| void | compute_gk (const Vector3D &k_coordinates, const Crystal &crystal_structure, std::vector< int > &g_vector_indices, std::vector< Real > &kinetic_energy_squared, int band_size=1) const |
| const PlanewaveFFTPair & | fft_pair () const |
| FFTGrid & | fft_rho () |
| const FFTGrid & | fft_rho () const |
| FFTGrid & | fft_wave () |
| const FFTGrid & | fft_wave () const |
| const SerialFFTGrid & | fft_wave_serial () const |
| int | first_nonzero_g_index () const |
| void | g_to_r (const std::vector< Complex > &coefficients_g_space, const std::vector< int > &g_vector_indices, int number_of_plane_waves, std::vector< Complex > &coefficients_real_space) const |
| const std::vector< int > & | g_vector_indices_by_kpoint_index (int kpoint_index) const |
| const std::vector< Real > & | g_vector_magnitudes () const |
| const std::vector< GVector > & | g_vectors () const |
| const GVectorsGrid & | g_vectors_grid () const |
| bool | gamma_origin_is_local () const |
| void | generate (const FFTGridFactory &fft_grid_factory, const Crystal &crystal_structure, Real wavefunction_energy_cutoff, Real charge_density_energy_cutoff, bool is_gamma_only=false, bool use_measured_fft_planning=true, bool use_exact_wavefunction_grid=false) |
| void | initialize_kpoint_data (const Crystal &crystal_structure, const KPointsGrid &kpoint_grid, int band_size=1) |
| bool | is_gamma_only () const |
| const std::vector< Real > & | kinetic_energy_squared_by_kpoint_index (int kpoint_index) const |
| const std::vector< std::vector< int > > & | kpoint_g_vector_indices () const |
| const std::vector< std::vector< Real > > & | kpoint_kinetic_energy_squared () const |
| const std::vector< int > & | kpoint_number_of_plane_waves () const |
| int | maximum_plane_waves_per_kpoint () const |
| int | number_of_g_vectors () const |
| int | number_of_plane_waves_by_kpoint_index (int kpoint_index) const |
| const PlaneWaveTable & | plane_wave_table () const |
| void | r_to_g (const std::vector< Complex > &coefficients_real_space, const std::vector< int > &g_vector_indices, int number_of_plane_waves, std::vector< Complex > &coefficients_g_space) const |
| void | rho_g_to_r (const std::vector< Complex > &charge_density_g_space, std::vector< Real > &charge_density_real_space) const |
| void | rho_r_to_g (const std::vector< Real > &charge_density_real_space, std::vector< Complex > &charge_density_g_space) const |
| template<typename Predicate > | |
| std::vector< int > | stick_weights_for_grid (const FFTGrid &grid, Predicate accept) const |
| Real | wavefunction_energy_cutoff () const |
|
default |
|
inlineexplicit |
|
inline |
Definition at line 345 of file init.hpp.
Referenced by q3::build_mean_field_record(), q3::EwaldStressTensorCalculator::compute(), q3::EwaldForceCalculator::compute(), q3::MartynaTuckermanCorrectionCalculator::compute(), q3::compute_ewald(), generate(), and q3::BetaFunctionTable::initialize().
|
inline |
G-vector distribution: when band_size > 1, pass the MPI FFT grid so that PlaneWaveSelector only keeps G-vectors in this rank's slab.
Definition at line 178 of file init.hpp.
References q3::PlanewaveFFTPair::fft_wave(), and q3::PlaneWaveSelector::select().
|
inline |
|
inline |
Definition at line 286 of file init.hpp.
References q3::PlanewaveFFTPair::fft_rho().
Referenced by q3::PlanewaveChargeDensity::PlanewaveChargeDensity(), q3::PlanewaveEffectivePotential::PlanewaveEffectivePotential(), q3::PlanewaveChargeDensityAccumulator::accumulate(), q3::PlanewaveEffectivePotentialCalculator::build_exchange_correlation_density(), q3::NormConservingPlanewaveEffectivePotentialCalculator::build_exchange_correlation_density(), q3::build_mean_field_record(), q3::MakovPayneCorrectionCalculator::compute(), q3::MartynaTuckermanCorrectionCalculator::compute(), q3::PlanewaveEffectivePotentialCalculator::compute(), q3::PlanewaveKohnShamSCFIterator::compute_delta_escf_correction(), q3::PlanewaveKohnShamSCFIterator::compute_double_counting_correction(), q3::compute_smooth_grid_potential_from_dense(), q3::GradientCorrectedExchangeCorrelationPotentialCalculator::evaluate_spin_polarized(), q3::GradientCorrectedExchangeCorrelationPotentialCalculator::evaluate_unpolarized(), q3::PlanewaveChargeDensity::get_total_charge(), q3::PlanewaveChargeDensity::grid_size(), q3::PlanewaveEffectivePotential::grid_size(), q3::PlanewaveEffectivePotential::initialize_kinetic_potential(), q3::PlanewaveKohnShamSCFIterator::loaded_charge_density_fits_grid(), q3::PlanewaveKohnShamSCFIterator::log_representation_summary(), q3::PlanewaveKohnShamSCFIterator::preload_charge_density(), q3::PlanewaveKohnShamSCFIterator::report_convergence_details(), q3::PlanewaveChargeDensity::reset(), q3::PlanewaveKohnShamSCFIterator::scale_loaded_charge_density_to_electron_count(), q3::PlanewaveDirectDiagonalizer::solve(), q3::PlanewaveChargeDensity::to_reciprocal_space(), q3::PlanewaveEffectivePotential::to_reciprocal_space(), and q3::PlanewaveKohnShamSCFIterator::warn_if_total_charge_deviates().
|
inline |
Definition at line 289 of file init.hpp.
References q3::PlanewaveFFTPair::fft_rho().
|
inline |
Definition at line 292 of file init.hpp.
References q3::PlanewaveFFTPair::fft_wave().
Referenced by q3::GPUPlanewaveHamiltonianApplicator::GPUPlanewaveHamiltonianApplicator(), q3::PlanewaveChargeDensityAccumulator::accumulate(), q3::GPUPlanewaveHamiltonianApplicator::apply_batch(), q3::GPUPlanewaveHamiltonianApplicator::apply_batch_single_precision(), q3::compute_g_to_fft_index_mapping(), q3::compute_smooth_grid_potential_from_dense(), q3::PlanewaveKohnShamSCFIterator::initialize_representation(), q3::PlanewavePseudopotentialKohnShamSCFIterator::initialize_single_particle_states(), q3::inverse_fft_smooth_potential(), q3::PlanewaveKohnShamSCFIterator::log_representation_summary(), q3::GPUPlanewaveHamiltonianApplicator::update_potential(), and q3::SerialPlanewaveHamiltonianApplicator::update_potential().
|
inline |
Definition at line 295 of file init.hpp.
References q3::PlanewaveFFTPair::fft_wave().
|
inline |
Definition at line 298 of file init.hpp.
References q3::PlanewaveFFTPair::fft_wave_serial().
|
inline |
Definition at line 151 of file init.hpp.
References q3::GVectorsGrid::first_nonzero_g_index().
Referenced by q3::EwaldStressTensorCalculator::compute(), q3::HartreeStressTensorCalculator::compute(), q3::CoreCorrectionStressTensorCalculator::compute(), q3::LocalPseudopotentialStressTensorCalculator::compute(), q3::EwaldForceCalculator::compute(), q3::UltrasoftPlanewaveEffectivePotential::compute(), q3::UltrasoftForceCalculator::compute(), q3::MartynaTuckermanCorrectionCalculator::compute(), q3::LocalPseudopotentialForceCalculator::compute(), q3::CoreCorrectionForceCalculator::compute(), q3::compute_ewald(), q3::PlanewaveKohnShamSCFIterator::compute_local_residual_between(), and q3::PlanewaveKohnShamSCFIterator::initiate_mixer().
|
inline |
Definition at line 304 of file init.hpp.
References q3::PlanewaveFFTPair::fft_wave(), and q3::WavefunctionTransformer::g_to_r().
|
inline |
Definition at line 259 of file init.hpp.
References q3::PlaneWaveTable::g_vector_indices_by_kpoint_index().
Referenced by q3::PlanewaveKohnShamSCFIterator::g_vector_indices(), and q3::PlanewaveKohnShamSCFState::g_vector_indices_at_kpoint().
|
inline |
Definition at line 154 of file init.hpp.
References q3::GVectorsGrid::g_vector_magnitudes().
Referenced by q3::compute_ultrasoft_effective_d_matrix(), q3::NormConservingPlanewaveBasis::init(), and q3::UltrasoftPlanewaveBasis::precompute_q_functions_g().
|
inline |
Definition at line 148 of file init.hpp.
References q3::GVectorsGrid::g_vectors().
Referenced by q3::PlanewaveWannierCapture::PlanewaveWannierCapture(), q3::UltrasoftPlanewaveBasis::add_augmentation_charges(), q3::PlanewaveHydrogenicOrbitalSet::build(), q3::build_atomic_orbitals_g_space(), q3::build_mean_field_record(), q3::PlanewaveChargeDensitySymmetrizer::build_shells(), q3::EwaldStressTensorCalculator::compute(), q3::HartreeStressTensorCalculator::compute(), q3::KineticStressTensorCalculator::compute(), q3::CoreCorrectionStressTensorCalculator::compute(), q3::LocalPseudopotentialStressTensorCalculator::compute(), q3::EwaldForceCalculator::compute(), q3::HubbardForceCalculator::compute(), q3::NonlocalPseudopotentialForceCalculator::compute(), q3::UltrasoftForceCalculator::compute(), q3::MartynaTuckermanCorrectionCalculator::compute(), q3::LocalPseudopotentialForceCalculator::compute(), q3::CoreCorrectionForceCalculator::compute(), q3::PlanewaveBlochOverlapCalculator::compute(), q3::NormConservingPlanewaveWavefunctionInitializer::compute_atomic_wavefunctions(), q3::compute_ewald(), q3::compute_g_to_fft_index_mapping(), q3::compute_kleinman_bylander_projectors(), q3::PlanewaveKohnShamSCFIterator::compute_local_residual_between(), q3::compute_ultrasoft_effective_d_matrix(), q3::find_g_zero_plane_wave_index(), q3::NormConservingPlanewaveBasis::init(), q3::SphericalHarmonicsTable::init(), q3::CoreChargeData::initialize(), q3::PlanewaveKohnShamSCFIterator::initiate_mixer(), q3::UltrasoftPlanewaveEffectivePotential::precompute_structure_factors(), q3::PlanewaveDirectDiagonalizer::solve(), q3::tabulate_core_charge_density_in_g_space(), and q3::tabulate_local_potential_in_g_space().
|
inline |
|
inline |
Whether this rank's plane-wave list begins with G = 0.
The gamma trick sums 2 Re over the stored half sphere and removes the origin, which the half sphere holds once, from the double count. When reciprocal space is distributed by stick exactly one rank holds the origin, and only that rank may remove it. Serial and replicated layouts always hold it, so the default is true; initialize_kpoint_data() sets it from the list actually kept. Meaningful only when is_gamma_only().
Definition at line 172 of file init.hpp.
Referenced by q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::accumulate_projector_overlaps(), q3::UltrasoftPseudopotentialOverlapOperator::apply(), q3::UltrasoftPseudopotentialOverlapOperator::apply_batch(), q3::SerialPlanewaveHamiltonianApplicator::prepare_kpoint(), and q3::NormConservingPlanewaveWavefunctionInitializer::rotate_wavefunctions().
|
inline |
Generate G-vectors and FFT grids for given cutoffs.
Charge density G-vectors must remain replicated on all band ranks. Only wavefunction coefficients (per k-point) are distributed via FFT slab decomposition — see PlaneWaveSelector::select().
Tell the density grid which sticks carry G-vectors, so a stick layout can balance them and skip the empty ones. A grid that does not distribute by stick ignores this.
Definition at line 58 of file init.hpp.
References q3::FFTGrid::assign_sticks(), charge_density_energy_cutoff(), q3::GVectorsGrid::estimate_maximum_plane_waves_per_kpoint(), q3::PlanewaveFFTPair::fft_rho(), q3::GVectorsGrid::generate(), q3::FFTGrid::grid_dimension_1(), q3::FFTGrid::grid_dimension_2(), q3::FFTGrid::grid_dimension_3(), q3::PlanewaveFFTPair::initialize(), is_gamma_only(), stick_weights_for_grid(), q3::Crystal::two_pi_over_lattice_parameter_squared(), and wavefunction_energy_cutoff().
Referenced by q3::PlanewaveKohnShamSCFIterator::build_kpoint_plane_wave_data(), and q3::PlanewaveKohnShamSCFIterator::initialize_representation().
|
inline |
Under a shared pool the wavefunction grid must know its sticks before the selector asks it who owns what. A stick counts if any G-vector on it can fall inside the wavefunction cutoff at some k-point, which is |G| within sqrt(E_cut) plus the largest |k| on the grid – a superset that costs a few empty sticks and never drops a plane wave.
Gamma-only means a single k-point, so one list decides: the origin is local when the first entry – the list is sorted by |k+G|^2, and at Gamma nothing else has zero kinetic energy – is G = 0.
Definition at line 202 of file init.hpp.
References q3::FFTGrid::assign_sticks(), q3::math::tolerances::energy_cutoff_rounding_tolerance, q3::PlanewaveFFTPair::fft_wave(), q3::PlaneWaveTable::g_vector_indices_by_kpoint_index(), q3::GVectorsGrid::g_vectors(), q3::PlaneWaveTable::initialize(), q3::Vector3D::norm2(), q3::KPointsGrid::number_of_kpoints(), q3::math::tolerances::numerical_zero_threshold, q3::Crystal::reciprocal_lattice_vectors(), stick_weights_for_grid(), q3::Crystal::two_pi_over_lattice_parameter_squared(), and q3::Vector3D::x.
Referenced by q3::PlanewaveKohnShamSCFIterator::build_kpoint_plane_wave_data().
|
inline |
Definition at line 157 of file init.hpp.
Referenced by q3::PlanewavePseudopotentialKohnShamSCFIterator::accumulate_hubbard_occupation_and_potential(), q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::accumulate_projector_overlaps(), q3::UltrasoftPseudopotentialOverlapOperator::apply(), q3::UltrasoftPseudopotentialOverlapOperator::apply_batch(), q3::GPUPlanewaveHamiltonianApplicator::apply_batch_single_precision(), q3::PlanewaveKohnShamSCFIterator::build_kpoint_plane_wave_data(), q3::build_mean_field_record(), q3::PlanewaveChargeDensitySymmetrizer::build_shells(), q3::EwaldStressTensorCalculator::compute(), q3::HartreeStressTensorCalculator::compute(), q3::KineticStressTensorCalculator::compute(), q3::CoreCorrectionStressTensorCalculator::compute(), q3::HubbardStressTensorCalculator::compute(), q3::LocalPseudopotentialStressTensorCalculator::compute(), q3::NonlocalPseudopotentialStressTensorCalculator::compute(), q3::EwaldForceCalculator::compute(), q3::HubbardForceCalculator::compute(), q3::NonlocalPseudopotentialForceCalculator::compute(), q3::UltrasoftPlanewaveEffectivePotential::compute(), q3::UltrasoftForceCalculator::compute(), q3::MartynaTuckermanCorrectionCalculator::compute(), q3::LocalPseudopotentialForceCalculator::compute(), q3::CoreCorrectionForceCalculator::compute(), q3::compute_ewald(), q3::PlanewaveKohnShamSCFIterator::compute_local_residual_between(), generate(), q3::PlanewaveKohnShamSCFIterator::initiate_mixer(), q3::GPUPlanewaveHamiltonianApplicator::is_gamma_only_current(), q3::GPUPlanewaveHamiltonianApplicator::prepare_kpoint(), q3::SerialPlanewaveHamiltonianApplicator::prepare_kpoint(), q3::NormConservingPlanewaveWavefunctionInitializer::rotate_wavefunctions(), and q3::PlanewavePseudopotentialKohnShamSCFIterator::setup_hubbard().
|
inline |
Definition at line 268 of file init.hpp.
References q3::PlaneWaveTable::kinetic_energy_squared_by_kpoint_index().
|
inline |
Definition at line 272 of file init.hpp.
References q3::PlaneWaveTable::kpoint_g_vector_indices().
Referenced by q3::build_mean_field_record(), q3::PlanewaveKohnShamSCFIterator::g_vector_indices(), and q3::ScfStateMeanFieldProjectorSource::projectors().
|
inline |
Definition at line 280 of file init.hpp.
References q3::PlaneWaveTable::kpoint_kinetic_energy_squared().
Referenced by q3::PlanewaveKohnShamSCFIterator::kinetic_energy_squared().
|
inline |
Definition at line 276 of file init.hpp.
References q3::PlaneWaveTable::kpoint_number_of_plane_waves().
Referenced by q3::PlanewaveKohnShamSCFIterator::allocate_electronic_states(), q3::PlanewaveKohnShamSCFIterator::build_kpoint_plane_wave_data(), q3::build_mean_field_record(), q3::PlanewaveKohnShamSCFIterator::log_representation_summary(), q3::PlanewaveKohnShamSCFIterator::number_of_plane_waves(), and q3::ScfStateMeanFieldProjectorSource::projectors().
|
inline |
|
inline |
Definition at line 145 of file init.hpp.
References q3::GVectorsGrid::number_of_g_vectors().
Referenced by q3::PlanewaveChargeDensity::PlanewaveChargeDensity(), q3::PlanewaveEffectivePotential::PlanewaveEffectivePotential(), q3::UltrasoftPlanewaveBasis::add_augmentation_charges(), q3::PlanewaveEffectivePotentialCalculator::build_exchange_correlation_density(), q3::NormConservingPlanewaveEffectivePotentialCalculator::build_exchange_correlation_density(), q3::PlanewaveChargeDensitySymmetrizer::build_shells(), q3::ExchangeCorrelationStressTensorCalculator::build_total_charge_density_g(), q3::EwaldStressTensorCalculator::compute(), q3::HartreeStressTensorCalculator::compute(), q3::CoreCorrectionStressTensorCalculator::compute(), q3::LocalPseudopotentialStressTensorCalculator::compute(), q3::EwaldForceCalculator::compute(), q3::UltrasoftPlanewaveEffectivePotential::compute(), q3::UltrasoftForceCalculator::compute(), q3::MartynaTuckermanCorrectionCalculator::compute(), q3::LocalPseudopotentialForceCalculator::compute(), q3::CoreCorrectionForceCalculator::compute(), q3::compute_ewald(), q3::PlanewaveKohnShamSCFIterator::compute_local_residual_between(), q3::compute_ultrasoft_effective_d_matrix(), q3::NormConservingPlanewaveBasis::init(), q3::SphericalHarmonicsTable::init(), q3::PlanewaveKohnShamSCFIterator::initiate_mixer(), q3::PlanewaveKohnShamSCFIterator::log_representation_summary(), q3::UltrasoftPlanewaveBasis::precompute_q_functions_g(), q3::UltrasoftPlanewaveEffectivePotential::precompute_structure_factors(), and q3::tabulate_local_potential_in_g_space().
|
inline |
Definition at line 263 of file init.hpp.
References q3::PlaneWaveTable::number_of_plane_waves_by_kpoint_index().
Referenced by q3::PlanewaveKohnShamSCFIterator::number_of_plane_waves(), and q3::PlanewaveKohnShamSCFState::number_of_plane_waves().
|
inline |
|
inline |
Definition at line 316 of file init.hpp.
References q3::PlanewaveFFTPair::fft_wave(), and q3::WavefunctionTransformer::r_to_g().
|
inline |
Definition at line 328 of file init.hpp.
References q3::PlanewaveFFTPair::fft_rho(), and q3::ChargeDensityTransformer::rho_g_to_r().
Referenced by q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::add_augmentation_to_charge_density(), q3::NormConservingPlanewaveEffectivePotentialCalculator::build_exchange_correlation_density(), q3::PlanewaveKohnShamSCFIterator::initiate_mixer(), q3::PlanewaveChargeDensitySymmetrizer::symmetrize(), q3::PlanewaveChargeDensitySymmetrizer::symmetrize_from_g_space(), q3::PlanewaveChargeDensity::to_real_space(), q3::PlanewaveEffectivePotential::to_real_space(), and q3::PlanewaveKohnShamSCFIterator::update_effective_potential().
|
inline |
Definition at line 334 of file init.hpp.
References q3::PlanewaveFFTPair::fft_rho(), and q3::ChargeDensityTransformer::rho_r_to_g().
Referenced by q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::add_augmentation_to_charge_density(), q3::PlanewaveEffectivePotentialCalculator::build_exchange_correlation_density(), q3::NormConservingPlanewaveEffectivePotentialCalculator::build_exchange_correlation_density(), q3::build_mean_field_record(), q3::ExchangeCorrelationStressTensorCalculator::build_spin_charge_density_g(), q3::MartynaTuckermanCorrectionCalculator::compute(), q3::PlanewaveEffectivePotentialCalculator::compute(), q3::PlanewaveKohnShamSCFIterator::compute_local_residual_between(), q3::PlanewaveKohnShamSCFIterator::initiate_mixer(), q3::PlanewaveKohnShamSCFIterator::preload_charge_density(), q3::PlanewaveChargeDensitySymmetrizer::symmetrize(), q3::PlanewaveChargeDensity::to_reciprocal_space(), q3::PlanewaveEffectivePotential::to_reciprocal_space(), and q3::PlanewaveKohnShamSCFIterator::update_effective_potential().
|
inline |
Count the G-vectors on each stick of a grid, by wrapped first and second Miller index, for those the predicate accepts and that fit in the grid.
Every stick is owned, balanced by how much of the sphere it carries. A stick outside the sphere could be dropped, but two consumers here still read the whole grid box – the dense-to-smooth potential copy and the smooth-to-dense density transfer – and truncating would change their answer against a serial run. Transporting the empty sticks costs the all-to-all the same volume the slab transpose moved; skipping them is a later optimisation that wants those two loops made sphere-only first.
Definition at line 109 of file init.hpp.
References q3::GVectorsGrid::g_vectors(), q3::FFTGrid::grid_dimension_1(), q3::FFTGrid::grid_dimension_2(), and q3::FFTGrid::grid_dimension_3().
Referenced by generate(), and initialize_kpoint_data().
|
inline |
Definition at line 342 of file init.hpp.
Referenced by q3::build_mean_field_record(), and generate().