@@ -78,10 +78,12 @@ void Gint_k::transfer_pvpR(hamilt::HContainer<std::complex<double>>* hR,
7878 ModuleBase::TITLE (" Gint_k" , " transfer_pvpR" );
7979 ModuleBase::timer::tick (" Gint_k" , " transfer_pvpR" );
8080
81+ auto ijr_info = hR->get_ijr_info ();
82+
83+ #ifdef __MPI
8184 int mg = hR->get_paraV ()->get_global_row_size ()/2 ;
8285 int ng = hR->get_paraV ()->get_global_col_size ()/2 ;
8386 int nb = hR->get_paraV ()->get_block_size ()/2 ;
84- #ifdef __MPI
8587 int blacs_ctxt = hR->get_paraV ()->blacs_ctxt ;
8688 std::vector<int > iat2iwt (ucell_in->nat );
8789 for (int iat = 0 ; iat < ucell_in->nat ; iat++) {
@@ -90,9 +92,9 @@ void Gint_k::transfer_pvpR(hamilt::HContainer<std::complex<double>>* hR,
9092 Parallel_Orbitals *pv = new Parallel_Orbitals ();
9193 pv->set (mg, ng, nb, blacs_ctxt);
9294 pv->set_atomic_trace (iat2iwt.data (), ucell_in->nat , mg);
93- auto ijr_info = hR->get_ijr_info ();
94-
9595 this ->hR_tmp = new hamilt::HContainer<std::complex <double >>(pv, nullptr , &ijr_info);
96+ #endif
97+
9698 ModuleBase::Memory::record (" Gint::hRGintCd" , this ->hR_tmp ->get_memory_size ());
9799
98100 // select hRGint_tmp
@@ -155,8 +157,12 @@ void Gint_k::transfer_pvpR(hamilt::HContainer<std::complex<double>>* hR,
155157 }
156158 }
157159 }
160+ #ifdef __MPI
158161 // transfer hRGint_tmpCd to parallel hR_tmp
159162 hamilt::transferSerials2Parallels ( *hRGint_tmpCd, this ->hR_tmp );
163+ #else
164+ this ->hR_tmp = hRGint_tmpCd;
165+ #endif
160166 // merge hR_tmp to hR
161167 for (int iap = 0 ; iap < hR->size_atom_pairs (); iap++)
162168 {
@@ -182,10 +188,6 @@ void Gint_k::transfer_pvpR(hamilt::HContainer<std::complex<double>>* hR,
182188 }
183189 delete hRGint_tmpCd;
184190 }
185- delete[] iat2iwt;
186- #else
187-
188- #endif
189191 ModuleBase::timer::tick (" Gint_k" , " transfer_pvpR" );
190192 return ;
191193}
0 commit comments