Loading...
Searching...
No Matches
q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator Class Reference

#include <init.hpp>

+ Inheritance diagram for q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator:

Public Member Functions

 UltrasoftPlanewavePseudopotentialKohnShamSCFIterator (KohnShamSCFIteratorConfig config)
 
 ~UltrasoftPlanewavePseudopotentialKohnShamSCFIterator () override=default
 
const Matrix< Real > & projector_overlap_coefficients () const override
 
NormConservingPlanewaveKohnShamSCFState result () const override
 
- Public Member Functions inherited from q3::PlanewavePseudopotentialKohnShamSCFIterator
 PlanewavePseudopotentialKohnShamSCFIterator (KohnShamSCFIteratorConfig config)
 
 ~PlanewavePseudopotentialKohnShamSCFIterator () override=default
 
const NormConservingPlanewaveKohnShamEnergies & energies () const override
 
NormConservingPlanewaveKohnShamEnergies & energies_mutable () override
 
const std::vector< std::vector< Real > > & hubbard_occupation_traces () const
 
virtual void load_one_center_occupations (const std::vector< Matrix< Real > > &occupations_by_spin)
 
const NormConservingPlanewaveKohnShamQuantumSystem & norm_conserving_quantum_system () const
 
void offer_starting_wavefunctions (std::string save_directory)
 
virtual std::vector< Matrix< Real > > one_center_occupations () const
 
const PseudopotentialSet & pseudopotential_set () const
 
void refresh_quantum_system_snapshot ()
 
void release_scf_workspace () override
 
virtual bool requires_one_center_occupations () const
 
void set_diagonalizer_maximum_iterations_for_nscf (int maximum_iterations)
 
void set_diagonalizer_tolerance_for_nscf (Real tolerance)
 
void set_owned_pseudopotential_set (PseudopotentialSet pseudopotential_set)
 Transfer ownership of a PseudopotentialSet into this iterator.
 
std::vector< Complex > valence_exchange_correlation_potential_g_of (const std::vector< std::vector< Real > > &charge_density_real)
 
void write_checkpoints (const std::string &output_directory, const std::string &prefix) const override
 
- Public Member Functions inherited from q3::PlanewaveKohnShamSCFIterator
 PlanewaveKohnShamSCFIterator (KohnShamSCFIteratorConfig config)
 
 ~PlanewaveKohnShamSCFIterator () override=default
 
Real eigenvalue (int kpoint_index, int band_index) const
 
Matrix< Real > eigenvalues () const
 
const execution::PlanewaveExecutionPolicy & execution_policy () const
 
const std::vector< std::vector< int > > & g_vector_indices () const
 
const std::vector< int > & g_vector_indices (int kpoint_index) const
 
Matrix< Real > global_eigenvalues () const
 
const std::vector< std::vector< Real > > & kinetic_energy_squared () const
 
const KPointsGrid & kpoint_grid () const
 
void load_quantum_system (const PlanewaveKohnShamQuantumSystem &system)
 
bool loaded_charge_density_fits_grid () const
 
const std::optional< Magnetization > & magnetization () const
 
int number_of_bands () const override
 
Real number_of_electrons () const override
 
int number_of_kpoint_states () const override
 
int number_of_occupied_bands_per_spin () const
 
const std::vector< int > & number_of_plane_waves () const
 
int number_of_plane_waves (int kpoint_index) const
 
Real occupation (int kpoint_index, int band_index) const
 
const PlanewaveBasis & planewave_basis () const
 
void preload_charge_density ()
 
void preload_single_particle_states ()
 
const PlanewaveKohnShamQuantumSystem & quantum_system () const
 
void scale_loaded_charge_density_to_electron_count ()
 Rescale the loaded density so it integrates to this system's electron count.
 
void set_diagonalizer (std::unique_ptr< PlanewaveDiagonalizer > diagonalizer)
 
void set_owned_execution_policy (std::unique_ptr< execution::PlanewaveExecutionPolicy > policy)
 
void set_owned_kpoint_grid (KPointsGrid kpoint_grid)
 Transfer ownership of a KPointsGrid into this iterator.
 
Real spin_degeneracy () const
 
Complex wavefunction (int kpoint_index, int band_index, int g_vector_index) const
 
- Public Member Functions inherited from q3::KohnShamSCFIterator
 KohnShamSCFIterator (KohnShamSCFIteratorConfig config)
 
 ~KohnShamSCFIterator () override=default
 
const std::vector< Real > & charge_density_for_spin (int spin_index) const
 
const std::vector< Complex > & charge_density_g () const
 
const std::vector< Real > & charge_density_real () const
 
Crystal & crystal_structure () const
 
const XCFunctional & exchange_correlation () const
 
const std::vector< Complex > & exchange_correlation_potential_g () const
 
void load_charge_density (std::vector< std::vector< Real > > charge_density)
 
void load_effective_potential (std::vector< std::vector< Real > > effective_potential)
 
void offer_starting_charge_density (std::vector< std::vector< Real > > charge_density)
 
const std::vector< Real > & potential_for_spin (int spin_index) const
 
const std::vector< Real > & real_space_potential () const
 
const std::vector< ScfIterationRecord > & scf_history () const
 
Real total_energy () const override
 
const std::vector< Complex > & total_potential_g () const
 
- Public Member Functions inherited from q3::SCFIterator
 SCFIterator (SCFIteratorConfig config)
 
virtual ~SCFIterator ()=default
 
bool is_converged () const
 
int iteration () const
 
int number_of_spin_components () const
 
void run ()
 
void set_convergence_threshold (Real threshold)
 Set the SCF convergence threshold (in Ry).
 
void set_maximum_iterations (int maximum_iterations)
 Set the maximum number of SCF iterations.
 
void set_owned_crystal (Crystal crystal)
 Transfer ownership of a Crystal into this iterator.
 
const std::vector< Real > & total_energy_history_in_ry () const
 

Protected Member Functions

virtual void accumulate_projector_overlaps ()
 
void add_augmentation_to_charge_density ()
 
void construct_density_from_states () override
 
std::vector< std::vector< Real > > input_density_for_mixing () const override
 
UltrasoftPlanewaveKohnShamQuantumSystem & mutable_ultrasoft_quantum_system ()
 
std::vector< std::vector< Complex > > nonlocal_potentials_by_spin () const
 
void on_charge_density_initialized () override
 
void prepare_hamiltonian () override
 
void reset_projector_overlap_coefficients ()
 Allocate and zero the per-atom projector overlap matrix when augmentation is required.
 
void restore_density_at_convergence () override
 
void snapshot_output_density () override
 
void snapshot_smooth_density ()
 
void symmetrize_density () override
 
void synchronize_smooth_density_from_mixed () override
 
const UltrasoftPlanewaveKohnShamQuantumSystem & ultrasoft_quantum_system () const
 
- Protected Member Functions inherited from q3::PlanewavePseudopotentialKohnShamSCFIterator
void accumulate_hubbard_occupation_and_potential ()
 
const std::vector< SymmetryOperation > & cached_symmetry_operations () const
 
Real compute_double_counting_correction () const override
 
void compute_effective_potential_from_density () override
 
const std::vector< Complex > & core_charge_density_g () const override
 
void create_norm_conserving_quantum_system_snapshot ()
 
NormConservingPlanewaveEffectivePotentialCalculator & effective_potential_calculator ()
 
std::vector< Real > effective_species_magnetizations () const
 
void fix_edge_kpoints_with_backward_propagation (int number_of_kpoints, int number_of_kpoint_states)
 
Real hubbard_potential_energy () const
 
void initialize_charge_density () override
 
void initialize_charge_density_from_atomic_superposition ()
 
void initialize_representation () override
 
void initialize_single_particle_states () override
 
bool is_at_band_path_segment_boundary (int kpoint_index) const
 
bool is_iteration_converged () const override
 
const std::vector< Complex > & local_ionic_potential_g () const override
 
void log_pseudopotential_summary (int number_of_atomic_wavefunctions) const
 
void propagate_wavefunctions_backward (int source_kpoint_state_index, int target_kpoint_state_index)
 
void propagate_wavefunctions_to_next_kpoint (int current_kpoint_state_index, int total_kpoint_states)
 
std::vector< std::vector< Complex > > read_saved_bands (int kpoint_index) const
 
void report_memory_estimate (int number_of_atomic_wavefunctions) const
 
void report_unconverged_solve (int kpoint_index_state) const
 
void setup_hubbard ()
 
void solve_single_particle_states () override
 
bool take_saved_starting_wavefunctions (int kpoint_index, std::vector< std::vector< Complex > > &starting_wavefunctions) const
 
- Protected Member Functions inherited from q3::PlanewaveKohnShamSCFIterator
void allocate_electronic_states ()
 
void build_kpoint_plane_wave_data ()
 
Real compute_delta_escf_correction () const override
 
Real compute_density_residual (const std::vector< std::vector< Real > > &input_density_for_mixing) const override
 
void compute_energy_components () override
 
Real compute_local_residual_between (const std::vector< std::vector< Real > > &density_in, const std::vector< std::vector< Real > > &density_out) const
 
Real compute_number_of_electrons () const
 
Real compute_residual_between (const std::vector< std::vector< Real > > &density_in, const std::vector< std::vector< Real > > &density_out) const
 
Real effective_charge_density_energy_cutoff () const
 
Real hartree_metric_prefactor () const
 
void initiate_mixer () override
 
void log_representation_summary () const
 
Real magnetization_metric_weight () const
 
void mix_density (const std::vector< std::vector< Real > > &input_density_for_mixing) override
 
const PlanewaveKohnShamEnergies & planewave_energies () const
 
PlanewaveKohnShamEnergies & planewave_energies_mutable ()
 
void report_convergence_details () override
 
void report_first_iteration_details () override
 
int resolve_number_of_bands () const
 
void set_diagonalization_tolerance (int iteration) override
 
void set_diagonalizer_tolerance (Real tolerance) override
 
void update_effective_potential () override
 
void update_occupations () override
 
void warn_if_total_charge_deviates () const
 
- Protected Member Functions inherited from q3::KohnShamSCFIterator
const KohnShamSCFIteratorConfig & config () const
 
Real diagonalization_threshold () const
 
void finalize () override
 
void initialize () override
 Base implementation prints the SCF banner. Children call SCFIterator::initialize() last.
 
void log_iteration_energy (Real delta_energy)
 Single source of truth for the per-iteration energy/convergence log line.
 
void perform_iteration () override
 
void report_convergence () override
 
void report_iteration () override
 
void report_non_convergence () override
 
- Protected Member Functions inherited from q3::SCFIterator
virtual void iterate ()
 Main iteration loop.
 
virtual void report ()
 Report convergence or non-convergence after iterate() finishes.
 

Protected Attributes

std::vector< std::vector< Complex > > cached_augmented_density_g_
 
std::vector< std::vector< Real > > charge_density_real_smooth_
 
std::vector< std::vector< Real > > convergence_output_density_smooth_
 
UltrasoftPlanewaveEffectivePotential nonlocal_effective_potential_
 
Matrix< Real > projector_overlap_coefficients_
 
std::vector< Matrix< Real > > projector_overlap_coefficients_by_spin_
 
- Protected Attributes inherited from q3::PlanewavePseudopotentialKohnShamSCFIterator
std::vector< Real > atomic_starting_magnetization_
 
std::vector< std::pair< std::string, Vector3D > > band_path_
 
int band_path_points_per_segment_ = 20
 
std::vector< q3::Matrix< Complex > > cached_hubbard_projectors_
 
std::vector< q3::Matrix< Complex > > cached_kleinman_bylander_projectors_
 Cached KB projectors per k-point (reused by the projector overlap accumulation).
 
std::vector< SymmetryOperation > cached_symmetry_operations_
 
std::string calculation_ = "self_consistent_field"
 
NormConservingPlanewaveKohnShamEnergies energies_
 
std::vector< std::vector< Complex > > hubbard_d_matrix_per_spin_
 
std::vector< HubbardManifold > hubbard_manifolds_
 DFT+U (Hubbard): resolved atom/shell manifolds; empty means no correction is active.
 
HubbardOccupationMixer hubbard_occupation_mixer_
 Owns the damping/Anderson state; see HubbardOccupationMixer.
 
Real hubbard_occupation_residual_ {std::numeric_limits<Real>::max()}
 
std::vector< std::vector< Real > > hubbard_occupation_traces_
 
Real hubbard_potential_energy_ {0.0}
 Σ_σ Tr[V_U^σ n^σ]; see hubbard_potential_energy().
 
int hubbard_seed_iterations_remaining_ = 0
 
const PseudopotentialSet * pseudopotential_set_ = nullptr
 
std::shared_ptr< NormConservingPlanewaveKohnShamQuantumSystem > quantum_system_snapshot_
 
std::vector< Real > starting_magnetization_
 
bool symmetry_operations_cached_ {false}
 
int total_hubbard_orbitals_ = 0
 
- Protected Attributes inherited from q3::PlanewaveKohnShamSCFIterator
std::vector< Real > cached_local_ionic_potential_real_
 Cached real-space ionic local potential (constant during SCF, avoids repeated FFTs).
 
std::unique_ptr< PlanewaveChargeDensityAccumulator > charge_density_accumulator_
 Accumulates real-space charge density from wavefunctions each SCF iteration.
 
Real charge_density_energy_cutoff_ = 0.0
 
std::vector< std::vector< Real > > convergence_output_density_
 Converged output density snapshot, restored once self-consistency is reached.
 
PlanewaveChargeDensitySymmetrizer density_symmetrizer_
 
std::string diagonalization_method_ = "davidson"
 
std::unique_ptr< PlanewaveDiagonalizer > diagonalizer_
 
std::unique_ptr< PlanewaveKohnShamEnergyCalculator > energy_calculator_
 Computes band energy and smearing entropy from the occupied Kohn-Sham states.
 
execution::PlanewaveExecutionPolicy * execution_policy_ = nullptr
 
PlanewaveFermiEnergyCalculator fermi_energy_calculator_
 
const KPointsGrid * kpoint_grid_ = nullptr
 
std::optional< Magnetization > magnetization_
 Set by report_convergence_details(); see magnetization() above.
 
std::optional< int > nscf_override_maximum_iterations_
 
std::optional< Real > nscf_override_tolerance_
 
int number_of_bands_ {0}
 
Real number_of_electrons_ {0.0}
 
int number_of_smooth_g_vectors_ {0}
 
std::unique_ptr< execution::PlanewaveExecutionPolicy > owned_execution_policy_
 
PlanewaveBasis planewave_basis_
 
PlanewaveKohnShamQuantumSystem quantum_system_
 
bool replicated_plane_wave_fallback_active_ = false
 
bool report_unconverged_bands_ = false
 
Real wavefunction_energy_cutoff_ = 30.0
 
- Protected Attributes inherited from q3::KohnShamSCFIterator
std::vector< Complex > charge_density_g_
 
std::vector< std::vector< Real > > charge_density_real_
 
Real density_residual_ {0.0}
 
Real diagonalizer_tolerance_ {0.0}
 
std::unique_ptr< XCFunctional > exchange_correlation_
 
std::vector< Complex > exchange_correlation_potential_g_
 
bool first_iteration_rediag_done_ {false}
 
bool has_preloaded_charge_density_ {false}
 
bool has_preloaded_effective_potential_ {false}
 
std::unique_ptr< Mixer > mixer_
 
bool preloaded_charge_density_is_a_starting_guess_ {false}
 Set by offer_starting_charge_density(): a density that need not fit.
 
std::vector< std::vector< Real > > real_space_potential_
 
std::vector< ScfIterationRecord > scf_history_
 
std::unique_ptr< SmearingScheme > smearing_scheme_
 
Real total_energy_previous_ {0.0}
 
std::vector< Complex > total_potential_g_
 
std::vector< std::vector< Complex > > total_potential_g_by_spin_
 
- Protected Attributes inherited from q3::SCFIterator
Real convergence_threshold_
 
Crystal * crystal_structure_
 
bool is_converged_ {false}
 
int iteration_ {0}
 
int maximum_iterations_
 

Additional Inherited Members

- Public Attributes inherited from q3::KohnShamSCFIterator
KohnShamSCFIteratorConfig config_
 
std::string exchange_correlation_functional_
 
int methfessel_paxton_order_
 
Real mixing_beta_
 
int mixing_history_size_
 
std::string mixing_mode_
 
std::string mixing_preconditioning_
 
Real mixing_q0_
 
std::string smearing_
 
Real smearing_width_
 

Detailed Description

Definition at line 27 of file init.hpp.

Constructor & Destructor Documentation

◆ UltrasoftPlanewavePseudopotentialKohnShamSCFIterator()

q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator ( KohnShamSCFIteratorConfig  config)
inlineexplicit

Definition at line 30 of file init.hpp.

◆ ~UltrasoftPlanewavePseudopotentialKohnShamSCFIterator()

q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::~UltrasoftPlanewavePseudopotentialKohnShamSCFIterator ( )
overridedefault

Member Function Documentation

◆ accumulate_projector_overlaps()

virtual void q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::accumulate_projector_overlaps ( )
inlineprotectedvirtual

Accumulate the per-atom projector overlap coefficients from the bands.

Uses BLAS zgemm to compute all <beta|psi> overlaps in a single call instead of per-projector-per-band zdotc calls. Virtual so PAW can damp the result before it is used.

The coefficients feed two things — the augmentation charge on the grid and, for PAW, the on-site D matrix — and the second closes a loop that the density mixer cannot reach: ρ_ij is recomputed from fresh ψ every step, so its feedback gain is 1 no matter how small the mixing beta. That is harmless while the on-site terms are small, and not harmless for a dataset with a stiff channel, which is why PAW overrides this.

G=0 correction. The 2 Re sum above counts the origin twice, so the rank whose plane-wave list begins with G = 0 removes one copy. The density list cannot answer that: it is complete on every rank, so asking it whether G = 0 comes first says yes on every rank of a shared pool, and each rank without the origin subtracted its first stored plane wave instead.

Band-parallel ranks own disjoint G-vector slabs, so BLAS has produced only each rank's partial <beta|psi>. Complete those amplitudes before forming rho_ij = <psi|beta_i><beta_j|psi>. Reducing rho_ij afterward is not equivalent because it omits cross-rank products. The later reduce_vector remains the separate across-pool sum over distinct k-points.

projector_overlaps is column-major (total_projectors × occupied_bands)

Reimplemented in q3::PawPlanewavePseudopotentialKohnShamSCFIterator.

Definition at line 258 of file init.hpp.

References q3::PlanewavePseudopotentialKohnShamSCFIterator::cached_kleinman_bylander_projectors_, q3::KohnShamSCFIterator::crystal_structure(), q3::blas::dgemm_(), q3::PlanewaveKohnShamSCFIterator::execution_policy_, q3::PlanewaveBasis::gamma_origin_is_local(), q3::PlanewaveBasis::is_gamma_only(), q3::PlanewaveKohnShamSCFIterator::kpoint_grid(), q3::Crystal::number_of_atoms(), q3::PlanewaveKohnShamSCFIterator::number_of_bands_, q3::PlanewaveKohnShamSCFIterator::number_of_kpoint_states(), q3::KPointsGrid::number_of_kpoints(), q3::PlanewaveKohnShamSCFIterator::number_of_plane_waves(), q3::SCFIterator::number_of_spin_components(), q3::PlanewaveKohnShamSCFIterator::occupation(), q3::PlanewaveKohnShamQuantumSystem::occupation_by_kpoint_state_index_and_band_index(), q3::math::tolerances::occupation_threshold, q3::PlanewaveKohnShamSCFIterator::planewave_basis_, projector_overlap_coefficients_, projector_overlap_coefficients_by_spin_, q3::PlanewaveKohnShamSCFIterator::quantum_system_, q3::PlanewavePseudopotentialKohnShamSCFIterator::quantum_system_snapshot_, q3::Matrix< T >::raw(), q3::execution::PlanewaveExecutionPolicy::reduce_vector(), q3::execution::ExecutionPolicy::reduce_within_group(), reset_projector_overlap_coefficients(), q3::Crystal::species_type_index(), q3::PlanewaveKohnShamQuantumSystem::wavefunction_band_data(), and q3::blas::zgemm_().

Referenced by q3::PawPlanewavePseudopotentialKohnShamSCFIterator::accumulate_projector_overlaps(), and construct_density_from_states().

◆ add_augmentation_to_charge_density()

void q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::add_augmentation_to_charge_density ( )
inlineprotected

Add the compensation charge n̂ to the smooth density, per spin channel.

The augmentation charge is built from ρ_ij, and ρ_ij is spin-resolved, so each channel gets its own n̂ from its own occupancies. That matters far more than it sounds: in a 3d metal almost the entire moment lives inside the augmentation spheres, so how n̂ is divided between the channels is the magnetization.

This used to add one total n̂ and split it by the ratio of the smooth densities, which forces the on-site polarization to match the interstitial polarization — small, and nearly unpolarized. Nickel came out at 1e-4 Bohr magnetons against a PBE moment near 0.6.

projector_overlap_coefficients_by_spin_ is empty only on paths that never accumulated it; falling back to the spin-summed array then reproduces the old single-channel behaviour rather than adding nothing.

Definition at line 474 of file init.hpp.

References cached_augmented_density_g_, q3::UltrasoftPlanewaveEffectivePotential::cached_structure_factors(), q3::KohnShamSCFIterator::charge_density_real_, q3::KohnShamSCFIterator::crystal_structure(), nonlocal_effective_potential_, q3::SCFIterator::number_of_spin_components(), q3::PlanewaveKohnShamSCFIterator::planewave_basis_, projector_overlap_coefficients_, projector_overlap_coefficients_by_spin_, q3::PlanewaveBasis::rho_g_to_r(), q3::PlanewaveBasis::rho_r_to_g(), and ultrasoft_quantum_system().

Referenced by construct_density_from_states().

◆ construct_density_from_states()

◆ input_density_for_mixing()

std::vector< std::vector< Real > > q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::input_density_for_mixing ( ) const
inlineoverrideprotectedvirtual

Reimplemented from q3::PlanewaveKohnShamSCFIterator.

Definition at line 186 of file init.hpp.

References q3::KohnShamSCFIterator::charge_density_real_.

◆ mutable_ultrasoft_quantum_system()

UltrasoftPlanewaveKohnShamQuantumSystem & q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::mutable_ultrasoft_quantum_system ( )
inlineprotected

Definition at line 93 of file init.hpp.

Referenced by prepare_hamiltonian().

◆ nonlocal_potentials_by_spin()

std::vector< std::vector< Complex > > q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::nonlocal_potentials_by_spin ( ) const
inlineprotected

The nonlocal D matrix is built per spin channel.

D_ij = D_ion + ∫v_eff·Q_ij, and for a spin-polarized system v_eff differs between channels, so D does too. It used to be built once from the spin average and shared: exact for a non-magnetic cell, and for a magnetic one it collapsed the moment — nickel with a PAW dataset converged to 1e-4 Bohr magnetons against a PBE moment near 0.64, which the norm-conserving path reproduces at 0.605. Norm-conserving was never affected because its D_ion is a constant with no v_eff dependence, which is why Q3's LSDA validation — all of it norm-conserving — passed and said nothing about this.

nonlocal_potentials_by_spin() returns one entry per channel, or a single averaged entry when the per-spin copies are unavailable, so the unpolarized path is bit-for-bit what it was. The potential each spin channel's D should be built from.

Falls back to a single entry holding the spin average whenever the per-spin copies are absent, which keeps every non-spin-polarized path and every path that predates them behaving exactly as before.

Definition at line 122 of file init.hpp.

References q3::KohnShamSCFIterator::total_potential_g_, and q3::KohnShamSCFIterator::total_potential_g_by_spin_.

Referenced by prepare_hamiltonian().

◆ on_charge_density_initialized()

void q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::on_charge_density_initialized ( )
inlineoverrideprotectedvirtual

Hook invoked once the initial atomic-superposition charge density is ready.

Default no-op. The ultrasoft subclass overrides it to initialise the smooth density and projector overlap storage.

Reimplemented from q3::PlanewaveKohnShamSCFIterator.

Definition at line 196 of file init.hpp.

References q3::KohnShamSCFIterator::charge_density_real_, charge_density_real_smooth_, q3::SCFIterator::number_of_spin_components(), and reset_projector_overlap_coefficients().

Referenced by q3::PawPlanewavePseudopotentialKohnShamSCFIterator::on_charge_density_initialized().

◆ prepare_hamiltonian()

◆ projector_overlap_coefficients()

const Matrix< Real > & q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::projector_overlap_coefficients ( ) const
inlineoverridevirtual

Overlap coefficients ⟨β_i|ψ_nk⟩ at convergence.

Returns an empty matrix for norm-conserving calculations. The ultrasoft iterator overrides this to return the accumulated coefficients.

Reimplemented from q3::PlanewavePseudopotentialKohnShamSCFIterator.

Definition at line 34 of file init.hpp.

References projector_overlap_coefficients_.

◆ reset_projector_overlap_coefficients()

void q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::reset_projector_overlap_coefficients ( )
inlineprotected

◆ restore_density_at_convergence()

void q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::restore_density_at_convergence ( )
inlineoverrideprotectedvirtual

◆ result()

NormConservingPlanewaveKohnShamSCFState q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::result ( ) const
inlineoverridevirtual

Assemble and return a snapshot of the converged SCF state.

The ultrasoft subclass overrides this to inject the effective D-matrix into the snapshot.

Copy the converged effective D-matrix into the snapshot's owned storage. Without this, d_matrix_element() falls back to bare_d_matrix_element() which uses channel indices (0..number_of_channels-1) on the radial d_ion_matrix (size nbeta × nbeta), causing an out-of-bounds access → SIGSEGV for USPP.

Share the existing quantum system snapshot instead of creating a new one. The PP basis (beta tables, local potential, core charge) is expensive to initialize, and we only need a read-only view for forces/stress/IO.

Reimplemented from q3::PlanewavePseudopotentialKohnShamSCFIterator.

Definition at line 38 of file init.hpp.

References nonlocal_effective_potential_, q3::NormConservingPlanewaveKohnShamSCFState::projector_overlap_coefficients, projector_overlap_coefficients_, q3::NormConservingPlanewaveKohnShamSCFState::projector_overlap_coefficients_by_spin, projector_overlap_coefficients_by_spin_, q3::NormConservingPlanewaveKohnShamSCFState::quantum_system_snapshot_, q3::PlanewavePseudopotentialKohnShamSCFIterator::result(), and q3::UltrasoftPlanewaveKohnShamQuantumSystem::set_nonlocal_effective_potential().

◆ snapshot_output_density()

void q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::snapshot_output_density ( )
inlineoverrideprotectedvirtual

◆ snapshot_smooth_density()

void q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::snapshot_smooth_density ( )
inlineprotected

◆ symmetrize_density()

void q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::symmetrize_density ( )
inlineoverrideprotectedvirtual

◆ synchronize_smooth_density_from_mixed()

void q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::synchronize_smooth_density_from_mixed ( )
inlineoverrideprotectedvirtual

Hook for representations that keep an auxiliary density (e.g. the smooth pre-augmentation density of ultrasoft pseudopotential_set). No-op by default.

Reimplemented from q3::KohnShamSCFIterator.

Definition at line 190 of file init.hpp.

References q3::KohnShamSCFIterator::charge_density_real_, charge_density_real_smooth_, and q3::SCFIterator::number_of_spin_components().

◆ ultrasoft_quantum_system()

const UltrasoftPlanewaveKohnShamQuantumSystem & q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::ultrasoft_quantum_system ( ) const
inlineprotected

Access the ultrasoft quantum system (downcast).

Definition at line 88 of file init.hpp.

References q3::PlanewavePseudopotentialKohnShamSCFIterator::quantum_system_snapshot_.

Referenced by add_augmentation_to_charge_density(), and prepare_hamiltonian().

Member Data Documentation

◆ cached_augmented_density_g_

std::vector<std::vector<Complex> > q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::cached_augmented_density_g_
protected

Cached G-space augmented density from construct_density_from_states. Used by symmetrize_density to avoid a redundant R→G FFT.

Definition at line 83 of file init.hpp.

Referenced by add_augmentation_to_charge_density(), and symmetrize_density().

◆ charge_density_real_smooth_

std::vector<std::vector<Real> > q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::charge_density_real_smooth_
protected

Smooth (pre-augmentation) charge density used by ultrasoft pseudopotential_set, plus its converged snapshot restored at self-consistency.

Definition at line 76 of file init.hpp.

Referenced by on_charge_density_initialized(), restore_density_at_convergence(), snapshot_output_density(), snapshot_smooth_density(), and synchronize_smooth_density_from_mixed().

◆ convergence_output_density_smooth_

std::vector<std::vector<Real> > q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::convergence_output_density_smooth_
protected

Definition at line 77 of file init.hpp.

Referenced by restore_density_at_convergence(), and snapshot_output_density().

◆ nonlocal_effective_potential_

UltrasoftPlanewaveEffectivePotential q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::nonlocal_effective_potential_
protected

Definition at line 70 of file init.hpp.

Referenced by add_augmentation_to_charge_density(), prepare_hamiltonian(), and result().

◆ projector_overlap_coefficients_

◆ projector_overlap_coefficients_by_spin_

std::vector<Matrix<Real> > q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::projector_overlap_coefficients_by_spin_
protected

The same coefficients per spin channel, un-summed.

projector_overlap_coefficients_ above is accumulated over kpoint_index_state, which folds spin in, so by the time it is read the two channels are indistinguishable. That is what the augmentation charge on the grid wants — it is a total density — but the PAW one-center terms need ρ↑ and ρ↓ apart, because exchange-correlation is nonlinear in the spin density. Kept as a parallel array rather than reshaping the primary one so every existing ultrasoft consumer is untouched.

Definition at line 69 of file init.hpp.

Referenced by accumulate_projector_overlaps(), q3::PawPlanewavePseudopotentialKohnShamSCFIterator::accumulate_projector_overlaps(), add_augmentation_to_charge_density(), q3::PawPlanewavePseudopotentialKohnShamSCFIterator::one_center_occupations(), reset_projector_overlap_coefficients(), and result().


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