Loading...
Searching...
No Matches
q3::Mixer Class Referenceabstract

Abstract base class for all charge density mixers. More...

#include <init.hpp>

+ Inheritance diagram for q3::Mixer:

Public Member Functions

 Mixer (Real mixing_parameter, int history_depth)
 
virtual ~Mixer ()=default
 
int history_depth () const
 
virtual void initialize (const MixerEnvironment &)
 Supply the representation context the mixer needs before the first mix().
 
Real last_residual_norm () const
 
virtual void mix (const std::vector< std::vector< Real > > &input_density, std::vector< std::vector< Real > > &output_density, int number_of_spin_components)=0
 
Real mixing_parameter () const
 
virtual std::string name () const =0
 
virtual void reset ()
 

Protected Attributes

int history_depth_
 
Real last_residual_norm_ {-1.0}
 
Real mixing_parameter_
 

Detailed Description

Abstract base class for all charge density mixers.

Definition at line 46 of file init.hpp.

Constructor & Destructor Documentation

◆ Mixer()

q3::Mixer::Mixer ( Real  mixing_parameter,
int  history_depth 
)
inline

Definition at line 48 of file init.hpp.

◆ ~Mixer()

virtual q3::Mixer::~Mixer ( )
virtualdefault

Member Function Documentation

◆ history_depth()

int q3::Mixer::history_depth ( ) const
inline

Definition at line 76 of file init.hpp.

References history_depth_.

◆ initialize()

virtual void q3::Mixer::initialize ( const MixerEnvironment &  )
inlinevirtual

Supply the representation context the mixer needs before the first mix().

Reimplemented in q3::RealSpaceMixer, and q3::ReciprocalSpaceMixer.

Definition at line 56 of file init.hpp.

◆ last_residual_norm()

Real q3::Mixer::last_residual_norm ( ) const
inline

Return the density residual norm (dr2) computed during the last mix() call.

Computing dr2 inside mix() avoids the FFT round-trip noise that occurs when the SCF loop independently FFTs real-space densities back to G-space. Returns -1.0 if not yet computed (callers should fall back to their own dr2).

Definition at line 87 of file init.hpp.

References last_residual_norm_.

◆ mix()

virtual void q3::Mixer::mix ( const std::vector< std::vector< Real > > &  input_density,
std::vector< std::vector< Real > > &  output_density,
int  number_of_spin_components 
)
pure virtual

Mix one self-consistent field step using real-space densities.

Parameters
input_densitydensity used to build the potential (rho_in), per spin.
output_densitydensity from the bands (rho_out) on entry; overwritten with the mixed next-iteration density on exit, per spin.
number_of_spin_componentsnumber of spin channels.

Each mixer performs whatever internal transforms it needs (e.g. FFT to reciprocal space) so callers never branch on the mixer's space.

Implemented in q3::RealSpaceMixer, and q3::ReciprocalSpaceMixer.

◆ mixing_parameter()

Real q3::Mixer::mixing_parameter ( ) const
inline

Definition at line 73 of file init.hpp.

References mixing_parameter_.

◆ name()

virtual std::string q3::Mixer::name ( ) const
pure virtual

◆ reset()

virtual void q3::Mixer::reset ( )
inlinevirtual

Reimplemented in q3::AndersonMixer, and q3::BroydenMixer.

Definition at line 53 of file init.hpp.

Member Data Documentation

◆ history_depth_

int q3::Mixer::history_depth_
protected

◆ last_residual_norm_

Real q3::Mixer::last_residual_norm_ {-1.0}
protected

◆ mixing_parameter_

Real q3::Mixer::mixing_parameter_
protected

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