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

#include <init.hpp>

+ Inheritance diagram for q3::PawPlanewavePseudopotentialKohnShamSCFIterator:

Public Member Functions

 PawPlanewavePseudopotentialKohnShamSCFIterator (KohnShamSCFIteratorConfig config)
 
 ~PawPlanewavePseudopotentialKohnShamSCFIterator () override=default
 
void load_one_center_occupations (const std::vector< Matrix< Real > > &occupations_by_spin) override
 
std::vector< Matrix< Real > > one_center_occupations () const override
 
bool requires_one_center_occupations () const override
 
- Public Member Functions inherited from q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator
 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
 
const NormConservingPlanewaveKohnShamQuantumSystem & norm_conserving_quantum_system () const
 
void offer_starting_wavefunctions (std::string save_directory)
 
const PseudopotentialSet & pseudopotential_set () const
 
void refresh_quantum_system_snapshot ()
 
void release_scf_workspace () override
 
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

void accumulate_projector_overlaps () override
 
Real compute_double_counting_correction () const override
 
void compute_energy_components () override
 
void construct_density_from_states () override
 
Real damp_towards_previous (Matrix< Real > &current_matrix, Matrix< Real > &previous_matrix) const
 
bool is_iteration_converged () const override
 
void on_charge_density_initialized () override
 
void prepare_hamiltonian () override
 
void report_convergence_details () override
 
- Protected Member Functions inherited from q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator
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

Real occupancy_residual_ {std::numeric_limits<Real>::max()}
 
paw_one_center::OnSiteOccupationSymmetrizer occupation_symmetrizer_
 
Real one_center_band_energy_term_ {0.0}
 
Real one_center_scf_correction_ {0.0}
 
paw_one_center::PawOneCenterTerms one_center_terms_
 
std::vector< Matrix< Real > > output_projector_overlaps_by_spin_
 
std::vector< Matrix< Real > > preloaded_one_center_occupations_
 
Matrix< Real > previous_projector_overlaps_
 
std::vector< Matrix< Real > > previous_projector_overlaps_by_spin_
 
- Protected Attributes inherited from q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator
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_
 

Static Protected Attributes

static constexpr Real occupancy_damping_ = 0.4
 

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 60 of file init.hpp.

Constructor & Destructor Documentation

◆ PawPlanewavePseudopotentialKohnShamSCFIterator()

q3::PawPlanewavePseudopotentialKohnShamSCFIterator::PawPlanewavePseudopotentialKohnShamSCFIterator ( KohnShamSCFIteratorConfig  config)
inlineexplicit

Definition at line 63 of file init.hpp.

◆ ~PawPlanewavePseudopotentialKohnShamSCFIterator()

q3::PawPlanewavePseudopotentialKohnShamSCFIterator::~PawPlanewavePseudopotentialKohnShamSCFIterator ( )
overridedefault

Member Function Documentation

◆ accumulate_projector_overlaps()

void q3::PawPlanewavePseudopotentialKohnShamSCFIterator::accumulate_projector_overlaps ( )
inlineoverrideprotectedvirtual

Damp ρ_ij between iterations, the way QE mixes rhobec alongside the density.

Without this the on-site occupancies are recomputed from fresh ψ every step and fed straight back through D, a loop with gain 1 that the density mixer cannot damp — lowering the mixing beta does nothing to it, which is how the problem identifies itself. Whether that matters is a property of the dataset: Q3 converges Si and C undamped, but the PseudoDojo Cu PAW dataset has a second p channel carrying an augmentation charge of 25.2 electrons and D_ion of −71.8 Ry, giving a one-center D of ~217 Ry, and the loop oscillates between two states ±212 Ry apart until it is damped.

Linear damping rather than the full mixer: the fixed point is unchanged either way, since at self-consistency the new and old occupancies are equal, so this only sets how fast the loop is allowed to move. Feeding ρ_ij through the density mixer as QE does would converge stiff cases in fewer iterations, and is the upgrade if one proves too slow.

The damped array is what the augmentation charge on the grid sees too, which is deliberate: the density and the on-site terms have to be built from the same occupancies or the energy is not a functional of one state.

The per-spin arrays are damped by the same factor and in the same step. Damping them independently, or damping only the total, would let ρ↑ + ρ↓ drift away from the total the augmentation charge on the grid was built from, and the energy would stop being a functional of one state.

Reimplemented from q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator.

Definition at line 218 of file init.hpp.

References q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::accumulate_projector_overlaps(), damp_towards_previous(), occupancy_residual_, output_projector_overlaps_by_spin_, previous_projector_overlaps_, previous_projector_overlaps_by_spin_, q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::projector_overlap_coefficients_, and q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::projector_overlap_coefficients_by_spin_.

◆ compute_double_counting_correction()

Real q3::PawPlanewavePseudopotentialKohnShamSCFIterator::compute_double_counting_correction ( ) const
inlineoverrideprotectedvirtual

−Σ_a Σ_ij ρ_ij D^oc_ij, on top of the base's −∫ρ·V_Hxc.

The base's term corrects for the grid potential inside the band energy; this corrects for the on-site potential that entered it through D. They are the same correction applied to two different parts of the same sum, which is why this adds rather than replaces.

Three occupancy arrays are in play by the time the energy is assembled, and each term has to use the right one:

ρ^in built the D this iteration's Hamiltonian was diagonalized with ρ^out the projections of the ψ that came out of it ρ^mix the damped array the next iteration will start from, which is also what E¹ and the refreshed D^oc are now built from

The band energy contains Σ ρ^out · D^oc(ρ^in), so that is what is removed, and E¹ is evaluated at ρ^mix with the first-order term that carries it back to ρ^out:

E¹(ρ^out) ≈ E¹(ρ^mix) − Σ (ρ^mix − ρ^out) · D^oc(ρ^mix)

which is the one-centre half of the SCF correction and the same expansion compute_delta_escf_correction makes for the grid. With both, the reported energy is second order in the residual of either channel. Quantum ESPRESSO's delta_escf carries the same PAW term.

What this used to subtract was Σ ρ^mix · D^oc(ρ^mix), mixed against refreshed, while the band energy holds out against input. The difference, Σ ρ^out · (D^oc(ρ^mix) − D^oc(ρ^in)), is first order in the step the damping takes, and the damping takes a fixed fraction of the residual – so the energy carried an error first order in the on-site residual. On silicon PAW at Γ that kept the energy drifting by ~3e-9 Ry per iteration after the density residual had reached 1e-14, and left a run stopped at a 1e-12 threshold 6e-9 Ry from where it settles.

At self-consistency the three arrays coincide and this reduces to the old expression, so a converged energy does not move; what moves is how close an unconverged one already is.

Implements q3::KohnShamSCFIterator.

Definition at line 322 of file init.hpp.

References q3::KohnShamSCFIterator::compute_double_counting_correction(), one_center_band_energy_term_, and one_center_scf_correction_.

◆ compute_energy_components()

void q3::PawPlanewavePseudopotentialKohnShamSCFIterator::compute_energy_components ( )
inlineoverrideprotectedvirtual

Compute sub-components (e.g. band energy, entropy) needed for total(). Default no-op; override in representations that compute eagerly.

Reimplemented from q3::KohnShamSCFIterator.

Definition at line 362 of file init.hpp.

References q3::KohnShamSCFIterator::compute_energy_components(), q3::PlanewavePseudopotentialKohnShamSCFIterator::energies_, q3::paw_one_center::PawOneCenterTerms::energy(), q3::NormConservingPlanewaveKohnShamEnergies::one_center_energy, and one_center_terms_.

◆ construct_density_from_states()

void q3::PawPlanewavePseudopotentialKohnShamSCFIterator::construct_density_from_states ( )
inlineoverrideprotectedvirtual

A run given the converged occupations keeps the one-centre term built from them. The ones just accumulated come from this run's own k-points and occupations – a band path's, say – and rebuilding the term from them would hand the first-iteration re-diagonalization a different D than the pass it repeats.

D still holds the one-centre term built from ρ^in – the one the Hamiltonian just diagonalized used – so this is the moment to contract it with ρ^out.

Implements q3::KohnShamSCFIterator.

Definition at line 164 of file init.hpp.

References q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::construct_density_from_states(), q3::log::info(), one_center_band_energy_term_, output_projector_overlaps_by_spin_, and preloaded_one_center_occupations_.

◆ damp_towards_previous()

Real q3::PawPlanewavePseudopotentialKohnShamSCFIterator::damp_towards_previous ( Matrix< Real > &  current_matrix,
Matrix< Real > &  previous_matrix 
) const
inlineprotected

One damping step, in place; seeds previous on the first call.

Returns ‖fresh − damped‖² for that array, or the unconverged sentinel on the seeding call, where there is no previous array to have moved away from and zero would be a false "already converged".

Definition at line 286 of file init.hpp.

References occupancy_damping_, and q3::Matrix< T >::raw().

Referenced by accumulate_projector_overlaps().

◆ is_iteration_converged()

bool q3::PawPlanewavePseudopotentialKohnShamSCFIterator::is_iteration_converged ( ) const
inlineoverrideprotectedvirtual

The density residual alone cannot see the on-site channel.

ρ_ij is a second self-consistent quantity with its own feedback loop, damped here at a fixed rate rather than driven by the density mixer, and it converges more slowly than the density and with a period-2 oscillation. Measured on Cu PAW at 80 Ry, the density residual runs two to four orders of magnitude below ‖δρ_ij‖² near convergence, and the gap widens as the run proceeds: at dr2 = 1.5e-13 the occupancy residual is still 6.7e-10. ρ_ij reaches the grid only through the compensation charge, which is confined to the augmentation sphere and so sits at the high-|G| end the Hartree metric's 1/|G|² weight suppresses, while the one-center energy integrates it unweighted. Exiting on dr2 alone therefore stops while E¹ − Ẽ¹ is still moving, and because the one-center channel has no first-order SCF correction of its own (the delta_escf analogue that makes the grid part second-order in its error), that residual motion lands in the total energy at first order. On Cu at 80 Ry that left ~0.6 mRy of scatter in the total energy while the stress on the same runs moved only ~0.4 kbar, which is why the defect reads as an energy-only one: the stress is evaluated once from the final state rather than assembled across iterations, so it carries no analogous first-order term.

Same reasoning, same shape as the DFT+U occupation-matrix gate in PlanewavePseudopotentialKohnShamSCFIterator::is_iteration_converged(): the density can be self-consistent while a potential built from a still-relaxing occupancy is not.

occupancy_residual_ is refreshed in accumulate_projector_overlaps(), which perform_iteration() always runs before this is checked, so it is never stale by an iteration. It is computed from arrays the ultrasoft accumulation has already pool- and band-reduced, by pure arithmetic with a rank-invariant damping scalar, so it needs no reduction of its own – unlike density_residual_, whose per-rank FFTW plan noise does.

Reimplemented from q3::KohnShamSCFIterator.

Definition at line 274 of file init.hpp.

References q3::SCFIterator::convergence_threshold_, q3::SCFIterator::is_iteration_converged(), and occupancy_residual_.

◆ load_one_center_occupations()

void q3::PawPlanewavePseudopotentialKohnShamSCFIterator::load_one_center_occupations ( const std::vector< Matrix< Real > > &  occupations_by_spin)
inlineoverridevirtual

Hand over ρ_ij from a checkpoint, so D's one-centre term is built from the converged occupations before the first Hamiltonian and stays so for the whole run. Call after construction and before run(), like load_effective_potential(). Nothing to do where D has no such term.

Reimplemented from q3::PlanewavePseudopotentialKohnShamSCFIterator.

Definition at line 76 of file init.hpp.

References preloaded_one_center_occupations_.

◆ on_charge_density_initialized()

void q3::PawPlanewavePseudopotentialKohnShamSCFIterator::on_charge_density_initialized ( )
inlineoverrideprotectedvirtual

◆ one_center_occupations()

std::vector< Matrix< Real > > q3::PawPlanewavePseudopotentialKohnShamSCFIterator::one_center_occupations ( ) const
inlineoverridevirtual

The on-site occupations ρ_ij per spin channel, which the checkpoint stores: what D's one-centre term is built from. Empty wherever D has no such term; the PAW iterator overrides this.

Reimplemented from q3::PlanewavePseudopotentialKohnShamSCFIterator.

Definition at line 67 of file init.hpp.

References q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::projector_overlap_coefficients_by_spin_.

◆ prepare_hamiltonian()

void q3::PawPlanewavePseudopotentialKohnShamSCFIterator::prepare_hamiltonian ( )
inlineoverrideprotectedvirtual

The base wired its own D into the quantum system; the one-center term is added to that same matrix in place, so nothing downstream needs to know a PAW branch exists.

Reimplemented from q3::KohnShamSCFIterator.

Definition at line 304 of file init.hpp.

References q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::prepare_hamiltonian().

◆ report_convergence_details()

void q3::PawPlanewavePseudopotentialKohnShamSCFIterator::report_convergence_details ( )
inlineoverrideprotectedvirtual

Representation-specific tail of the convergence report (eigenvalues, magnetization, final energy breakdown). Generic banner lives in report_convergence().

Second rung of the failure ladder. Printed in QE's labels and order for readability, but see BranchTotals: QE's four values are on a different footing and are not directly differenceable against these.

Implements q3::KohnShamSCFIterator.

Definition at line 367 of file init.hpp.

References q3::paw_one_center::PawOneCenterTerms::branch_totals(), q3::log::info(), one_center_terms_, and q3::KohnShamSCFIterator::report_convergence_details().

◆ requires_one_center_occupations()

bool q3::PawPlanewavePseudopotentialKohnShamSCFIterator::requires_one_center_occupations ( ) const
inlineoverridevirtual

Whether a non-self-consistent pass must be handed those occupations before it diagonalizes – true exactly where D carries a one-centre term.

Reimplemented from q3::PlanewavePseudopotentialKohnShamSCFIterator.

Definition at line 71 of file init.hpp.

Member Data Documentation

◆ occupancy_damping_

constexpr Real q3::PawPlanewavePseudopotentialKohnShamSCFIterator::occupancy_damping_ = 0.4
staticconstexprprotected

How far ρ_ij is allowed to move per iteration. Chosen to be loose enough that Si and C converge in the same iteration count they did undamped, and tight enough to hold the stiff Cu channel.

Definition at line 147 of file init.hpp.

Referenced by damp_towards_previous().

◆ occupancy_residual_

Real q3::PawPlanewavePseudopotentialKohnShamSCFIterator::occupancy_residual_ {std::numeric_limits<Real>::max()}
protected

‖ρ_ij^fresh − ρ_ij^damped‖² — how far the occupancies just accumulated from ψ are from the ones that built D for this iteration, before the damping factor scales the step actually taken. Same squared-magnitude convention density_residual_ uses, and the same role hubbard_occupation_residual_ plays for DFT+U: it is what tells the SCF that the on-site channel is still moving.

Large sentinel until the first real damping step, so it can never make a run look converged before ρ_ij has been compared against anything.

Definition at line 140 of file init.hpp.

Referenced by accumulate_projector_overlaps(), and is_iteration_converged().

◆ occupation_symmetrizer_

paw_one_center::OnSiteOccupationSymmetrizer q3::PawPlanewavePseudopotentialKohnShamSCFIterator::occupation_symmetrizer_
protected

The point-group average of ρ_ij, built once from this cell's operations.

Inactive — and symmetrize() a no-op — whenever the density symmetrizer is, which is the point: control.disable_symmetry, a Γ-only basis and a cell with no operation beyond the identity all stand this down as well, so the on-site channel and the grid never disagree about whether the run is imposing symmetry.

Definition at line 92 of file init.hpp.

◆ one_center_band_energy_term_

Real q3::PawPlanewavePseudopotentialKohnShamSCFIterator::one_center_band_energy_term_ {0.0}
protected

Σ ρ_ij^out · D^oc(ρ^in): the part of the band energy that D's one-centre term put there. Band energy is a sum over ψ_out, whose projections are ρ^out, against the Hamiltonian this iteration was diagonalized with, whose one-centre D was built from ρ^in – so this is what the double-counting term has to remove.

Definition at line 118 of file init.hpp.

Referenced by compute_double_counting_correction(), and construct_density_from_states().

◆ one_center_scf_correction_

Real q3::PawPlanewavePseudopotentialKohnShamSCFIterator::one_center_scf_correction_ {0.0}
protected

−Σ (ρ_ij^mix − ρ_ij^out) · D^oc(ρ^mix): the one-centre half of the SCF correction, the term that makes the reported energy second order in the on-site residual. The grid density has always had its half (compute_delta_escf_correction); see compute_double_counting_correction for why the one-centre channel needs one too.

Definition at line 127 of file init.hpp.

Referenced by compute_double_counting_correction().

◆ one_center_terms_

paw_one_center::PawOneCenterTerms q3::PawPlanewavePseudopotentialKohnShamSCFIterator::one_center_terms_
protected

◆ output_projector_overlaps_by_spin_

std::vector<Matrix<Real> > q3::PawPlanewavePseudopotentialKohnShamSCFIterator::output_projector_overlaps_by_spin_
protected

ρ_ij^out per spin: the occupancies this iteration's ψ produced, symmetrized, before damping replaces them with the next input. The energy needs all three arrays – in, out and mixed – and damping overwrites the out array in place, so this is the copy that survives.

Definition at line 109 of file init.hpp.

Referenced by accumulate_projector_overlaps(), and construct_density_from_states().

◆ preloaded_one_center_occupations_

std::vector<Matrix<Real> > q3::PawPlanewavePseudopotentialKohnShamSCFIterator::preloaded_one_center_occupations_
protected

ρ_ij handed over from a checkpoint, held until the one-centre engine is built and then kept as what D's one-centre term is built from. Empty for a self-consistent run, which builds the term from its own occupations.

Definition at line 99 of file init.hpp.

Referenced by construct_density_from_states(), load_one_center_occupations(), and on_charge_density_initialized().

◆ previous_projector_overlaps_

Matrix<Real> q3::PawPlanewavePseudopotentialKohnShamSCFIterator::previous_projector_overlaps_
protected

Definition at line 100 of file init.hpp.

Referenced by accumulate_projector_overlaps().

◆ previous_projector_overlaps_by_spin_

std::vector<Matrix<Real> > q3::PawPlanewavePseudopotentialKohnShamSCFIterator::previous_projector_overlaps_by_spin_
protected

Definition at line 101 of file init.hpp.

Referenced by accumulate_projector_overlaps().


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