@@ -49,9 +49,9 @@ namespace hamilt
4949 auto * pv = hR->get_paraV ();
5050 auto Rs = RI_Util::get_Born_von_Karmen_cells (Rs_period);
5151 bool need_allocate = false ;
52- for (int iat0 = 0 ;iat0 < GlobalC::ucell. nat ;++iat0)
52+ for (int iat0 = 0 ;iat0 < nat;++iat0)
5353 {
54- for (int iat1 = 0 ;iat1 < GlobalC::ucell. nat ;++iat1)
54+ for (int iat1 = 0 ;iat1 < nat;++iat1)
5555 {
5656 // complete the atom pairs that has orbitals in this processor but not in hR due to the adj_list
5757 // but adj_list is not enought for EXX, which is more nonlocal than Nonlocal
@@ -81,6 +81,7 @@ namespace hamilt
8181template <typename TK, typename TR>
8282OperatorEXX<OperatorLCAO<TK, TR>>::OperatorEXX(HS_Matrix_K<TK>* hsk_in,
8383 HContainer<TR>*hR_in,
84+ const UnitCell& ucell_in,
8485 const K_Vectors& kv_in,
8586 std::vector<std::map<int , std::map<TAC, RI::Tensor<double >>>>* Hexxd_in,
8687 std::vector<std::map<int , std::map<TAC, RI::Tensor<std::complex <double >>>>>* Hexxc_in,
@@ -89,6 +90,7 @@ OperatorEXX<OperatorLCAO<TK, TR>>::OperatorEXX(HS_Matrix_K<TK>* hsk_in,
8990 int * two_level_step_in,
9091 const bool restart_in)
9192 : OperatorLCAO<TK, TR>(hsk_in, kv_in.kvec_d, hR_in),
93+ ucell (ucell_in),
9294 kv(kv_in),
9395 Hexxd(Hexxd_in),
9496 Hexxc(Hexxc_in),
@@ -115,12 +117,12 @@ OperatorEXX<OperatorLCAO<TK, TR>>::OperatorEXX(HS_Matrix_K<TK>* hsk_in,
115117 // Read HexxR in CSR format
116118 if (GlobalC::exx_info.info_ri .real_number )
117119 {
118- ModuleIO::read_Hexxs_csr (file_name_exx, GlobalC:: ucell, PARAM.inp .nspin , PARAM.globalv .nlocal , *Hexxd);
120+ ModuleIO::read_Hexxs_csr (file_name_exx, ucell, PARAM.inp .nspin , PARAM.globalv .nlocal , *Hexxd);
119121 if (this ->add_hexx_type == Add_Hexx_Type::R) { reallocate_hcontainer (*Hexxd, this ->hR ); }
120122 }
121123 else
122124 {
123- ModuleIO::read_Hexxs_csr (file_name_exx, GlobalC:: ucell, PARAM.inp .nspin , PARAM.globalv .nlocal , *Hexxc);
125+ ModuleIO::read_Hexxs_csr (file_name_exx, ucell, PARAM.inp .nspin , PARAM.globalv .nlocal , *Hexxc);
124126 if (this ->add_hexx_type == Add_Hexx_Type::R) { reallocate_hcontainer (*Hexxc, this ->hR ); }
125127 }
126128 }
@@ -154,19 +156,19 @@ OperatorEXX<OperatorLCAO<TK, TR>>::OperatorEXX(HS_Matrix_K<TK>* hsk_in,
154156 {
155157 // set cell_nearest
156158 std::map<int , std::array<double , 3 >> atoms_pos;
157- for (int iat = 0 ; iat < GlobalC:: ucell.nat ; ++iat) {
159+ for (int iat = 0 ; iat < ucell.nat ; ++iat) {
158160 atoms_pos[iat] = RI_Util::Vector3_to_array3 (
159- GlobalC:: ucell.atoms [GlobalC:: ucell.iat2it [iat]]
160- .tau [GlobalC:: ucell.iat2ia [iat]]);
161+ ucell.atoms [ucell.iat2it [iat]]
162+ .tau [ucell.iat2ia [iat]]);
161163 }
162164 const std::array<std::array<double , 3 >, 3 > latvec
163- = { RI_Util::Vector3_to_array3 (GlobalC:: ucell.a1 ),
164- RI_Util::Vector3_to_array3 (GlobalC:: ucell.a2 ),
165- RI_Util::Vector3_to_array3 (GlobalC:: ucell.a3 ) };
165+ = { RI_Util::Vector3_to_array3 (ucell.a1 ),
166+ RI_Util::Vector3_to_array3 (ucell.a2 ),
167+ RI_Util::Vector3_to_array3 (ucell.a3 ) };
166168 this ->cell_nearest .init (atoms_pos, latvec, Rs_period);
167- reallocate_hcontainer (GlobalC:: ucell.nat , this ->hR , Rs_period, &this ->cell_nearest );
169+ reallocate_hcontainer (ucell.nat , this ->hR , Rs_period, &this ->cell_nearest );
168170 }
169- else { reallocate_hcontainer (GlobalC:: ucell.nat , this ->hR , Rs_period); }
171+ else { reallocate_hcontainer (ucell.nat , this ->hR , Rs_period); }
170172 }
171173
172174 if (this ->restart )
@@ -216,10 +218,10 @@ OperatorEXX<OperatorLCAO<TK, TR>>::OperatorEXX(HS_Matrix_K<TK>* hsk_in,
216218 {
217219 // Read HexxR in CSR format
218220 if (GlobalC::exx_info.info_ri .real_number ) {
219- ModuleIO::read_Hexxs_csr (restart_HR_path, GlobalC:: ucell, PARAM.inp .nspin , PARAM.globalv .nlocal , *Hexxd);
221+ ModuleIO::read_Hexxs_csr (restart_HR_path, ucell, PARAM.inp .nspin , PARAM.globalv .nlocal , *Hexxd);
220222 }
221223 else {
222- ModuleIO::read_Hexxs_csr (restart_HR_path, GlobalC:: ucell, PARAM.inp .nspin , PARAM.globalv .nlocal , *Hexxc);
224+ ModuleIO::read_Hexxs_csr (restart_HR_path, ucell, PARAM.inp .nspin , PARAM.globalv .nlocal , *Hexxc);
223225 }
224226 }
225227 else
@@ -317,6 +319,7 @@ void OperatorEXX<OperatorLCAO<TK, TR>>::contributeHk(int ik)
317319
318320 if (GlobalC::exx_info.info_ri .real_number ) {
319321 RI_2D_Comm::add_Hexx (
322+ ucell,
320323 this ->kv ,
321324 ik,
322325 GlobalC::exx_info.info_global .hybrid_alpha ,
@@ -325,6 +328,7 @@ void OperatorEXX<OperatorLCAO<TK, TR>>::contributeHk(int ik)
325328 this ->hsk ->get_hk ());
326329 } else {
327330 RI_2D_Comm::add_Hexx (
331+ ucell,
328332 this ->kv ,
329333 ik,
330334 GlobalC::exx_info.info_global .hybrid_alpha ,
0 commit comments