@@ -33,7 +33,7 @@ Gint::~Gint() {
3333 delete this ->hRGint_tmp [is];
3434 }
3535#ifdef __MPI
36- delete this ->DM2D_tmp ;
36+ delete this ->dm2d_tmp ;
3737#endif
3838}
3939
@@ -171,8 +171,8 @@ void Gint::initialize_pvpR(const UnitCell& ucell_in, const Grid_Driver* gd, cons
171171 this ->hRGint_tmp [is] = new hamilt::HContainer<double >(ucell_in.nat );
172172 }
173173#ifdef __MPI
174- if (this ->DM2D_tmp != nullptr ) {
175- delete this ->DM2D_tmp ;
174+ if (this ->dm2d_tmp != nullptr ) {
175+ delete this ->dm2d_tmp ;
176176 }
177177#endif
178178 }
@@ -224,7 +224,7 @@ void Gint::reset_DMRGint(const int& nspin)
224224 {
225225 for (auto & d : this ->DMRGint ) { d->allocate (nullptr , false ); }
226226#ifdef __MPI
227- delete this ->DM2D_tmp ;
227+ delete this ->dm2d_tmp ;
228228#endif
229229 }
230230 }
@@ -260,24 +260,24 @@ void Gint::transfer_DM2DtoGrid(std::vector<hamilt::HContainer<double>*> DM2D) {
260260 int ng = DM2D[0 ]->get_paraV ()->get_global_col_size ()/2 ;
261261 int nb = DM2D[0 ]->get_paraV ()->get_block_size ()/2 ;
262262 int blacs_ctxt = DM2D[0 ]->get_paraV ()->blacs_ctxt ;
263- int * iat2iwt = new int [ ucell->nat ] ;
263+ std::vector< int > iat2iwt ( ucell->nat ) ;
264264 for (int iat = 0 ; iat < ucell->nat ; iat++) {
265265 iat2iwt[iat] = ucell->get_iat2iwt ()[iat]/2 ;
266266 }
267267 Parallel_Orbitals *pv = new Parallel_Orbitals ();
268268 pv->set (mg, ng, nb, blacs_ctxt);
269- pv->set_atomic_trace (iat2iwt, ucell->nat , mg);
269+ pv->set_atomic_trace (iat2iwt. data () , ucell->nat , mg);
270270 auto ijr_info = DM2D[0 ]->get_ijr_info ();
271- this -> DM2D_tmp = new hamilt::HContainer<double >(pv, nullptr , &ijr_info);
272- ModuleBase::Memory::record (" Gint::DM2D_tmp " , this ->DM2D_tmp ->get_memory_size ());
271+ this -> dm2d_tmp = new hamilt::HContainer<double >(pv, nullptr , &ijr_info);
272+ ModuleBase::Memory::record (" Gint::dm2d_tmp " , this ->dm2d_tmp ->get_memory_size ());
273273 for (int is = 0 ; is < 4 ; is++){
274274 for (int iap = 0 ; iap < DM2D[0 ]->size_atom_pairs (); ++iap) {
275275 auto & ap = DM2D[0 ]->get_atom_pair (iap);
276276 int iat1 = ap.get_atom_i ();
277277 int iat2 = ap.get_atom_j ();
278278 for (int ir = 0 ; ir < ap.get_R_size (); ++ir) {
279279 const ModuleBase::Vector3<int > r_index = ap.get_R_index (ir);
280- double * matrix_out = this -> DM2D_tmp -> find_matrix (iat1, iat2, r_index)->get_pointer ();
280+ double * matrix_out = this -> dm2d_tmp -> find_matrix (iat1, iat2, r_index)->get_pointer ();
281281 double * matrix_in = ap.get_pointer (ir);
282282 for (int irow = 0 ; irow < ap.get_row_size ()/2 ; irow ++) {
283283 for (int icol = 0 ; icol < ap.get_col_size ()/2 ; icol++){
@@ -288,7 +288,7 @@ void Gint::transfer_DM2DtoGrid(std::vector<hamilt::HContainer<double>*> DM2D) {
288288 }
289289 }
290290 }
291- hamilt::transferParallels2Serials ( *(this ->DM2D_tmp ), this ->DMRGint [is]);
291+ hamilt::transferParallels2Serials ( *(this ->dm2d_tmp ), this ->DMRGint [is]);
292292 }
293293#else
294294 // this->DMRGint_full = DM2D[0];
0 commit comments