#include <operator.h>
|
| | Operator () |
| virtual | ~Operator () |
| virtual hpsi_info | hPsi (hpsi_info &input) const |
| | Core hot-path: compute H|psi> by traversing the operator chain.
|
| virtual void | init (const int ik_in) |
| virtual void | add (Operator *next) |
| virtual int | get_ik () const |
| virtual void | act (const int nbands, const int nbasis, const int npol, const T *tmpsi_in, T *tmhpsi, const int ngk_ik=0, const bool is_first_node=false) const |
| virtual void | act (const psi::Psi< T, Device > &psi_in, psi::Psi< T, Device > &psi_out, const int nbands) const |
| int | get_act_type () const |
| calculation_type | get_cal_type () const |
◆ hpsi_info
template<typename
T, typename Device = base_device::DEVICE_CPU>
input type of hPsi: (psi_input, range, hpsi_pointer)
hpsi_info bundles the input and output of hPsi():
- std::get<0>: pointer to psi::Psi<T, Device> (input wavefunction)
- std::get<1>: psi::Range specifying which bands to operate on
- std::get<2>: T* pointer to output hpsi buffer (can equal psi_in for in-place)
◆ set_memory_op
template<typename
T, typename Device = base_device::DEVICE_CPU>
◆ Operator()
template<typename
T, typename Device>
◆ ~Operator()
template<typename
T, typename Device>
◆ act() [1/2]
template<typename
T, typename Device = base_device::DEVICE_CPU>
| virtual void hamilt::Operator< T, Device >::act |
( |
const int | nbands, |
|
|
const int | nbasis, |
|
|
const int | npol, |
|
|
const T * | tmpsi_in, |
|
|
T * | tmhpsi, |
|
|
const int | ngk_ik = 0, |
|
|
const bool | is_first_node = false ) const |
|
inlinevirtual |
do operation : |hpsi_choosed> = V|psi_choosed> V is the target operator act on choosed psi, the consequence should be added to choosed hpsi interface type 1: pointer-only (default)
- Note
- PW: nbasis = max_npw * npol, nbands = nband * npol, npol = npol. Strange but PAY ATTENTION!!!
Reimplemented in hamilt::Ekinetic< OperatorPW< T, Device > >, hamilt::Meta< OperatorPW< T, Device > >, hamilt::Nonlocal< OperatorPW< T, Device > >, hamilt::OnsiteProj< OperatorPW< T, Device > >, hamilt::OperatorEXXPW< T, Device >, hamilt::TDEkineticPW< T, Device >, hamilt::TDNonlocalPW< T, Device >, hamilt::Veff< OperatorPW< T, Device > >, RI_Benchmark::OperatorRIHartree< T >, and TestOp< T, Device >.
◆ act() [2/2]
template<typename
T, typename Device = base_device::DEVICE_CPU>
developer-friendly interfaces for act() function interface type 2: input and change the Psi-type HPsi
◆ add()
template<typename
T, typename Device>
| void Operator::add |
( |
Operator< T, Device > * | next | ) |
|
|
virtual |
◆ get_act_type()
template<typename
T, typename Device = base_device::DEVICE_CPU>
type 1 (default): pointer-only act(const T* psi_in, T* psi_out) type 2: use the Psiclass act(const Psi& psi_in, Psi& psi_out)
◆ get_cal_type()
template<typename
T, typename Device = base_device::DEVICE_CPU>
◆ get_hpsi()
template<typename
T, typename Device>
| T * Operator::get_hpsi |
( |
const hpsi_info & | info | ) |
const |
|
protected |
◆ get_ik()
template<typename
T, typename Device = base_device::DEVICE_CPU>
◆ hPsi()
template<typename
T, typename Device>
Core hot-path: compute H|psi> by traversing the operator chain.
This is the central computational kernel of ABACUS, called O(n_bands * n_iter * n_kpoints) times during a single SCF calculation. It accounts for 18-25% of total runtime.
Algorithm:
- Unwrap the input hpsi_info to get psi, band range, and output buffer
- Allocate or reuse the temporary hpsi buffer via get_hpsi()
- Call act() on the first operator node (is_first_node=true) – this node zeros hpsi
- Iterate through next_op linked list, calling act() on each subsequent node (is_first_node=false) Each node accumulates its contribution: hpsi += O|psi>
- If in_place mode, copy temporary hpsi back to the caller-provided buffer
- Return wrapped hpsi_info for downstream use
The operator chain typically includes (in order): Ekinetic → Veff → Nonlocal → Meta → OnsiteProj
- Parameters
-
| input | hpsi_info tuple: (psi_input, band_range, hpsi_output_pointer)
- psi_input: the wavefunction Psi object
- band_range: which bands to compute (range_1 to range_2 inclusive)
- hpsi_output_pointer: pre-allocated buffer for H|psi> result. If equal to psi_input pointer, in_place mode is used (temporary buffer allocated internally).
|
- Returns
- hpsi_info containing (internal_hpsi, range, caller_hpsi_pointer)
- Note
- This function is performance-critical. The operator chain traversal is the innermost loop of iterative diagonalization methods (CG, Davidson, BPCG).
-
For PW calculations, each act() call may involve FFT transforms (Veff), BLAS3 gemm operations (Nonlocal), or element-wise vector ops (Ekinetic).
- See also
- Operator::act(), HamiltPW, DiagoCG::diag()
◆ init()
template<typename
T, typename Device>
| void Operator::init |
( |
const int | ik_in | ) |
|
|
virtual |
Reimplemented in hamilt::Nonlocal< OperatorPW< T, Device > >, hamilt::OnsiteProj< OperatorPW< T, Device > >, hamilt::OperatorLCAO< TK, TR >, hamilt::OperatorLCAO< std::complex< double >, TR >, hamilt::TDEkineticPW< T, Device >, hamilt::TDNonlocalPW< T, Device >, LR::OperatorLRDiag< T, Device >, and LR::OperatorLRHxc< T, Device >.
◆ act_type
template<typename
T, typename Device = base_device::DEVICE_CPU>
determine which act() interface would be called in hPsi()
◆ cal_type
template<typename
T, typename Device = base_device::DEVICE_CPU>
◆ ctx
template<typename
T, typename Device = base_device::DEVICE_CPU>
◆ hpsi
template<typename
T, typename Device = base_device::DEVICE_CPU>
◆ ik
template<typename
T, typename Device = base_device::DEVICE_CPU>
◆ in_place
template<typename
T, typename Device = base_device::DEVICE_CPU>
◆ is_first_node
template<typename
T, typename Device = base_device::DEVICE_CPU>
◆ next_op
template<typename
T, typename Device = base_device::DEVICE_CPU>
interface type 3: return a Psi-type HPsi
◆ next_sub_op
template<typename
T, typename Device = base_device::DEVICE_CPU>
The documentation for this class was generated from the following files:
- /home/runner/work/abacus-develop/abacus-develop/source/source_hamilt/operator.h
- /home/runner/work/abacus-develop/abacus-develop/source/source_hamilt/operator.cpp