ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Stochastic_Iter< T, Device > Class Template Reference

#include <sto_iter.h>

Collaboration diagram for Stochastic_Iter< T, Device >:

Public Member Functions

 Stochastic_Iter ()
 ~Stochastic_Iter ()
void init (K_Vectors *pkv_in, ModulePW::PW_Basis_K *wfc_basis, Stochastic_WF< T, Device > &stowf, StoChe< Real, Device > &stoche, StoHamiltPW< T, Device > *p_hamilt_sto)
 init for iteration process of SDFT
void sum_stoeband (Stochastic_WF< T, Device > &stowf, elecstate::ElecStatePW< T, Device > *pes, hamilt::Hamilt< T, Device > *pHamilt, ModulePW::PW_Basis_K *wfc_basis)
 sum demet and eband energies for each k point and each band
void cal_storho (const UnitCell &ucell, Stochastic_WF< T, Device > &stowf, elecstate::ElecStatePW< T, Device > *pes, ModulePW::PW_Basis_K *wfc_basis)
 calculate the density
double calne (elecstate::ElecState *pes)
 calculate total number of electrons
void itermu (const int iter, elecstate::ElecState *pes)
 solve ne(mu) = ne_target and get chemical potential mu
void orthog (const int &ik, psi::Psi< T, Device > &psi, Stochastic_WF< T, Device > &stowf)
 orthogonalize stochastic wave functions with KS wave functions
void checkemm (const int &ik, const int istep, const int iter, Stochastic_WF< T, Device > &stowf)
 check emax and emin
void check_precision (const double ref, const double thr, const std::string info)
 check precision of Chebyshev expansion
void calHsqrtchi (Stochastic_WF< T, Device > &stowf)
void calPn (const int &ik, Stochastic_WF< T, Device > &stowf)
void calTnchi_ik (const int &ik, Stochastic_WF< T, Device > &stowf)

Public Attributes

ModuleBase::Chebyshev< double, Device > * p_che = nullptr
Sto_Func< double > stofunc
StoHamiltPW< T, Device > * p_hamilt_sto = nullptr
double mu0 = 0.0
bool change = false
double targetne =0.0
Real * spolyv = nullptr
Real * spolyv_cpu = nullptr
int * nchip = nullptr
bool check = false
double th_ne =0.0
double KS_ne =0.0
int method

Private Types

using Real = typename GetTypeReal<T>::type
using ct_Device = typename container::PsiToContainer<Device>::type
using setmem_var_op = base_device::memory::set_memory_op<Real, Device>
using resmem_var_op = base_device::memory::resize_memory_op<Real, Device>
using delmem_var_op = base_device::memory::delete_memory_op<Real, Device>
using resmem_complex_op = base_device::memory::resize_memory_op<T, Device>
using delmem_complex_op = base_device::memory::delete_memory_op<T, Device>
using syncmem_var_h2d_op = base_device::memory::synchronize_memory_op<Real, Device, base_device::DEVICE_CPU>
using syncmem_var_d2h_op = base_device::memory::synchronize_memory_op<Real, base_device::DEVICE_CPU, Device>
using cpymem_complex_op = base_device::memory::synchronize_memory_op<T, Device, Device>
using castmem_d2z_op = base_device::memory::cast_memory_op<T, Real, Device, Device>
using castmem_var_d2h_op = base_device::memory::cast_memory_op<double, Real, base_device::DEVICE_CPU, Device>
using gemv_op = ModuleBase::gemv_op<T, Device>

Private Member Functions

void dot (const int &n, const Real *x, const int &incx, const Real *y, const int &incy, Real &result)
 return cpu dot result

Private Attributes

K_Vectors * pkv =nullptr
const Device * ctx = {}
const base_device::DEVICE_CPU * cpu_ctx = {}

Member Typedef Documentation

◆ castmem_d2z_op

template<typename T, typename Device = base_device::DEVICE_CPU>
using Stochastic_Iter< T, Device >::castmem_d2z_op = base_device::memory::cast_memory_op<T, Real, Device, Device>
private

◆ castmem_var_d2h_op

template<typename T, typename Device = base_device::DEVICE_CPU>
using Stochastic_Iter< T, Device >::castmem_var_d2h_op = base_device::memory::cast_memory_op<double, Real, base_device::DEVICE_CPU, Device>
private

◆ cpymem_complex_op

template<typename T, typename Device = base_device::DEVICE_CPU>
using Stochastic_Iter< T, Device >::cpymem_complex_op = base_device::memory::synchronize_memory_op<T, Device, Device>
private

◆ ct_Device

template<typename T, typename Device = base_device::DEVICE_CPU>
using Stochastic_Iter< T, Device >::ct_Device = typename container::PsiToContainer<Device>::type
private

◆ delmem_complex_op

template<typename T, typename Device = base_device::DEVICE_CPU>
using Stochastic_Iter< T, Device >::delmem_complex_op = base_device::memory::delete_memory_op<T, Device>
private

◆ delmem_var_op

template<typename T, typename Device = base_device::DEVICE_CPU>
using Stochastic_Iter< T, Device >::delmem_var_op = base_device::memory::delete_memory_op<Real, Device>
private

◆ gemv_op

template<typename T, typename Device = base_device::DEVICE_CPU>
using Stochastic_Iter< T, Device >::gemv_op = ModuleBase::gemv_op<T, Device>
private

◆ Real

template<typename T, typename Device = base_device::DEVICE_CPU>
using Stochastic_Iter< T, Device >::Real = typename GetTypeReal<T>::type
private

◆ resmem_complex_op

template<typename T, typename Device = base_device::DEVICE_CPU>
using Stochastic_Iter< T, Device >::resmem_complex_op = base_device::memory::resize_memory_op<T, Device>
private

◆ resmem_var_op

template<typename T, typename Device = base_device::DEVICE_CPU>
using Stochastic_Iter< T, Device >::resmem_var_op = base_device::memory::resize_memory_op<Real, Device>
private

◆ setmem_var_op

template<typename T, typename Device = base_device::DEVICE_CPU>
using Stochastic_Iter< T, Device >::setmem_var_op = base_device::memory::set_memory_op<Real, Device>
private

◆ syncmem_var_d2h_op

template<typename T, typename Device = base_device::DEVICE_CPU>
using Stochastic_Iter< T, Device >::syncmem_var_d2h_op = base_device::memory::synchronize_memory_op<Real, base_device::DEVICE_CPU, Device>
private

◆ syncmem_var_h2d_op

template<typename T, typename Device = base_device::DEVICE_CPU>
using Stochastic_Iter< T, Device >::syncmem_var_h2d_op = base_device::memory::synchronize_memory_op<Real, Device, base_device::DEVICE_CPU>
private

Constructor & Destructor Documentation

◆ Stochastic_Iter()

template<typename T, typename Device>
Stochastic_Iter< T, Device >::Stochastic_Iter ( )

◆ ~Stochastic_Iter()

template<typename T, typename Device>
Stochastic_Iter< T, Device >::~Stochastic_Iter ( )

Member Function Documentation

◆ cal_storho()

template<typename T, typename Device>
void Stochastic_Iter< T, Device >::cal_storho ( const UnitCell & ucell,
Stochastic_WF< T, Device > & stowf,
elecstate::ElecStatePW< T, Device > * pes,
ModulePW::PW_Basis_K * wfc_basis )

calculate the density

Parameters
ucellreference to unit cell
stowfstochastic wave function
peselecstate
wfc_basiswfc pw basis
Here is the call graph for this function:

◆ calHsqrtchi()

template<typename T, typename Device>
void Stochastic_Iter< T, Device >::calHsqrtchi ( Stochastic_WF< T, Device > & stowf)
Here is the call graph for this function:

◆ calne()

template<typename T, typename Device>
double Stochastic_Iter< T, Device >::calne ( elecstate::ElecState * pes)

calculate total number of electrons

Parameters
peselecstate
Returns
double
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calPn()

template<typename T, typename Device>
void Stochastic_Iter< T, Device >::calPn ( const int & ik,
Stochastic_WF< T, Device > & stowf )
Here is the call graph for this function:

◆ calTnchi_ik()

template<typename T, typename Device>
void Stochastic_Iter< T, Device >::calTnchi_ik ( const int & ik,
Stochastic_WF< T, Device > & stowf )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_precision()

template<typename T, typename Device>
void Stochastic_Iter< T, Device >::check_precision ( const double ref,
const double thr,
const std::string info )

check precision of Chebyshev expansion

Parameters
refreference value
thrthreshold
infoinformation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkemm()

template<typename T, typename Device>
void Stochastic_Iter< T, Device >::checkemm ( const int & ik,
const int istep,
const int iter,
Stochastic_WF< T, Device > & stowf )

check emax and emin

Parameters
ikk point index
istepion step index
iterscf iteration index
stowfstochastic wave functions

◆ dot()

template<typename T, typename Device>
void Stochastic_Iter< T, Device >::dot ( const int & n,
const Real * x,
const int & incx,
const Real * y,
const int & incy,
Real & result )
private

return cpu dot result

Parameters
x[Device]
y[Device]
result[CPU] dot result
Here is the caller graph for this function:

◆ init()

template<typename T, typename Device>
void Stochastic_Iter< T, Device >::init ( K_Vectors * pkv_in,
ModulePW::PW_Basis_K * wfc_basis,
Stochastic_WF< T, Device > & stowf,
StoChe< Real, Device > & stoche,
StoHamiltPW< T, Device > * p_hamilt_sto )

init for iteration process of SDFT

Parameters
method_in1: slow 2: fast but cost much memories
pkv_inK_Vectors
wfc_basiswfc pw basis
stowfstochastic wave function
stocheChebyshev expansion for sDFT
p_hamilt_stohamiltonian for sDFT

◆ itermu()

template<typename T, typename Device>
void Stochastic_Iter< T, Device >::itermu ( const int iter,
elecstate::ElecState * pes )

solve ne(mu) = ne_target and get chemical potential mu

Parameters
iterscf iteration index
peselecstate
Here is the call graph for this function:

◆ orthog()

template<typename T, typename Device>
void Stochastic_Iter< T, Device >::orthog ( const int & ik,
psi::Psi< T, Device > & psi,
Stochastic_WF< T, Device > & stowf )

orthogonalize stochastic wave functions with KS wave functions

Parameters
ikk point index
psiKS wave functions
stowfstochastic wave functions
Here is the call graph for this function:

◆ sum_stoeband()

template<typename T, typename Device>
void Stochastic_Iter< T, Device >::sum_stoeband ( Stochastic_WF< T, Device > & stowf,
elecstate::ElecStatePW< T, Device > * pes,
hamilt::Hamilt< T, Device > * pHamilt,
ModulePW::PW_Basis_K * wfc_basis )

sum demet and eband energies for each k point and each band

Parameters
stowfstochastic wave function
peselecstate
pHamilthamiltonian
wfc_basiswfc pw basis
Here is the call graph for this function:

Member Data Documentation

◆ change

template<typename T, typename Device = base_device::DEVICE_CPU>
bool Stochastic_Iter< T, Device >::change = false

◆ check

template<typename T, typename Device = base_device::DEVICE_CPU>
bool Stochastic_Iter< T, Device >::check = false

◆ cpu_ctx

template<typename T, typename Device = base_device::DEVICE_CPU>
const base_device::DEVICE_CPU* Stochastic_Iter< T, Device >::cpu_ctx = {}
private

◆ ctx

template<typename T, typename Device = base_device::DEVICE_CPU>
const Device* Stochastic_Iter< T, Device >::ctx = {}
private

◆ KS_ne

template<typename T, typename Device = base_device::DEVICE_CPU>
double Stochastic_Iter< T, Device >::KS_ne =0.0

◆ method

template<typename T, typename Device = base_device::DEVICE_CPU>
int Stochastic_Iter< T, Device >::method

◆ mu0

template<typename T, typename Device = base_device::DEVICE_CPU>
double Stochastic_Iter< T, Device >::mu0 = 0.0

◆ nchip

template<typename T, typename Device = base_device::DEVICE_CPU>
int* Stochastic_Iter< T, Device >::nchip = nullptr

◆ p_che

template<typename T, typename Device = base_device::DEVICE_CPU>
ModuleBase::Chebyshev<double, Device>* Stochastic_Iter< T, Device >::p_che = nullptr

◆ p_hamilt_sto

template<typename T, typename Device = base_device::DEVICE_CPU>
StoHamiltPW<T, Device>* Stochastic_Iter< T, Device >::p_hamilt_sto = nullptr

◆ pkv

template<typename T, typename Device = base_device::DEVICE_CPU>
K_Vectors* Stochastic_Iter< T, Device >::pkv =nullptr
private

◆ spolyv

template<typename T, typename Device = base_device::DEVICE_CPU>
Real* Stochastic_Iter< T, Device >::spolyv = nullptr

◆ spolyv_cpu

template<typename T, typename Device = base_device::DEVICE_CPU>
Real* Stochastic_Iter< T, Device >::spolyv_cpu = nullptr

◆ stofunc

template<typename T, typename Device = base_device::DEVICE_CPU>
Sto_Func<double> Stochastic_Iter< T, Device >::stofunc

◆ targetne

template<typename T, typename Device = base_device::DEVICE_CPU>
double Stochastic_Iter< T, Device >::targetne =0.0

◆ th_ne

template<typename T, typename Device = base_device::DEVICE_CPU>
double Stochastic_Iter< T, Device >::th_ne =0.0

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