ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
sto_che.h
Go to the documentation of this file.
1#ifndef STO_CHE_H
2#define STO_CHE_H
6
7template <typename REAL, typename Device = base_device::DEVICE_CPU>
8class StoChe
9{
10 public:
11 StoChe(const int& nche, const int& method, const REAL& emax_sto, const REAL& emin_sto);
12 ~StoChe();
13
14 public:
15 int nche = 0;
16 REAL* spolyv = nullptr;
17 REAL* spolyv_cpu = nullptr;
18 int method_sto = 0;
19
20 // Chebyshev expansion
21 // It stores the plan of FFTW and should be initialized at the beginning of the calculation
23
24 REAL emax_sto = 0.0;
25 REAL emin_sto = 0.0;
26
27 private:
28 Device* ctx = {};
32};
33
42template <typename REAL, typename Device>
43REAL vTMv(const REAL* v, const REAL* M, const int n)
44{
45 Device* ctx = {};
46 base_device::DEVICE_CPU* cpu_ctx = {};
47 using ct_Device = typename container::PsiToContainer<Device>::type;
48 const char normal = 'N';
49 const REAL one = 1;
50 const int inc = 1;
51 const REAL zero = 0;
52 REAL* y = nullptr;
54 ModuleBase::gemv_op<REAL, Device>()(normal, n, n, &one, M, n, v, inc, &zero, y, inc);
55 REAL result = 0;
56 REAL* dot_device = nullptr;
58 container::kernels::blas_dot<REAL, ct_Device>()(n, y, 1, v, 1, dot_device);
60 dot_device,
61 1);
64 return result;
65}
66
67#endif
A class to treat the Chebyshev expansion.
Definition math_chebyshev.h:84
Definition sto_che.h:9
~StoChe()
Definition test_hsolver_sdft.cpp:90
ModuleBase::Chebyshev< REAL, Device > * p_che
Definition sto_che.h:22
Device * ctx
Definition sto_che.h:28
REAL emin_sto
minimum energy for normalization
Definition sto_che.h:25
REAL emax_sto
maximum energy for normalization
Definition sto_che.h:24
int nche
order of Chebyshev expansion
Definition sto_che.h:15
int method_sto
method for the stochastic calculation
Definition sto_che.h:18
REAL * spolyv
[Device] coefficients of Chebyshev expansion
Definition sto_che.h:16
REAL * spolyv_cpu
[CPU] coefficients of Chebyshev expansion
Definition sto_che.h:17
REAL vTMv(const REAL *v, const REAL *M, const int n)
calculate v^T*M*v
Definition sto_che.h:43
Definition math_kernel_op.h:192
Definition memory_op.h:77
Definition memory_op.h:17
T type
Definition tensor_types.h:114
Definition blas.h:13
const std::map< std::string, std::vector< double > > zero
Definition vdwd3_autoset_xcparam.cpp:323