Skip to content

Commit 37d5c4e

Browse files
author
wenfei-li
committed
gint : unify cal_psir a little bit
1 parent 0339c1c commit 37d5c4e

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

source/src_lcao/gint_gamma_rho.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,12 @@ Gint_Tools::Array_Pool<double> Gint_Gamma::gamma_charge(const double*const*const
226226
// set up band matrix psir_ylm and psir_DM
227227
const int LD_pool = max_size*GlobalC::ucell.nwmax;
228228

229-
const Gint_Tools::Array_Pool<double> psir_ylm = Gint_Tools::cal_psir_ylm(
230-
na_grid, LD_pool, grid_index, delta_r,
229+
Gint_Tools::Array_Pool<double> psir_ylm(GlobalC::pw.bxyz, LD_pool);
230+
Gint_Tools::cal_psir_ylm(
231+
na_grid, grid_index, delta_r,
231232
block_index, block_size,
232-
cal_flag);
233+
cal_flag,
234+
psir_ylm.ptr_2D);
233235

234236
this->cal_band_rho(na_grid, LD_pool, block_iw, block_size, block_index,
235237
cal_flag, psir_ylm.ptr_2D, vindex, DM, rho);

source/src_lcao/gint_gamma_vl.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,12 @@ Gint_Tools::Array_Pool<double> Gint_Gamma::gamma_vlocal(const double*const vloca
329329
//------------------------------------------------------------------
330330
// compute atomic basis phi(r) with both radial and angular parts
331331
//------------------------------------------------------------------
332-
const Gint_Tools::Array_Pool<double> psir_ylm = Gint_Tools::cal_psir_ylm(
333-
na_grid, LD_pool, grid_index, delta_r,
334-
block_index, block_size, cal_flag);
332+
Gint_Tools::Array_Pool<double> psir_ylm(GlobalC::pw.bxyz, LD_pool);
333+
Gint_Tools::cal_psir_ylm(
334+
na_grid, grid_index, delta_r,
335+
block_index, block_size,
336+
cal_flag,
337+
psir_ylm.ptr_2D);
335338

336339
//------------------------------------------------------------------
337340
// extract the local potentials.

source/src_lcao/gint_tools.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,15 @@ namespace Gint_Tools
111111
return cal_flag;
112112
}
113113

114-
Array_Pool<double> cal_psir_ylm(
114+
void cal_psir_ylm(
115115
const int na_grid, // number of atoms on this grid
116-
const int LD_pool,
117116
const int grid_index, // 1d index of FFT index (i,j,k)
118117
const double delta_r, // delta_r of the uniform FFT grid
119118
const int*const block_index, // block_index[na_grid+1], count total number of atomis orbitals
120119
const int*const block_size, // block_size[na_grid], number of columns of a band
121-
const bool*const*const cal_flag) // cal_flag[GlobalC::pw.bxyz][na_grid], whether the atom-grid distance is larger than cutoff
120+
const bool*const*const cal_flag,
121+
double*const*const psir_ylm) // cal_flag[GlobalC::pw.bxyz][na_grid], whether the atom-grid distance is larger than cutoff
122122
{
123-
Array_Pool<double> psir_ylm(GlobalC::pw.bxyz, LD_pool);
124123
for (int id=0; id<na_grid; id++)
125124
{
126125
// there are two parameters we want to know here:
@@ -147,7 +146,7 @@ namespace Gint_Tools
147146
// number of grids in each big cell (bxyz)
148147
for(int ib=0; ib<GlobalC::pw.bxyz; ib++)
149148
{
150-
double *p=&psir_ylm.ptr_2D[ib][block_index[id]];
149+
double *p=psir_ylm[ib][block_index[id]];
151150
if(!cal_flag[ib][id])
152151
{
153152
ModuleBase::GlobalFunc::ZEROS(p, block_size[id]);
@@ -204,7 +203,7 @@ namespace Gint_Tools
204203
}// end distance<=(GlobalC::ORB.Phi[it].getRcut()-1.0e-15)
205204
}// end ib
206205
}// end id
207-
return psir_ylm;
206+
return;
208207
}
209208

210209
void cal_dpsir_ylm(

source/src_lcao/gint_tools.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ namespace Gint_Tools
4949
const int grid_index);
5050

5151
// psir_ylm[pw.bxyz][LD_pool]
52-
Array_Pool<double> cal_psir_ylm(
52+
void cal_psir_ylm(
5353
const int na_grid, // number of atoms on this grid
54-
const int LD_pool,
5554
const int grid_index, // 1d index of FFT index (i,j,k)
5655
const double delta_r, // delta_r of the uniform FFT grid
5756
const int*const block_index, // count total number of atomis orbitals
5857
const int*const block_size,
59-
const bool*const*const cal_flag); // whether the atom-grid distance is larger than cutoff
58+
const bool*const*const cal_flag,
59+
double*const*const psir_ylm); // whether the atom-grid distance is larger than cutoff
6060

6161
void cal_dpsir_ylm(
6262
const int na_grid, // number of atoms on this grid

0 commit comments

Comments
 (0)