ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Base_Mixing::Mixing Class Referenceabstract

Mixing class can mixing different steps of data to solver the iteration problem. For equation x = f(x), we can use iterative process to solve it: x_{n+1} = f(x_n), n = 0, 1, 2, ... To acceralte the convergence, we can use mixing method, we need information including x_in, x_out=f(x_in) in each iterative step. More...

#include <mixing.h>

Inheritance diagram for Base_Mixing::Mixing:
Collaboration diagram for Base_Mixing::Mixing:

Public Member Functions

 Mixing ()
virtual ~Mixing ()
virtual void init_mixing_data (Mixing_Data &mdata, const int &length, const size_t &type_size) const
 init mixing data
virtual void push_data (Mixing_Data &mdata, const double *data_in, const double *data_out, std::function< void(double *)> screen, std::function< void(double *, const double *, const double *)> mix, const bool &need_calcoef)=0
virtual void push_data (Mixing_Data &mdata, const std::complex< double > *data_in, const std::complex< double > *data_out, std::function< void(std::complex< double > *)> screen, std::function< void(std::complex< double > *, const std::complex< double > *, const std::complex< double > *)> mix, const bool &need_calcoef)=0
virtual void push_data (Mixing_Data &mdata, const double *data_in, const double *data_out, std::function< void(double *)> screen, const bool &need_calcoef)
virtual void push_data (Mixing_Data &mdata, const std::complex< double > *data_in, const std::complex< double > *data_out, std::function< void(std::complex< double > *)> screen, const bool &need_calcoef)
virtual void cal_coef (const Mixing_Data &mdata, std::function< double(double *, double *)> inner_product)=0
 calculate coeficients for mixing
virtual void cal_coef (const Mixing_Data &mdata, std::function< double(std::complex< double > *, std::complex< double > *)> inner_product)=0
void mix_data (const Mixing_Data &mdata, double *data_mix)
 calculate the mixing data
void mix_data (const Mixing_Data &mdata, std::complex< double > *data_mix)
virtual void reset ()=0
 reset mixing

Public Attributes

double mixing_beta = 0.7
std::vector< double > coef
int data_ndim = 1

Detailed Description

Mixing class can mixing different steps of data to solver the iteration problem. For equation x = f(x), we can use iterative process to solve it: x_{n+1} = f(x_n), n = 0, 1, 2, ... To acceralte the convergence, we can use mixing method, we need information including x_in, x_out=f(x_in) in each iterative step.

Constructor & Destructor Documentation

◆ Mixing()

Base_Mixing::Mixing::Mixing ( )
inline

◆ ~Mixing()

virtual Base_Mixing::Mixing::~Mixing ( )
inlinevirtual

Member Function Documentation

◆ cal_coef() [1/2]

virtual void Base_Mixing::Mixing::cal_coef ( const Mixing_Data & mdata,
std::function< double(double *, double *)> inner_product )
pure virtual

calculate coeficients for mixing

Parameters
mdataMixing_Data
inner_productpointer to the inner dot function

Implemented in Base_Mixing::Broyden_Mixing, Base_Mixing::Plain_Mixing, and Base_Mixing::Pulay_Mixing.

Here is the caller graph for this function:

◆ cal_coef() [2/2]

virtual void Base_Mixing::Mixing::cal_coef ( const Mixing_Data & mdata,
std::function< double(std::complex< double > *, std::complex< double > *)> inner_product )
pure virtual

◆ init_mixing_data()

virtual void Base_Mixing::Mixing::init_mixing_data ( Mixing_Data & mdata,
const int & length,
const size_t & type_size ) const
inlinevirtual

init mixing data

Parameters
mdatamixing data
lengththe length of each vector
type_sizesize of type
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mix_data() [1/2]

void Base_Mixing::Mixing::mix_data ( const Mixing_Data & mdata,
double * data_mix )

calculate the mixing data

Parameters
mdataMixing_Data
data_mixoutput data
Here is the caller graph for this function:

◆ mix_data() [2/2]

void Base_Mixing::Mixing::mix_data ( const Mixing_Data & mdata,
std::complex< double > * data_mix )

◆ push_data() [1/4]

void Base_Mixing::Mixing::push_data ( Mixing_Data & mdata,
const double * data_in,
const double * data_out,
std::function< void(double *)> screen,
const bool & need_calcoef )
virtual
Parameters
mdatastore information of this iterative step
data_inx_in
data_outx_out = f(x_in)
screenpointer to the screen function for Ker-Ker mixing
need_calcoefwhether need to calculate the coef

Reimplemented in Base_Mixing::Broyden_Mixing, and Base_Mixing::Plain_Mixing.

Here is the call graph for this function:

◆ push_data() [2/4]

virtual void Base_Mixing::Mixing::push_data ( Mixing_Data & mdata,
const double * data_in,
const double * data_out,
std::function< void(double *)> screen,
std::function< void(double *, const double *, const double *)> mix,
const bool & need_calcoef )
pure virtual
Parameters
mdatastore information of this iterative step
data_inx_in
data_outx_out = f(x_in)
screenpointer to the screen function for Ker-Ker mixing
mix(double* out, const double* in, const double* residual) calculate 'out' with 'in' and residual
need_calcoefwhether need to calculate the coef

Implemented in Base_Mixing::Broyden_Mixing, Base_Mixing::Plain_Mixing, and Base_Mixing::Pulay_Mixing.

Here is the caller graph for this function:

◆ push_data() [3/4]

void Base_Mixing::Mixing::push_data ( Mixing_Data & mdata,
const std::complex< double > * data_in,
const std::complex< double > * data_out,
std::function< void(std::complex< double > *)> screen,
const bool & need_calcoef )
virtual

Reimplemented in Base_Mixing::Broyden_Mixing, and Base_Mixing::Plain_Mixing.

Here is the call graph for this function:

◆ push_data() [4/4]

virtual void Base_Mixing::Mixing::push_data ( Mixing_Data & mdata,
const std::complex< double > * data_in,
const std::complex< double > * data_out,
std::function< void(std::complex< double > *)> screen,
std::function< void(std::complex< double > *, const std::complex< double > *, const std::complex< double > *)> mix,
const bool & need_calcoef )
pure virtual

◆ reset()

virtual void Base_Mixing::Mixing::reset ( )
pure virtual

Member Data Documentation

◆ coef

std::vector<double> Base_Mixing::Mixing::coef

◆ data_ndim

int Base_Mixing::Mixing::data_ndim = 1

◆ mixing_beta

double Base_Mixing::Mixing::mixing_beta = 0.7

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