#include <init.hpp>
Inheritance diagram for q3::SCFIterator:Public Member Functions | |
| 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. | |
| virtual Real | total_energy () const =0 |
| const std::vector< Real > & | total_energy_history_in_ry () const |
| virtual void | write_checkpoints (const std::string &output_directory, const std::string &prefix) const |
Protected Member Functions | |
| virtual void | finalize ()=0 |
| virtual void | initialize () |
| Base implementation prints the SCF banner. Children call SCFIterator::initialize() last. | |
| virtual bool | is_iteration_converged () const =0 |
| virtual void | iterate () |
| Main iteration loop. | |
| virtual void | perform_iteration ()=0 |
| virtual void | report () |
| Report convergence or non-convergence after iterate() finishes. | |
| virtual void | report_convergence ()=0 |
| virtual void | report_iteration ()=0 |
| virtual void | report_non_convergence ()=0 |
Protected Attributes | |
| Real | convergence_threshold_ |
| Crystal * | crystal_structure_ |
| bool | is_converged_ {false} |
| int | iteration_ {0} |
| int | maximum_iterations_ |
|
inlineexplicit |
|
virtualdefault |
|
protectedpure virtual |
Implemented in q3::KohnShamSCFIterator.
Referenced by iterate().
|
inlineprotectedvirtual |
Base implementation prints the SCF banner. Children call SCFIterator::initialize() last.
Run state, like the two above: a second run() reports its own trajectory rather than one appended to the previous run's.
Reimplemented in q3::KohnShamSCFIterator.
Definition at line 122 of file init.hpp.
References is_converged_, iteration_, and q3::log::section().
Referenced by q3::KohnShamSCFIterator::initialize(), and run().
|
inline |
Definition at line 42 of file init.hpp.
References is_converged_.
Referenced by q3::PlanewavePseudopotentialKohnShamSCFIterator::result(), q3::SelfConsistentFieldFlavor::run_calculation(), and q3::PlanewavePseudopotentialKohnShamSCFIterator::write_checkpoints().
|
protectedpure virtual |
Implemented in q3::KohnShamSCFIterator, q3::PlanewavePseudopotentialKohnShamSCFIterator, and q3::PawPlanewavePseudopotentialKohnShamSCFIterator.
Referenced by q3::PlanewavePseudopotentialKohnShamSCFIterator::is_iteration_converged(), q3::PawPlanewavePseudopotentialKohnShamSCFIterator::is_iteration_converged(), and iterate().
|
inlineprotectedvirtual |
Main iteration loop.
iteration_ is assigned from the loop counter rather than being it, so it never steps past the last iteration performed. Were it the counter, a run that exhausted its budget would leave it one past that budget, and the count read after run() – by the SCF state, the checkpoint header and the results file – would name an iteration that never ran.
Definition at line 135 of file init.hpp.
References finalize(), is_converged_, is_iteration_converged(), iteration_, maximum_iterations_, perform_iteration(), report_iteration(), and total_energy().
Referenced by run().
|
inline |
The iteration in progress while run() iterates, numbered from 1.
After run() it is the number of iterations performed, on either exit: the iteration the run converged on, or the whole budget when it did not.
Definition at line 39 of file init.hpp.
References iteration_.
Referenced by q3::PlanewavePseudopotentialKohnShamSCFIterator::result(), q3::SelfConsistentFieldFlavor::run_calculation(), q3::PlanewaveKohnShamSCFIterator::set_diagonalization_tolerance(), and q3::PlanewavePseudopotentialKohnShamSCFIterator::write_checkpoints().
|
inline |
Definition at line 45 of file init.hpp.
Referenced by q3::PlanewavePseudopotentialKohnShamSCFIterator::accumulate_hubbard_occupation_and_potential(), q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::accumulate_projector_overlaps(), q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::add_augmentation_to_charge_density(), q3::PlanewaveKohnShamSCFIterator::compute_delta_escf_correction(), q3::PlanewaveKohnShamSCFIterator::compute_double_counting_correction(), q3::PlanewaveKohnShamSCFIterator::compute_energy_components(), q3::PlanewaveKohnShamSCFIterator::compute_local_residual_between(), q3::PlanewaveKohnShamSCFIterator::construct_density_from_states(), q3::PlanewaveKohnShamSCFIterator::global_eigenvalues(), q3::KohnShamSCFIterator::initialize(), q3::PlanewaveKohnShamSCFIterator::initialize_representation(), q3::PlanewavePseudopotentialKohnShamSCFIterator::initialize_representation(), q3::PlanewavePseudopotentialKohnShamSCFIterator::initialize_single_particle_states(), q3::PlanewaveKohnShamSCFIterator::loaded_charge_density_fits_grid(), q3::PlanewaveKohnShamSCFIterator::log_representation_summary(), q3::PlanewaveKohnShamSCFIterator::mix_density(), q3::PlanewaveKohnShamSCFIterator::number_of_kpoint_states(), q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::on_charge_density_initialized(), q3::PlanewaveKohnShamSCFIterator::preload_charge_density(), q3::PlanewaveKohnShamSCFIterator::report_convergence_details(), q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::reset_projector_overlap_coefficients(), q3::PlanewavePseudopotentialKohnShamSCFIterator::setup_hubbard(), q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::snapshot_smooth_density(), q3::PlanewavePseudopotentialKohnShamSCFIterator::solve_single_particle_states(), q3::PlanewaveKohnShamSCFIterator::symmetrize_density(), q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::symmetrize_density(), q3::UltrasoftPlanewavePseudopotentialKohnShamSCFIterator::synchronize_smooth_density_from_mixed(), q3::PlanewavePseudopotentialKohnShamSCFIterator::valence_exchange_correlation_potential_g_of(), q3::PlanewaveKohnShamSCFIterator::warn_if_total_charge_deviates(), and q3::PlanewavePseudopotentialKohnShamSCFIterator::write_checkpoints().
|
protectedpure virtual |
Implemented in q3::KohnShamSCFIterator.
Referenced by iterate().
|
inlineprotectedvirtual |
Report convergence or non-convergence after iterate() finishes.
Definition at line 160 of file init.hpp.
References is_converged_, report_convergence(), and report_non_convergence().
Referenced by run().
|
protectedpure virtual |
Implemented in q3::KohnShamSCFIterator.
Referenced by report().
|
protectedpure virtual |
Implemented in q3::KohnShamSCFIterator.
Referenced by iterate().
|
protectedpure virtual |
Implemented in q3::KohnShamSCFIterator.
Referenced by report().
|
inline |
Definition at line 82 of file init.hpp.
References q3::log::info(), initialize(), iterate(), and report().
Referenced by q3::SelfConsistentFieldFlavor::run_calculation().
|
inline |
Set the SCF convergence threshold (in Ry).
Definition at line 68 of file init.hpp.
References convergence_threshold_.
|
inline |
Set the maximum number of SCF iterations.
Definition at line 72 of file init.hpp.
References maximum_iterations_.
|
inline |
Transfer ownership of a Crystal into this iterator.
Definition at line 77 of file init.hpp.
References crystal_structure_.
|
pure virtual |
Implemented in q3::KohnShamSCFIterator.
Referenced by iterate().
|
inline |
Total energy (Ry) after each completed iteration, oldest first.
Recorded by the iterate() loop for every flavor, since the sequence is what shows how a run converged rather than only where it landed: a monotone descent, an oscillation, and a run that never moved all report the same final energy. The last entry equals total_energy() unless finalize() ran, which recomputes the energy components from the restored density after convergence.
Empty before run(); one entry per iteration performed thereafter.
|
inlinevirtual |
Write binary checkpoint files (charge density, wavefunctions) to the given directory.
Each level of the hierarchy overrides this, calling the parent first, then adding its own checkpoint data. Default no-op.
Reimplemented in q3::PlanewavePseudopotentialKohnShamSCFIterator.
|
protected |
|
protected |
Definition at line 103 of file init.hpp.
Referenced by q3::KohnShamSCFIterator::crystal_structure(), and set_owned_crystal().
|
protected |
Definition at line 108 of file init.hpp.
Referenced by initialize(), is_converged(), iterate(), and report().
|
protected |
Definition at line 107 of file init.hpp.
Referenced by initialize(), q3::KohnShamSCFIterator::is_iteration_converged(), iterate(), iteration(), q3::KohnShamSCFIterator::log_iteration_energy(), q3::KohnShamSCFIterator::perform_iteration(), q3::KohnShamSCFIterator::report_convergence(), q3::KohnShamSCFIterator::report_iteration(), and q3::PlanewavePseudopotentialKohnShamSCFIterator::solve_single_particle_states().
|
protected |
Definition at line 105 of file init.hpp.
Referenced by iterate(), q3::KohnShamSCFIterator::report_non_convergence(), and set_maximum_iterations().