ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Static Public Member Functions | Static Public Attributes | Private Types | Static Private Attributes | List of all members
hsolver::DiagoIterAssist< T, Device > Class Template Reference

#include <diago_iter_assist.h>

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

Static Public Member Functions

static void diag_subspace (const hamilt::Hamilt< T, Device > *const pHamilt, const psi::Psi< T, Device > &psi, psi::Psi< T, Device > &evc, Real *en, int n_band=0, const bool is_S_orthogonal=false)
 Diagonalizes the Hamiltonian in a subspace defined by the given wavefunction.
 
static void diag_subspace_init (hamilt::Hamilt< T, Device > *pHamilt, const T *psi, int psi_nr, int psi_nc, psi::Psi< T, Device > &evc, Real *en, const std::function< void(T *, const int)> &add_to_hcc=[](T *null, const int n) {}, const std::function< void(const T *const, const int, const int)> &export_vcc=[](const T *null, const int n, const int m) {})
 use LAPACK to diagonalize the Hamiltonian matrix
 
static void diag_heevx (const int nstart, const int nbands, const T *hcc, const int ldh, Real *e, T *vcc)
 
static void diag_hegvd (const int nstart, const int nbands, const T *hcc, T *sc, const int ldh, Real *e, T *vcc)
 
static void cal_hs_subspace (const hamilt::Hamilt< T, Device > *pHamilt, const psi::Psi< T, Device > &psi, T *hcc, T *scc)
 calculate Hamiltonian and overlap matrix in subspace spanned by nstart states psi
 
static void diag_responce (const T *hcc, T *scc, const int nbands, const T *mat_in, T *mat_out, int mat_col, Real *en)
 calculate the response matrix from rotation matrix solved by diagonalization of H and S matrix
 
static void diag_subspace_psi (const T *hcc, T *scc, const int dim_subspace, psi::Psi< T, Device > &evc, Real *en)
 calculate the response wavefunction psi from rotation matrix solved by diagonalization of H and S matrix
 
static bool test_exit_cond (const int &ntry, const int &notconv)
 

Static Public Attributes

static Real PW_DIAG_THR = 1.0e-2
 
static int PW_DIAG_NMAX = 30
 
static Real LCAO_DIAG_THR = 1.0e-12
 
static int LCAO_DIAG_NMAX = 50
 
static Real avg_iter = 0.0
 average steps of last cg diagonalization for each band.
 
static bool need_subspace = false
 
static int SCF_ITER = 0
 

Private Types

using Real = typename GetTypeReal< T >::type
 
using hpsi_info = typename hamilt::Operator< T, Device >::hpsi_info
 
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 syncmem_var_op = base_device::memory::synchronize_memory_op< Real, Device, Device >
 
using syncmem_var_h2d_op = base_device::memory::synchronize_memory_op< Real, base_device::DEVICE_GPU, base_device::DEVICE_CPU >
 
using syncmem_var_d2h_op = base_device::memory::synchronize_memory_op< Real, base_device::DEVICE_CPU, base_device::DEVICE_GPU >
 
using setmem_complex_op = base_device::memory::set_memory_op< T, 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_complex_op = base_device::memory::synchronize_memory_op< T, Device, Device >
 
using syncmem_complex_h2d_op = base_device::memory::synchronize_memory_op< T, Device, base_device::DEVICE_CPU >
 
using syncmem_complex_d2h_op = base_device::memory::synchronize_memory_op< T, base_device::DEVICE_CPU, Device >
 

Static Private Attributes

static constexpr const Device * ctx = {}
 
static T one = static_cast<T>(1.0)
 
static T zero = static_cast<T>(0.0)
 

Member Typedef Documentation

◆ delmem_complex_op

template<typename T , typename Device = base_device::DEVICE_CPU>
using hsolver::DiagoIterAssist< 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 hsolver::DiagoIterAssist< T, Device >::delmem_var_op = base_device::memory::delete_memory_op<Real, Device>
private

◆ hpsi_info

template<typename T , typename Device = base_device::DEVICE_CPU>
using hsolver::DiagoIterAssist< T, Device >::hpsi_info = typename hamilt::Operator<T, Device>::hpsi_info
private

◆ Real

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

◆ resmem_complex_op

template<typename T , typename Device = base_device::DEVICE_CPU>
using hsolver::DiagoIterAssist< 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 hsolver::DiagoIterAssist< T, Device >::resmem_var_op = base_device::memory::resize_memory_op<Real, Device>
private

◆ setmem_complex_op

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

◆ setmem_var_op

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

◆ syncmem_complex_d2h_op

template<typename T , typename Device = base_device::DEVICE_CPU>
using hsolver::DiagoIterAssist< T, Device >::syncmem_complex_d2h_op = base_device::memory::synchronize_memory_op<T, base_device::DEVICE_CPU, Device>
private

◆ syncmem_complex_h2d_op

template<typename T , typename Device = base_device::DEVICE_CPU>
using hsolver::DiagoIterAssist< T, Device >::syncmem_complex_h2d_op = base_device::memory::synchronize_memory_op<T, Device, base_device::DEVICE_CPU>
private

◆ syncmem_complex_op

template<typename T , typename Device = base_device::DEVICE_CPU>
using hsolver::DiagoIterAssist< T, Device >::syncmem_complex_op = base_device::memory::synchronize_memory_op<T, Device, Device>
private

◆ syncmem_var_d2h_op

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

◆ syncmem_var_h2d_op

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

◆ syncmem_var_op

template<typename T , typename Device = base_device::DEVICE_CPU>
using hsolver::DiagoIterAssist< T, Device >::syncmem_var_op = base_device::memory::synchronize_memory_op<Real, Device, Device>
private

Member Function Documentation

◆ cal_hs_subspace()

template<typename T , typename Device >
void hsolver::DiagoIterAssist< T, Device >::cal_hs_subspace ( const hamilt::Hamilt< T, Device > *  pHamilt,
const psi::Psi< T, Device > &  psi,
T hcc,
T scc 
)
static

calculate Hamiltonian and overlap matrix in subspace spanned by nstart states psi

Parameters
pHamilt: hamiltonian operator carrier
psi: wavefunction
hcc: Hamiltonian matrix
scc: overlap matrix
Here is the call graph for this function:

◆ diag_heevx()

template<typename T , typename Device >
void hsolver::DiagoIterAssist< T, Device >::diag_heevx ( const int  nstart,
const int  nbands,
const T hcc,
const int  ldh,
Real e,
T vcc 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ diag_hegvd()

template<typename T , typename Device >
void hsolver::DiagoIterAssist< T, Device >::diag_hegvd ( const int  nstart,
const int  nbands,
const T hcc,
T sc,
const int  ldh,
Real e,
T vcc 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ diag_responce()

template<typename T , typename Device >
void hsolver::DiagoIterAssist< T, Device >::diag_responce ( const T hcc,
T scc,
const int  nbands,
const T mat_in,
T mat_out,
int  mat_col,
Real en 
)
static

calculate the response matrix from rotation matrix solved by diagonalization of H and S matrix

Parameters
hcc: Hamiltonian matrix
scc: overlap matrix
nbands: number of bands
mat_in: input matrix to be rotated
mat_out: output matrix to be rotated
mat_col: number of columns of target matrix
en: eigenvalues
Here is the call graph for this function:

◆ diag_subspace()

template<typename T , typename Device >
void hsolver::DiagoIterAssist< T, Device >::diag_subspace ( const hamilt::Hamilt< T, Device > *const  pHamilt,
const psi::Psi< T, Device > &  psi,
psi::Psi< T, Device > &  evc,
Real en,
int  n_band = 0,
const bool  is_S_orthogonal = false 
)
static

Diagonalizes the Hamiltonian in a subspace defined by the given wavefunction.

This static function computes the eigenvalues and eigenvectors of the Hamiltonian within the subspace spanned by the provided wavefunction psi. The resulting eigenvectors are stored in evc, and the corresponding eigenvalues are written to en.

Template Parameters
TData type for computation (e.g., float, double).
DeviceDevice type for computation (e.g., CPU, GPU).
Parameters
pHamiltPointer to the Hamiltonian object.
psiInput wavefunction defining the subspace.
evcOutput container for computed eigenvectors.
enOutput array for computed eigenvalues.
n_bandNumber of bands (eigenvalues/eigenvectors) to compute. Default is 0 (all).
is_S_orthogonalIf true, assumes the input wavefunction is already orthogonalized.

temporary array for calculation of evc

< if temp and evc share the same memory

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

◆ diag_subspace_init()

template<typename T , typename Device >
void hsolver::DiagoIterAssist< T, Device >::diag_subspace_init ( hamilt::Hamilt< T, Device > *  pHamilt,
const T psi,
int  psi_nr,
int  psi_nc,
psi::Psi< T, Device > &  evc,
Real en,
const std::function< void(T *, const int)> &  add_to_hcc = [](T* null, const int n) {},
const std::function< void(const T *const, const int, const int)> &  export_vcc = [](const T* null, const int n, const int m) {} 
)
static

use LAPACK to diagonalize the Hamiltonian matrix

Parameters
pHamiltinterface to hamiltonian
psiwavefunction to diagonalize
psi_nrnumber of rows (nbands)
psi_ncnumber of columns (nbasis)
evcnew wavefunction
eneigenenergies
Note
exception handle: if there is no operator initialized in Hamilt, will directly copy value from psi to evc, and return all - zero eigenenergies.

this part only for test, eigenvector would have different phase caused by micro numerical perturbation set 8 bit effective accuracy would help for debugging

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

◆ diag_subspace_psi()

template<typename T , typename Device >
void hsolver::DiagoIterAssist< T, Device >::diag_subspace_psi ( const T hcc,
T scc,
const int  dim_subspace,
psi::Psi< T, Device > &  evc,
Real en 
)
static

calculate the response wavefunction psi from rotation matrix solved by diagonalization of H and S matrix

Here is the call graph for this function:

◆ test_exit_cond()

template<typename T , typename Device >
bool hsolver::DiagoIterAssist< T, Device >::test_exit_cond ( const int &  ntry,
const int &  notconv 
)
static

Member Data Documentation

◆ avg_iter

template<typename T , typename Device >
DiagoIterAssist< T, Device >::Real hsolver::DiagoIterAssist< T, Device >::avg_iter = 0.0
static

average steps of last cg diagonalization for each band.

◆ ctx

template<typename T , typename Device = base_device::DEVICE_CPU>
constexpr const Device* hsolver::DiagoIterAssist< T, Device >::ctx = {}
staticconstexprprivate

◆ LCAO_DIAG_NMAX

template<typename T , typename Device >
int hsolver::DiagoIterAssist< T, Device >::LCAO_DIAG_NMAX = 50
static

◆ LCAO_DIAG_THR

template<typename T , typename Device >
DiagoIterAssist< T, Device >::Real hsolver::DiagoIterAssist< T, Device >::LCAO_DIAG_THR = 1.0e-12
static

◆ need_subspace

template<typename T , typename Device >
bool hsolver::DiagoIterAssist< T, Device >::need_subspace = false
static

◆ one

template<typename T , typename Device >
T hsolver::DiagoIterAssist< T, Device >::one = static_cast<T>(1.0)
staticprivate

◆ PW_DIAG_NMAX

template<typename T , typename Device >
int hsolver::DiagoIterAssist< T, Device >::PW_DIAG_NMAX = 30
static

◆ PW_DIAG_THR

template<typename T , typename Device >
DiagoIterAssist< T, Device >::Real hsolver::DiagoIterAssist< T, Device >::PW_DIAG_THR = 1.0e-2
static

◆ SCF_ITER

template<typename T , typename Device >
int hsolver::DiagoIterAssist< T, Device >::SCF_ITER = 0
static

◆ zero

template<typename T , typename Device >
T hsolver::DiagoIterAssist< T, Device >::zero = static_cast<T>(0.0)
staticprivate

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