@@ -89,8 +89,6 @@ inline void cal_psir_ylm_dphi(
8989 // array to store spherical harmonics and its derivatives
9090 std::vector<double > rly;
9191 std::vector<std::vector<double >> grly;
92- // >>> the old method
93- // ylma[id] = new double[nnn[it]]; // liaochen found this bug 2010/03/29
9492 // Ylm::get_ylm_real(GlobalC::ucell.atoms[it].nwl+1, this->dr[id], ylma[id]);
9593 // <<<
9694 // Ylm::rlylm(GlobalC::ucell.atoms[it].nwl+1, dr[id].x, dr[id].y, dr[id].z, rly, grly);
@@ -594,17 +592,8 @@ void Gint_Gamma::gamma_force(const double*const vlocal) const
594592 // ------------------------------------------------------------------
595593 double *vldr3 = get_vldr3 (vlocal, ncyz, ibx, jby, kbz);
596594
597- // ------------------------------------------------------
598- // index of wave functions for each block
599- // ------------------------------------------------------
600- int *block_iw = Gint_Tools::get_block_iw (na_grid, grid_index, this ->max_size );
601-
602- int * block_index = Gint_Tools::get_block_index (na_grid, grid_index);
603-
604- // ------------------------------------------------------
605- // band size: number of columns of a band
606- // ------------------------------------------------------------------
607- int * block_size = Gint_Tools::get_block_size (na_grid, grid_index);
595+ int * block_iw, * block_index, * block_size;
596+ Gint_Tools::get_block_info (na_grid, grid_index, block_iw, block_index, block_size);
608597
609598 Gint_Tools::Array_Pool<double > psir_vlbr3 (GlobalC::pw.bxyz , LD_pool);
610599 Gint_Tools::Array_Pool<double > psir_ylm (GlobalC::pw.bxyz , LD_pool);
@@ -619,9 +608,9 @@ void Gint_Gamma::gamma_force(const double*const vlocal) const
619608 DGridV_22, DGridV_23, DGridV_33, drr);
620609
621610 free (vldr3); vldr3=nullptr ;
622- free ( block_iw); block_iw= nullptr ;
623- free ( block_index); block_index= nullptr ;
624- free ( block_size); block_size= nullptr ;
611+ delete[] block_iw;
612+ delete[] block_index;
613+ delete[] block_size;
625614 }// k
626615 }// j
627616 }// i
0 commit comments