@@ -261,10 +261,10 @@ void Gint::transfer_DM2DtoGrid(std::vector<hamilt::HContainer<double>*> DM2D) {
261261 for (int iat = 0 ; iat < ucell->nat ; iat++) {
262262 iat2iwt[iat] = ucell->get_iat2iwt ()[iat]/2 ;
263263 }
264- Parallel_Orbitals *pv = new Parallel_Orbitals () ;
265- pv-> set (mg, ng, nb, blacs_ctxt);
266- pv-> set_atomic_trace (iat2iwt.data (), ucell->nat , mg);
267- this -> DM2D_tmp = new hamilt::HContainer<double >(pv, nullptr , &ijr_info);
264+ Parallel_Orbitals pv{} ;
265+ pv. set (mg, ng, nb, blacs_ctxt);
266+ pv. set_atomic_trace (iat2iwt.data (), ucell->nat , mg);
267+ this -> DM2D_tmp = new hamilt::HContainer<double >(& pv, nullptr , &ijr_info);
268268 this -> DM2D_tmp->set_zero ();
269269#else
270270 if (this ->DM2D_tmp != nullptr ) {
@@ -300,6 +300,8 @@ void Gint::transfer_DM2DtoGrid(std::vector<hamilt::HContainer<double>*> DM2D) {
300300 this ->DMRGint [is]->add (*(this ->DM2D_tmp ));
301301#endif
302302 }
303+ delete this ->DM2D_tmp ;
304+ this ->DM2D_tmp = nullptr ;
303305
304306 }
305307 ModuleBase::timer::tick (" Gint" , " transfer_DMR" );
0 commit comments