@@ -11,16 +11,19 @@ namespace hamilt {
1111template <typename TK, typename TR>
1212class OperatorLCAO : public Operator <TK> {
1313 public:
14+
1415 OperatorLCAO (
1516 HS_Matrix_K<TK>* hsk_in,
16- const std::vector<ModuleBase::Vector3<double >>& kvec_d_in,
17- HContainer<TR>* hR_in)
17+ const std::vector<ModuleBase::Vector3<double >>& kvec_d_in, // ! k-point vectors
18+ HContainer<TR>* hR_in) // ! H(R) matrix, R is the Bravis lattice vector
1819 : hsk(hsk_in), kvec_d(kvec_d_in), hR(hR_in){}
20+
1921 virtual ~OperatorLCAO ()
2022 {
21- if (this ->allocated_smatrix ) {
23+ if (this ->allocated_smatrix )
24+ {
2225 delete[] this ->smatrix_k ;
23- }
26+ }
2427 }
2528
2629 /* Function init(k) is used for update HR and HK ,
@@ -47,7 +50,8 @@ class OperatorLCAO : public Operator<TK> {
4750 Gamma_only case (TK = double), SK would not changed during one SCF loop, a template triangle matrix SK_temp is used
4851 for accelerating. General case (TK = std::complex<double>), only pointers of HK and SK saved in OperatorLCAO
4952 */
50- void matrixHk (MatrixBlock<TK>& hk_in, MatrixBlock<TK>& sk_in) {
53+ void matrixHk (MatrixBlock<TK>& hk_in, MatrixBlock<TK>& sk_in)
54+ {
5155 this ->get_hs_pointers ();
5256#ifdef __MPI
5357 hk_in = MatrixBlock<TK>{hmatrix_k,
@@ -59,8 +63,15 @@ class OperatorLCAO : public Operator<TK> {
5963 (size_t )this ->hsk ->get_pv ()->ncol ,
6064 this ->hsk ->get_pv ()->desc };
6165#else
62- hk_in = MatrixBlock<TK>{hmatrix_k, (size_t )this ->hsk ->get_pv ()->nrow , (size_t )this ->hsk ->get_pv ()->ncol , nullptr };
63- sk_in = MatrixBlock<TK>{smatrix_k, (size_t )this ->hsk ->get_pv ()->nrow , (size_t )this ->hsk ->get_pv ()->ncol , nullptr };
66+ hk_in = MatrixBlock<TK>{hmatrix_k,
67+ (size_t )this ->hsk ->get_pv ()->nrow ,
68+ (size_t )this ->hsk ->get_pv ()->ncol ,
69+ nullptr };
70+
71+ sk_in = MatrixBlock<TK>{smatrix_k,
72+ (size_t )this ->hsk ->get_pv ()->nrow ,
73+ (size_t )this ->hsk ->get_pv ()->ncol ,
74+ nullptr };
6475#endif
6576 }
6677
@@ -77,7 +88,7 @@ class OperatorLCAO : public Operator<TK> {
7788 virtual void set_HR_fixed (void *) { return ; }
7889
7990 /* *
80- * @brief reset hr_done status
91+ * @brief reset the status of 'hr_done' (if H(R) is calculated)
8192 */
8293 void set_hr_done (bool hr_done_in);
8394
@@ -87,32 +98,33 @@ class OperatorLCAO : public Operator<TK> {
8798 void set_current_spin (const int current_spin_in);
8899
89100 // protected:
90- // Hamiltonian matrix which are calculated in OperatorLCAO
101+ // Hamiltonian matrices which are calculated in OperatorLCAO
91102 HS_Matrix_K<TK>* hsk = nullptr ;
92103 const std::vector<ModuleBase::Vector3<double >>& kvec_d;
93104
94105 protected:
95106 bool new_e_iteration = true ;
96107
97- // Real space Hamiltonian pointer
108+ // ! Real- space Hamiltonian pointer
98109 hamilt::HContainer<TR>* hR = nullptr ;
99110
100- // current spin index
111+ // ! current spin index
101112 int current_spin = 0 ;
102113
103- // if HR is calculated
114+ // ! if H(R) is calculated
104115 bool hr_done = false ;
105116
106117 private:
118+
107119 void get_hs_pointers ();
108120
109- // there are H and S matrix for each k point in reciprocal space
110- // type double for gamma_only case, type complex<double> for multi-k-points
111- // case
121+ // ! there are H and S matrix for each k point in reciprocal space
122+ // ! ' double' type for gamma_only case,
123+ // ! 'complex<double>' type for multi k-points case
112124 TK* hmatrix_k = nullptr ;
113125 TK* smatrix_k = nullptr ;
114126
115- // only used for Gamma_only case
127+ // ! only used for Gamma_only case
116128 bool allocated_smatrix = false ;
117129};
118130
0 commit comments