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

#include <hsolver_pw.h>

Collaboration diagram for hsolver::HSolverPW< T, Device >:

Public Member Functions

 HSolverPW (ModulePW::PW_Basis_K *wfc_basis_in, const std::string calculation_type_in, const std::string basis_type_in, const std::string method_in, const bool use_uspp_in, const int nspin_in, const int scf_iter_in, const int diag_iter_max_in, const double diag_thr_in, const bool need_subspace_in, const int nbands_in, const bool diago_smooth_ethr_in, const int pw_diag_ndim_in, const std::string &lobpcg_locking_in, const int diag_subspace_in, const int nb2d_in, const bool use_k_continuity_in=false)
void solve (HSOperator< T, Device > &op, psi::Psi< T, Device > &psi, elecstate::ElecState *pes, double *out_eigenvalues, const int rank_in_pool_in, const int nproc_in_pool_in, std::ostream &log, const bool skip_charge)
 solve function for pw

Protected Types

using Real = typename GetTypeReal<T>::type
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 setmem_complex_op = base_device::memory::set_memory_op<T, Device>

Protected Member Functions

void hamiltSolvePsiK (const HSOperator< T, Device > &op, psi::Psi< T, Device > &psi, std::vector< Real > &pre_condition, Real *eigenvalue, const int &nk_nums)
void update_precondition (std::vector< Real > &h_diag, const int ik, const int npw, const Real vl_of_0)
void output_iterInfo (std::ostream &log)

Protected Attributes

ModulePW::PW_Basis_K * wfc_basis = nullptr
const std::string calculation_type
const std::string basis_type
const std::string method
const bool use_uspp
const int nspin
const int scf_iter
const int diag_iter_max
const double diag_thr
const bool need_subspace
const int nbands
const bool diago_smooth_ethr
const int pw_diag_ndim
const std::string lobpcg_locking
const int diag_subspace
const int nb2d
const bool use_k_continuity
Device * ctx = {}
int rank_in_pool = 0
int nproc_in_pool = 1
std::vector< double > ethr_band
dense::ParallelDenseEigensolver rr_solver
dense::GpuDenseEigensolver gpu_rr_solver

Private Member Functions

void cal_smooth_ethr (const double &wk, const double *wg, const double &ethr, std::vector< double > &ethrs)
 calculate the threshold for iterative-diagonalization for each band
void build_k_neighbors ()
void propagate_psi (psi::Psi< T, Device > &psi, const int from_ik, const int to_ik)

Private Attributes

std::vector< int > k_order
std::unordered_map< int, int > k_parent
std::vector< ModuleBase::Vector3< double > > kvecs_c

Friends

class ::TestHSolverPW

Member Typedef Documentation

◆ delmem_complex_op

template<typename T, typename Device = base_device::DEVICE_CPU>
using hsolver::HSolverPW< T, Device >::delmem_complex_op = base_device::memory::delete_memory_op<T, Device>
protected

◆ Real

template<typename T, typename Device = base_device::DEVICE_CPU>
using hsolver::HSolverPW< T, Device >::Real = typename GetTypeReal<T>::type
protected

◆ resmem_complex_op

template<typename T, typename Device = base_device::DEVICE_CPU>
using hsolver::HSolverPW< T, Device >::resmem_complex_op = base_device::memory::resize_memory_op<T, Device>
protected

◆ setmem_complex_op

template<typename T, typename Device = base_device::DEVICE_CPU>
using hsolver::HSolverPW< T, Device >::setmem_complex_op = base_device::memory::set_memory_op<T, Device>
protected

Constructor & Destructor Documentation

◆ HSolverPW()

template<typename T, typename Device = base_device::DEVICE_CPU>
hsolver::HSolverPW< T, Device >::HSolverPW ( ModulePW::PW_Basis_K * wfc_basis_in,
const std::string calculation_type_in,
const std::string basis_type_in,
const std::string method_in,
const bool use_uspp_in,
const int nspin_in,
const int scf_iter_in,
const int diag_iter_max_in,
const double diag_thr_in,
const bool need_subspace_in,
const int nbands_in,
const bool diago_smooth_ethr_in,
const int pw_diag_ndim_in,
const std::string & lobpcg_locking_in,
const int diag_subspace_in,
const int nb2d_in,
const bool use_k_continuity_in = false )
inline

Member Function Documentation

◆ build_k_neighbors()

template<typename T, typename Device>
void hsolver::HSolverPW< T, Device >::build_k_neighbors ( )
private
Here is the call graph for this function:

◆ cal_smooth_ethr()

template<typename T, typename Device>
void hsolver::HSolverPW< T, Device >::cal_smooth_ethr ( const double & wk,
const double * wg,
const double & ethr,
std::vector< double > & ethrs )
private

calculate the threshold for iterative-diagonalization for each band

◆ hamiltSolvePsiK()

template<typename T, typename Device>
void hsolver::HSolverPW< T, Device >::hamiltSolvePsiK ( const HSOperator< T, Device > & op,
psi::Psi< T, Device > & psi,
std::vector< Real > & pre_condition,
Real * eigenvalue,
const int & nk_nums )
protected

Allow 5 tries at most. If ntry > ntry_max = 5, exit diag loop.

In non-self consistent calculation, do until totally converged. Else allow 5 eigenvecs to be NOT converged.

convergence threshold

maximum iterations

dimension of matrix

number of eigenpairs sought

leading dimension of psi

Here is the call graph for this function:
Here is the caller graph for this function:

◆ output_iterInfo()

template<typename T, typename Device>
void hsolver::HSolverPW< T, Device >::output_iterInfo ( std::ostream & log)
protected

◆ propagate_psi()

template<typename T, typename Device>
void hsolver::HSolverPW< T, Device >::propagate_psi ( psi::Psi< T, Device > & psi,
const int from_ik,
const int to_ik )
private

◆ solve()

template<typename T, typename Device>
void hsolver::HSolverPW< T, Device >::solve ( HSOperator< T, Device > & op,
psi::Psi< T, Device > & psi,
elecstate::ElecState * pes,
double * out_eigenvalues,
const int rank_in_pool_in,
const int nproc_in_pool_in,
std::ostream & log,
const bool skip_charge )

solve function for pw

Parameters
opthe H and S operator of the Hamiltonian, switched to each k point in turn
psireference to psi
pesinterface to elecstate
skip_charge

calculate the contribution of Psi for charge density rho

Here is the caller graph for this function:

◆ update_precondition()

template<typename T, typename Device>
void hsolver::HSolverPW< T, Device >::update_precondition ( std::vector< Real > & h_diag,
const int ik,
const int npw,
const Real vl_of_0 )
protected

◆ ::TestHSolverPW

template<typename T, typename Device = base_device::DEVICE_CPU>
friend class ::TestHSolverPW
friend

the unit test drives the protected hamiltSolvePsiK() and update_precondition() directly; the fixture is at global scope

Member Data Documentation

◆ basis_type

template<typename T, typename Device = base_device::DEVICE_CPU>
const std::string hsolver::HSolverPW< T, Device >::basis_type
protected

◆ calculation_type

template<typename T, typename Device = base_device::DEVICE_CPU>
const std::string hsolver::HSolverPW< T, Device >::calculation_type
protected

◆ ctx

template<typename T, typename Device = base_device::DEVICE_CPU>
Device* hsolver::HSolverPW< T, Device >::ctx = {}
protected

◆ diag_iter_max

template<typename T, typename Device = base_device::DEVICE_CPU>
const int hsolver::HSolverPW< T, Device >::diag_iter_max
protected

◆ diag_subspace

template<typename T, typename Device = base_device::DEVICE_CPU>
const int hsolver::HSolverPW< T, Device >::diag_subspace
protected

◆ diag_thr

template<typename T, typename Device = base_device::DEVICE_CPU>
const double hsolver::HSolverPW< T, Device >::diag_thr
protected

◆ diago_smooth_ethr

template<typename T, typename Device = base_device::DEVICE_CPU>
const bool hsolver::HSolverPW< T, Device >::diago_smooth_ethr
protected

◆ ethr_band

template<typename T, typename Device = base_device::DEVICE_CPU>
std::vector<double> hsolver::HSolverPW< T, Device >::ethr_band
protected

◆ gpu_rr_solver

template<typename T, typename Device = base_device::DEVICE_CPU>
dense::GpuDenseEigensolver hsolver::HSolverPW< T, Device >::gpu_rr_solver
protected

◆ k_order

template<typename T, typename Device = base_device::DEVICE_CPU>
std::vector<int> hsolver::HSolverPW< T, Device >::k_order
private

◆ k_parent

template<typename T, typename Device = base_device::DEVICE_CPU>
std::unordered_map<int, int> hsolver::HSolverPW< T, Device >::k_parent
private

◆ kvecs_c

template<typename T, typename Device = base_device::DEVICE_CPU>
std::vector<ModuleBase::Vector3<double> > hsolver::HSolverPW< T, Device >::kvecs_c
private

◆ lobpcg_locking

template<typename T, typename Device = base_device::DEVICE_CPU>
const std::string hsolver::HSolverPW< T, Device >::lobpcg_locking
protected

◆ method

template<typename T, typename Device = base_device::DEVICE_CPU>
const std::string hsolver::HSolverPW< T, Device >::method
protected

◆ nb2d

template<typename T, typename Device = base_device::DEVICE_CPU>
const int hsolver::HSolverPW< T, Device >::nb2d
protected

◆ nbands

template<typename T, typename Device = base_device::DEVICE_CPU>
const int hsolver::HSolverPW< T, Device >::nbands
protected

◆ need_subspace

template<typename T, typename Device = base_device::DEVICE_CPU>
const bool hsolver::HSolverPW< T, Device >::need_subspace
protected

◆ nproc_in_pool

template<typename T, typename Device = base_device::DEVICE_CPU>
int hsolver::HSolverPW< T, Device >::nproc_in_pool = 1
protected

◆ nspin

template<typename T, typename Device = base_device::DEVICE_CPU>
const int hsolver::HSolverPW< T, Device >::nspin
protected

◆ pw_diag_ndim

template<typename T, typename Device = base_device::DEVICE_CPU>
const int hsolver::HSolverPW< T, Device >::pw_diag_ndim
protected

◆ rank_in_pool

template<typename T, typename Device = base_device::DEVICE_CPU>
int hsolver::HSolverPW< T, Device >::rank_in_pool = 0
protected

◆ rr_solver

template<typename T, typename Device = base_device::DEVICE_CPU>
dense::ParallelDenseEigensolver hsolver::HSolverPW< T, Device >::rr_solver
protected

◆ scf_iter

template<typename T, typename Device = base_device::DEVICE_CPU>
const int hsolver::HSolverPW< T, Device >::scf_iter
protected

◆ use_k_continuity

template<typename T, typename Device = base_device::DEVICE_CPU>
const bool hsolver::HSolverPW< T, Device >::use_k_continuity
protected

◆ use_uspp

template<typename T, typename Device = base_device::DEVICE_CPU>
const bool hsolver::HSolverPW< T, Device >::use_uspp
protected

◆ wfc_basis

template<typename T, typename Device = base_device::DEVICE_CPU>
ModulePW::PW_Basis_K* hsolver::HSolverPW< T, Device >::wfc_basis = nullptr
protected

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