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

Mixer operating on real-space charge density vectors. More...

#include <init.hpp>

+ Inheritance diagram for q3::RealSpaceMixer:

Public Types

using Preconditioner = std::function< void(std::vector< Real > &)>
 

Public Member Functions

void initialize (const MixerEnvironment &environment) override
 Supply the representation context the mixer needs before the first mix().
 
void mix (const std::vector< std::vector< Real > > &input_density, std::vector< std::vector< Real > > &output_density, int number_of_spin_components) override
 
virtual std::vector< Real > mix_one_component (const std::vector< Real > &input_density, const std::vector< Real > &output_density)=0
 
 Mixer (Real mixing_parameter, int history_depth)
 
void set_global_reduce (std::function< void(std::vector< Real > &)> global_reduce)
 
void set_preconditioner (Preconditioner preconditioner)
 
- Public Member Functions inherited from q3::Mixer
 Mixer (Real mixing_parameter, int history_depth)
 
virtual ~Mixer ()=default
 
int history_depth () const
 
Real last_residual_norm () const
 
Real mixing_parameter () const
 
virtual std::string name () const =0
 
virtual void reset ()
 

Protected Attributes

std::function< void(std::vector< Real > &)> global_reduce_
 
Preconditioner preconditioner_
 
- Protected Attributes inherited from q3::Mixer
int history_depth_
 
Real last_residual_norm_ {-1.0}
 
Real mixing_parameter_
 

Detailed Description

Mixer operating on real-space charge density vectors.

Definition at line 18 of file init.hpp.

Member Typedef Documentation

◆ Preconditioner

using q3::RealSpaceMixer::Preconditioner = std::function<void(std::vector<Real>&)>

Definition at line 44 of file init.hpp.

Member Function Documentation

◆ initialize()

void q3::RealSpaceMixer::initialize ( const MixerEnvironment &  )
inlineoverridevirtual

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

Reimplemented from q3::Mixer.

Definition at line 22 of file init.hpp.

References q3::MixerEnvironment::global_reduce, and global_reduce_.

◆ mix()

void q3::RealSpaceMixer::mix ( const std::vector< std::vector< Real > > &  input_density,
std::vector< std::vector< Real > > &  output_density,
int  number_of_spin_components 
)
inlineoverridevirtual

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.

Implements q3::Mixer.

Definition at line 26 of file init.hpp.

References mix_one_component().

◆ mix_one_component()

virtual std::vector< Real > q3::RealSpaceMixer::mix_one_component ( const std::vector< Real > &  input_density,
const std::vector< Real > &  output_density 
)
pure virtual

Mix one spin component to produce the next input density.

Parameters
input_densitydensity used to build the potential (rho_in).
output_densitydensity from diagonalization/sum_band (rho_out).
Returns
mixed density for the next iteration.

Implemented in q3::AndersonMixer.

Referenced by mix().

◆ Mixer()

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

Definition at line 48 of file init.hpp.

◆ set_global_reduce()

void q3::RealSpaceMixer::set_global_reduce ( std::function< void(std::vector< Real > &)>  global_reduce)
inline

Definition at line 48 of file init.hpp.

References global_reduce_.

◆ set_preconditioner()

void q3::RealSpaceMixer::set_preconditioner ( Preconditioner  preconditioner)
inline

Definition at line 45 of file init.hpp.

References preconditioner_.

Member Data Documentation

◆ global_reduce_

std::function<void(std::vector<Real>&)> q3::RealSpaceMixer::global_reduce_
protected

Definition at line 54 of file init.hpp.

Referenced by initialize(), q3::AndersonMixer::mix_one_component(), and set_global_reduce().

◆ preconditioner_

Preconditioner q3::RealSpaceMixer::preconditioner_
protected

Definition at line 53 of file init.hpp.

Referenced by q3::AndersonMixer::mix_one_component(), and set_preconditioner().


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