ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
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 HSOperator< T, Device > &op, const T *psi, T *evc, const int nstart, const int n_band, const int dmin, const int dmax, Real *en, const diag_comm_info &diag_comm, const bool is_S_orthogonal=false)
 Diagonalizes H in the subspace spanned by nstart vectors.
static void diag_subspace (const HSOperator< T, Device > &op, const psi::Psi< T, Device > &psi, psi::Psi< T, Device > &evc, Real *en, const diag_comm_info &diag_comm, int n_band=0, const bool is_S_orthogonal=false)
static void diag_subspace_init (const HSOperator< T, Device > &op, const T *psi, int psi_nr, int psi_nc, psi::Psi< T, Device > &evc, Real *en, const std::string &basis_type, const std::string &calculation, const diag_comm_info &diag_comm)
 subspace diagonalization used to build the starting wavefunction
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 HSOperator< T, Device > &op, const psi::Psi< T, Device > &psi, T *hcc, T *scc, const diag_comm_info &diag_comm)
 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 Public Attributes

static Real PW_DIAG_THR
static int PW_DIAG_NMAX
static Real avg_iter
 average steps of last cg diagonalization for each band.
static bool need_subspace
static int SCF_ITER

Private Types

using Real = typename GetTypeReal<T>::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 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 T zero

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

◆ 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 HSOperator< T, Device > & op,
const psi::Psi< T, Device > & psi,
T * hcc,
T * scc,
const diag_comm_info & diag_comm )
static

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

Parameters
op: applies H and S
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() [1/2]

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

psi::Psi flavour of diag_subspace(): nstart = psi.get_nbands(), n_band = 0 means all of them, dimensions taken from psi.

Here is the call graph for this function:

◆ diag_subspace() [2/2]

template<typename T, typename Device>
void hsolver::DiagoIterAssist< T, Device >::diag_subspace ( const HSOperator< T, Device > & op,
const T * psi,
T * evc,
const int nstart,
const int n_band,
const int dmin,
const int dmax,
Real * en,
const diag_comm_info & diag_comm,
const bool is_S_orthogonal = false )
static

Diagonalizes H in the subspace spanned by nstart vectors.

Builds the nstart*nstart matrices <psi|H|psi> (and <psi|S|psi> unless the input is S-orthogonal), solves the small eigenproblem and rotates psi into the lowest n_band eigenvectors, written to evc.

Parameters
opapplies H and S to block vectors
psi[in] nstart vectors, leading dimension dmax
evc[out] n_band vectors, leading dimension dmax; may alias psi
nstartnumber of input vectors
n_bandnumber of eigenvectors wanted (<= nstart)
dminactive length of each vector
dmaxleading dimension of psi and evc
en[out] n_band eigenvalues (host memory)
is_S_orthogonalif true, psi is already S-orthonormal and the standard eigenproblem is solved instead of the generalized one
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 ( const HSOperator< T, Device > & op,
const T * psi,
int psi_nr,
int psi_nc,
psi::Psi< T, Device > & evc,
Real * en,
const std::string & basis_type,
const std::string & calculation,
const diag_comm_info & diag_comm )
static

subspace diagonalization used to build the starting wavefunction

Parameters
opinterface to H and S; op.add_to_subspace_h() and op.export_subspace_vec() are called around the small eigenproblem
psivectors spanning the subspace
psi_nrnumber of rows (nbands)
psi_ncnumber of columns (nbasis)
evcnew wavefunction
eneigenenergies
basis_type"lcao", "lcao_in_pw" or "pw"; together with calculation it selects how the rotation matrix is applied to psi
calculation"scf", "nscf", "md", "relax", ...
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:

Member Data Documentation

◆ avg_iter

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

average steps of last cg diagonalization for each band.

◆ ctx

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

◆ need_subspace

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

◆ one

template<typename T, typename Device = base_device::DEVICE_CPU>
T hsolver::DiagoIterAssist< T, Device >::one
staticprivate

◆ PW_DIAG_NMAX

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

◆ PW_DIAG_THR

template<typename T, typename Device = base_device::DEVICE_CPU>
Real hsolver::DiagoIterAssist< T, Device >::PW_DIAG_THR
static

◆ SCF_ITER

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

◆ zero

template<typename T, typename Device = base_device::DEVICE_CPU>
T hsolver::DiagoIterAssist< T, Device >::zero
staticprivate

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