forked from abacusmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiago_david.h
More file actions
105 lines (87 loc) · 3.4 KB
/
Copy pathdiago_david.h
File metadata and controls
105 lines (87 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//==========================================================
// AUTHOR : wangjp
// Data :2009-04
// Last Update:
//
// 09-05-10 modify SchmitOrth() diag_zhegvx() as static
// member function
//==========================================================
#ifndef DIAGODAVID_H
#define DIAGODAVID_H
#include "diagh.h"
#include "module_base/complexmatrix.h"
#include "src_pw/structure_factor.h"
namespace hsolver
{
class DiagoDavid : public DiagH
{
public:
DiagoDavid(const double* precondition_in);
// this is the override function diag() for CG method
void diag(hamilt::Hamilt* phm_in, psi::Psi<std::complex<double>>& phi, double* eigenvalue_in) override;
static int PW_DIAG_NDIM;
private:
int test_david = 0;
/// record for how many bands not have convergence eigenvalues
int notconv = 0;
void cal_grad(hamilt::Hamilt* phm_in,
const int& npw,
const int& nbase,
const int& notconv,
psi::Psi<std::complex<double>>& basis,
ModuleBase::ComplexMatrix& hp,
ModuleBase::ComplexMatrix& sp,
const ModuleBase::ComplexMatrix& vc,
const int* unconv,
const double* en);
void cal_elem(const int& npw,
int& nbase,
const int& notconv,
const psi::Psi<std::complex<double>>& basis,
const ModuleBase::ComplexMatrix& hp,
const ModuleBase::ComplexMatrix& sp,
ModuleBase::ComplexMatrix& hc,
ModuleBase::ComplexMatrix& sc);
void refresh(const int& npw,
const int& nband,
int& nbase,
const double* en,
const psi::Psi<std::complex<double>>& psi,
psi::Psi<std::complex<double>>& basis,
ModuleBase::ComplexMatrix& hp,
ModuleBase::ComplexMatrix& sp,
ModuleBase::ComplexMatrix& hc,
ModuleBase::ComplexMatrix& sc,
ModuleBase::ComplexMatrix& vc);
void cal_err(const int& npw,
const int& nband,
const int& nbase,
const ModuleBase::ComplexMatrix& vc,
const ModuleBase::ComplexMatrix& hp,
const psi::Psi<std::complex<double>>& basis,
const double* en,
std::complex<double>* respsi);
void SchmitOrth(const int& npw,
const int n_band,
const int m,
psi::Psi<std::complex<double>>& psi,
const ModuleBase::ComplexMatrix& spsi,
std::complex<double>* lagrange_m,
const int mm_size,
const int mv_size);
void planSchmitOrth(
const int nband,
int* pre_matrix_mm_m,
int* pre_matrix_mv_m);
void diag_zhegvx(const int& n,
const int& m,
const ModuleBase::ComplexMatrix& hc,
const ModuleBase::ComplexMatrix& sc,
const int& ldh,
double* e,
ModuleBase::ComplexMatrix& vc);
void diag_mock(hamilt::Hamilt* phm_in, psi::Psi<std::complex<double>>& psi, double* eigenvalue_in);
const double* precondition = nullptr;
};
} // namespace hsolver
#endif