ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
operator_lcao.h
Go to the documentation of this file.
1#ifndef OPERATORLCAO_H
2#define OPERATORLCAO_H
8
9namespace hamilt {
10
11template <typename TK, typename TR>
12class OperatorLCAO : public Operator<TK> {
13 public:
14
16 HS_Matrix_K<TK>* hsk_in,
17 const std::vector<ModuleBase::Vector3<double>>& kvec_d_in,
18 HContainer<TR>* hR_in)
19 : hsk(hsk_in), kvec_d(kvec_d_in), hR(hR_in){}
20
21 virtual ~OperatorLCAO()
22 {
23 if (this->allocated_smatrix)
24 {
25 delete[] this->smatrix_k;
26 }
27 }
28
29 /* Function init(k) is used for update HR and HK ,
30 data pointers of HR and HK are not passed by this function, but passed by
31 constructors of every derived classes. No need to override init() in base
32 class, but must override in derived class */
33 virtual void init(const int ik_in) override;
34
35 void refresh_h();
36
37 /* Function getHR() is designed to update HR matrix only, it will loop all
38 contributeHR() functions in chain table. Detail of this function is still in
39 developed, HR matrix has two form: HR_all_spin and HR_one_spin. For NSPIN=2
40 case, HR_one_spin for spin-up and spin-down is not constructed at same time.
41 */
42 // void getHR(TR* hr_pointer);
43
44 /* Function contributeHR() is defined in derived class, for constructing
45 * <phi_{\mu, R}|H|phi_{\nu, 0}>
46 */
47 virtual void contributeHR() { return; }
48
49 /* Function matrixHk() is used for get information of HK matrix and SK matrix for diagolization.
50 Gamma_only case (TK = double), SK would not changed during one SCF loop, a template triangle matrix SK_temp is used
51 for accelerating. General case (TK = std::complex<double>), only pointers of HK and SK saved in OperatorLCAO
52 */
54 {
55 this->get_hs_pointers();
56#ifdef __MPI
58 (size_t)this->hsk->get_pv()->nrow,
59 (size_t)this->hsk->get_pv()->ncol,
60 this->hsk->get_pv()->desc};
62 (size_t)this->hsk->get_pv()->nrow,
63 (size_t)this->hsk->get_pv()->ncol,
64 this->hsk->get_pv()->desc};
65#else
67 (size_t)this->hsk->get_pv()->nrow,
68 (size_t)this->hsk->get_pv()->ncol,
69 nullptr};
70
72 (size_t)this->hsk->get_pv()->nrow,
73 (size_t)this->hsk->get_pv()->ncol,
74 nullptr};
75#endif
76 }
77
78 /* Function contributeHk() is defined in derived class, for constructing
79 * <phi_{\mu}|H|phi_{\nu}>(K)
80 */
81 virtual void contributeHk(int ik);
82
88 virtual void set_HR_fixed(void*) { return; }
89
93 void set_hr_done(bool hr_done_in);
94
98 void set_current_spin(const int current_spin_in);
99
100 // protected:
101 // Hamiltonian matrices which are calculated in OperatorLCAO
103
104 // kvec_d
105 const std::vector<ModuleBase::Vector3<double>>& kvec_d;
106
107 protected:
108 bool new_e_iteration = true;
109
112
115
117 bool hr_done = false;
118
119 private:
120
121 void get_hs_pointers();
122
126 TK* hmatrix_k = nullptr;
127 TK* smatrix_k = nullptr;
128
130 bool allocated_smatrix = false;
131};
132
133} // end namespace hamilt
134
135#endif
3 elements vector
Definition vector3.h:22
Definition hcontainer.h:144
Definition hs_matrix_k.hpp:11
Definition operator_lcao.h:12
virtual ~OperatorLCAO()
Definition operator_lcao.h:21
bool allocated_smatrix
only used for Gamma_only case
Definition operator_lcao.h:130
virtual void contributeHk(int ik)
Definition operator_lcao.cpp:264
virtual void set_HR_fixed(void *)
set_HR_fixed() is used for pass HR_fixed matrix to the next node in sub-chain table not used in base ...
Definition operator_lcao.h:88
HS_Matrix_K< TK > * hsk
Definition operator_lcao.h:102
hamilt::HContainer< TR > * hR
Real-space Hamiltonian pointer.
Definition operator_lcao.h:111
void set_current_spin(const int current_spin_in)
set current spin index
Definition operator_lcao.cpp:69
OperatorLCAO(HS_Matrix_K< TK > *hsk_in, const std::vector< ModuleBase::Vector3< double > > &kvec_d_in, HContainer< TR > *hR_in)
H(R) matrix, R is the Bravis lattice vector.
Definition operator_lcao.h:15
virtual void init(const int ik_in) override
Definition operator_lcao.cpp:83
void matrixHk(MatrixBlock< TK > &hk_in, MatrixBlock< TK > &sk_in)
Definition operator_lcao.h:53
void set_hr_done(bool hr_done_in)
reset the status of 'hr_done' (if H(R) is calculated)
Definition operator_lcao.cpp:64
bool hr_done
if H(R) is calculated
Definition operator_lcao.h:117
int current_spin
current spin index
Definition operator_lcao.h:114
bool new_e_iteration
Definition operator_lcao.h:108
void get_hs_pointers()
Definition tmp_mocks.cpp:102
virtual void contributeHR()
Definition operator_lcao.h:47
TK * smatrix_k
Definition operator_lcao.h:127
const std::vector< ModuleBase::Vector3< double > > & kvec_d
Definition operator_lcao.h:105
TK * hmatrix_k
Definition operator_lcao.h:126
void refresh_h()
Definition operator_lcao.cpp:57
Definition operator.h:38
int ik
Definition operator.h:101
Definition hamilt.h:12
Definition matrixblock.h:9
const int * desc
Definition matrixblock.h:15