#include <serial.hpp>
Inheritance diagram for q3::SerialPlanewaveHamiltonianApplicator:Public Member Functions | |
| SerialPlanewaveHamiltonianApplicator (const Crystal &crystal_structure, const PlanewaveBasis &planewave_basis, const KPointsGrid &kpoint_grid, const NormConservingPlanewaveKohnShamQuantumSystem &pseudopotential_quantum_system, const execution::ExecutionPolicy &execution_policy) | |
| void | apply_batch (const Complex *input_wavefunctions, Complex *output_hamiltonian_wavefunctions, int number_of_vectors) override |
| const std::vector< Real > & | cached_scaled_potential () const |
| const std::vector< int > & | g_to_fft_mapping () const |
| bool | gamma_origin_is_local_current () const override |
| const q3::Matrix< Complex > * | get_cached_projectors (int kpoint_index) const override |
| void | invalidate_smooth_potential_cache () override |
| bool | is_gamma_only_current () const override |
| bool | is_smooth_potential_cache_valid () const override |
| const std::vector< int > & | minus_g_to_fft_mapping () const |
| void | prepare_kpoint (int kpoint_index, int number_of_plane_waves, const std::vector< int > &g_vector_indices, const std::vector< Real > &kinetic_energy_squared) override |
| void | set_cached_hubbard_projectors (int kpoint_index, const q3::Matrix< Complex > *projectors) override |
| void | set_cached_projectors (int kpoint_index, const q3::Matrix< Complex > *projectors) override |
| void | set_hubbard_d_matrix (const std::vector< Complex > *dense_d_matrix_column_major) override |
| void | update_potential (const std::vector< Real > &real_space_potential) override |
Public Member Functions inherited from q3::PlanewaveHamiltonianApplicator | |
| virtual | ~PlanewaveHamiltonianApplicator ()=default |
| void | set_spin_channel (int spin_channel) |
| int | spin_channel () const |
Additional Inherited Members | |
Protected Attributes inherited from q3::PlanewaveHamiltonianApplicator | |
| int | spin_channel_ {0} |
| Spin channel the current potential and D belong to; 0 when unpolarized. | |
Definition at line 39 of file serial.hpp.
|
inline |
Construct with run-constant planewave context. All references must outlive this object.
Definition at line 45 of file serial.hpp.
|
inlineoverridevirtual |
Apply H|ψ⟩ to a batch of vectors using the cached potential and k-point data.
With bands distributed, each rank applies H to its own contiguous slice of the batch and one allgather completes the output. Every rank holds whole coefficient vectors here, so each transform is local and serial – unlike the reciprocal-space split, where the transform is collective and no rank gets to skip one.
Falls back to applying the whole batch when there are fewer vectors than ranks: below that the split leaves ranks idle while still paying for the allgather.
Implements q3::PlanewaveHamiltonianApplicator.
Definition at line 112 of file serial.hpp.
References q3::execution::ExecutionPolicy::allgather_across_bands(), q3::execution::ExecutionPolicy::band_distribution_rank_index(), q3::execution::ExecutionPolicy::band_distribution_size(), and q3::execution::partition_bands().
|
inline |
Access the cached scaled potential (pre-divided by N_smooth).
Definition at line 177 of file serial.hpp.
|
inline |
Access the G-to-FFT mapping for the current k-point.
Definition at line 184 of file serial.hpp.
|
inlineoverridevirtual |
Whether this rank's plane-wave list for the current k-point begins with G = 0, so that the gamma trick's origin correction belongs to it. True whenever the coefficients are replicated; under a reciprocal-space distribution exactly one rank answers true. Meaningful only when is_gamma_only_current().
Reimplemented from q3::PlanewaveHamiltonianApplicator.
Definition at line 202 of file serial.hpp.
|
inlineoverridevirtual |
Get pre-computed KB projectors for the current k-point, or nullptr if none.
Reimplemented from q3::PlanewaveHamiltonianApplicator.
Definition at line 221 of file serial.hpp.
|
inlineoverridevirtual |
Invalidate any cached smooth potential. Called when the effective potential changes (e.g., at start of each SCF iteration).
Implements q3::PlanewaveHamiltonianApplicator.
Definition at line 159 of file serial.hpp.
|
inlineoverridevirtual |
Whether the current k-point uses gamma-only half-sphere G-vectors.
Reimplemented from q3::PlanewaveHamiltonianApplicator.
Definition at line 198 of file serial.hpp.
|
inlineoverridevirtual |
Whether the smooth potential cache is currently valid.
Reimplemented from q3::PlanewaveHamiltonianApplicator.
Definition at line 170 of file serial.hpp.
|
inline |
Access the minus-G-to-FFT mapping for gamma-only calculations.
Definition at line 191 of file serial.hpp.
|
inlineoverridevirtual |
Configure for a specific k-point. Pre-computes G-vector → FFT grid index mappings and caches kinetic energy.
Implements q3::PlanewaveHamiltonianApplicator.
Definition at line 95 of file serial.hpp.
References q3::PlanewaveBasis::gamma_origin_is_local(), and q3::PlanewaveBasis::is_gamma_only().
|
inlineoverridevirtual |
Set pre-computed DFT+U (Hubbard) atomic-orbital projectors for a specific k-point. Geometry-only, set once per k-point at SCF setup (mirrors set_cached_projectors).
Reimplemented from q3::PlanewaveHamiltonianApplicator.
Definition at line 232 of file serial.hpp.
|
inlineoverridevirtual |
Set pre-computed KB projectors for a specific k-point. If set, apply_batch() will use these instead of recomputing them.
Reimplemented from q3::PlanewaveHamiltonianApplicator.
Definition at line 210 of file serial.hpp.
|
inlineoverridevirtual |
Set the dense block-diagonal Hubbard D-matrix. Refreshed once per SCF iteration by the caller – unlike the KB D-matrix, this is never lazily rebuilt here (it depends on the occupation matrix, which this class has no way to compute).
Reimplemented from q3::PlanewaveHamiltonianApplicator.
Definition at line 245 of file serial.hpp.
|
inlineoverridevirtual |
Update the effective potential for a new SCF iteration.
Restricts the potential from the dense grid to the smooth grid via G-space truncation, then pre-scales by 1/N_smooth for the local potential application.
For task-group band distribution: Allgather the slab-local potential into a full-grid potential so each rank can do serial FFTs.
Implements q3::PlanewaveHamiltonianApplicator.
Definition at line 63 of file serial.hpp.
References q3::execution::ExecutionPolicy::allgather_within_group(), q3::PlanewaveBasis::fft_wave(), q3::execution::ExecutionPolicy::group_size(), q3::FFTGrid::local_grid_points(), and q3::FFTGrid::total_grid_points().