Skip to content

Commit 747bbfb

Browse files
author
wenfei-li
committed
fix bug in previous commits
1 parent 183c50a commit 747bbfb

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

source/module_gint/gint_tools.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace Gint_Tools
3939
const int jby,
4040
const int kbz)
4141
{
42-
int *vindex = new int[GlobalC::bigpw->bxyz*sizeof(int)];
42+
int *vindex = new int[GlobalC::bigpw->bxyz];
4343
int bindex=0;
4444
// z is the fastest,
4545
// ipart can be obtained by using a previously stored array
@@ -71,7 +71,7 @@ namespace Gint_Tools
7171
{
7272
// set the index for obtaining local potentials
7373
int* vindex = Gint_Tools::get_vindex(ncyz, ibx, jby, kbz);
74-
double *vldr3 = new double[GlobalC::bigpw->bxyz*sizeof(double)];
74+
double *vldr3 = new double[GlobalC::bigpw->bxyz];
7575
for(int ib=0; ib<GlobalC::bigpw->bxyz; ib++)
7676
{
7777
vldr3[ib]=vlocal[vindex[ib]] * dv;
@@ -88,7 +88,7 @@ namespace Gint_Tools
8888
{
8989
// set the index for obtaining local potentials
9090
int* vindex = Gint_Tools::get_vindex(start_ind, ncyz);
91-
double *vldr3 = new double[GlobalC::bigpw->bxyz*sizeof(double)];
91+
double *vldr3 = new double[GlobalC::bigpw->bxyz];
9292
for(int ib=0; ib<GlobalC::bigpw->bxyz; ib++)
9393
{
9494
vldr3[ib]=vlocal[vindex[ib]] * dv;

source/module_gint/gint_tools.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ namespace Gint_Tools
243243
template<typename T>
244244
Array_Pool<T>::Array_Pool(const int nr, const int nc) // Attention: uninitialized
245245
{
246-
ptr_1D = new T[nr*nc*sizeof(T)];
247-
ptr_2D = new T*[nr*sizeof(T*)];
246+
ptr_1D = new T[nr*nc];
247+
ptr_2D = new T*[nr];
248248
for (int ir=0; ir<nr; ++ir)
249249
ptr_2D[ir] = &ptr_1D[ir*nc];
250250
}

0 commit comments

Comments
 (0)