Skip to content

Commit f8a645f

Browse files
authored
Merge pull request #797 from wenfei-li/develop
Gint : merge the calculation of block info; removed unused class grid_base
2 parents 0edf803 + e72e11e commit f8a645f

16 files changed

+42
-630
lines changed

source/Makefile.Objects

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ gint_k_init.o\
122122
gint_k_vl.o\
123123
gint_k_rho.o\
124124
gint_k_fvl.o\
125-
grid_base.o\
126125
grid_base_beta.o\
127126
ORB_control.o\
128127
ORB_read.o\

source/module_grid/Makefile.Objects

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ complexarray.o\
1717
complexmatrix.o\
1818
matrix.o\
1919

20-
OBJS_GRID=grid_base.o\
20+
OBJS_GRID=
2121
grid_base_beta.o\
2222
grid_bigcell.o\
2323
grid_meshball.o\
2424
grid_meshk.o\
2525
grid_technique.o\
26-

source/src_lcao/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ list(APPEND objects
4343
gint_k_vl.cpp
4444
gint_tools.cpp
4545
global_fp.cpp
46-
grid_base.cpp
4746
grid_base_beta.cpp
4847
grid_bigcell.cpp
4948
grid_meshball.cpp

source/src_lcao/gint_gamma_env.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ void Gint_Gamma::gamma_envelope(const double* wfc, double* rho)
2626
const double delta_r = GlobalC::ORB.dr_uniform;
2727
const Numerical_Orbital_Lm* pointer;
2828

29-
// allocate 1
30-
int nnnmax=0;
31-
for(int T=0; T<GlobalC::ucell.ntype; T++)
32-
{
33-
nnnmax = max(nnnmax, nnn[T]);
34-
}
35-
3629
double*** dr; // vectors between atom and grid: [bxyz, maxsize, 3]
3730
double** distance; // distance between atom and grid: [bxyz, maxsize]
3831
double*** psir_ylm;
@@ -136,7 +129,6 @@ void Gint_Gamma::gamma_envelope(const double* wfc, double* rho)
136129

137130
std::vector<double> ylma;
138131
//if(distance[id] > GlobalC::GridT.orbital_rmax) continue;
139-
// Ylm::get_ylm_real(this->nnn[it], this->dr[id], ylma);
140132
if (distance[ib][id] < 1.0E-9) distance[ib][id] += 1.0E-9;
141133

142134
ModuleBase::Ylm::sph_harm ( GlobalC::ucell.atoms[it].nwl,

source/src_lcao/gint_gamma_fvl.cpp

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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

source/src_lcao/gint_gamma_mull.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@ void Gint_Gamma::gamma_mulliken(double** mulliken)
3232
const double delta_r = GlobalC::ORB.dr_uniform;
3333
const Numerical_Orbital_Lm* pointer;
3434

35-
// allocate 1
36-
int nnnmax=0;
37-
for(int T=0; T<GlobalC::ucell.ntype; T++)
38-
{
39-
nnnmax = max(nnnmax, nnn[T]);
40-
}
41-
4235
double*** dr; // vectors between atom and grid: [bxyz, maxsize, 3]
4336
double** distance; // distance between atom and grid: [bxyz, maxsize]
4437
double*** psir_ylm;
@@ -141,8 +134,6 @@ void Gint_Gamma::gamma_mulliken(double** mulliken)
141134
}
142135

143136
std::vector<double> ylma;
144-
//if(distance[id] > GlobalC::GridT.orbital_rmax) continue;
145-
// Ylm::get_ylm_real(this->nnn[it], this->dr[id], ylma);
146137
if (distance[ib][id] < 1.0E-9) distance[ib][id] += 1.0E-9;
147138

148139
ModuleBase::Ylm::sph_harm ( GlobalC::ucell.atoms[it].nwl,
@@ -214,7 +205,6 @@ void Gint_Gamma::gamma_mulliken(double** mulliken)
214205
// a particular number: (lmax+1)^2 and vectors between
215206
// atom and grid point(we need the direction), the output
216207
// are put in the array: ylm1.
217-
//Ylm::get_ylm_real(this->nnn[T1], this->dr[ia1], this->ylm1);
218208

219209
// attention! assume all rcut are same for this atom type now.
220210
//if (distance[ia1] > GlobalC::ORB.Phi[T1].getRcut())continue;

source/src_lcao/gint_gamma_rho.cpp

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,8 @@ Gint_Tools::Array_Pool<double> Gint_Gamma::gamma_charge(const double*const*const
215215
// here vindex refers to local potentials
216216
int* vindex = Gint_Tools::get_vindex(ncyz, ibx, jby, kbz);
217217

218-
//------------------------------------------------------
219-
// band size: number of columns of a band
220-
//------------------------------------------------------------------
221-
int* block_size = Gint_Tools::get_block_size(na_grid, grid_index);
222-
223-
//------------------------------------------------------
224-
// index of wave functions for each block
225-
//------------------------------------------------------
226-
int *block_iw = Gint_Tools::get_block_iw(na_grid, grid_index, this->max_size);
227-
228-
int* block_index = Gint_Tools::get_block_index(na_grid, grid_index);
218+
int * block_iw, * block_index, * block_size;
219+
Gint_Tools::get_block_info(na_grid, grid_index, block_iw, block_index, block_size);
229220

230221
//------------------------------------------------------
231222
// whether the atom-grid distance is larger than cutoff
@@ -244,9 +235,9 @@ Gint_Tools::Array_Pool<double> Gint_Gamma::gamma_charge(const double*const*const
244235
cal_flag, psir_ylm.ptr_2D, vindex, DM, rho);
245236

246237
free(vindex); vindex=nullptr;
247-
free(block_size); block_size=nullptr;
248-
free(block_iw); block_iw=nullptr;
249-
free(block_index); block_index=nullptr;
238+
delete[] block_iw;
239+
delete[] block_index;
240+
delete[] block_size;
250241

251242
for(int ib=0; ib<GlobalC::pw.bxyz; ++ib)
252243
free(cal_flag[ib]);

source/src_lcao/gint_gamma_vl.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -374,18 +374,8 @@ Gint_Tools::Array_Pool<double> Gint_Gamma::gamma_vlocal(const double*const vloca
374374
//------------------------------------------------------------------
375375
const int kbz=k*GlobalC::pw.bz-GlobalC::pw.nczp_start;
376376

377-
//------------------------------------------------------
378-
// index of wave functions for each block
379-
//------------------------------------------------------
380-
int *block_iw = Gint_Tools::get_block_iw(na_grid, grid_index, this->max_size);
381-
382-
int* block_index = Gint_Tools::get_block_index(na_grid, grid_index);
383-
384-
//------------------------------------------------------
385-
// band size: number of columns of a band
386-
//------------------------------------------------------
387-
int* block_size = Gint_Tools::get_block_size(na_grid, grid_index);
388-
377+
int * block_iw, * block_index, * block_size;
378+
Gint_Tools::get_block_info(na_grid, grid_index, block_iw, block_index, block_size);
389379
//------------------------------------------------------
390380
// whether the atom-grid distance is larger than cutoff
391381
//------------------------------------------------------
@@ -414,9 +404,9 @@ Gint_Tools::Array_Pool<double> Gint_Gamma::gamma_vlocal(const double*const vloca
414404
vldr3, psir_ylm.ptr_2D, psir_vlbr3.ptr_2D, lgd_now, GridVlocal_thread.ptr_2D);
415405

416406
free(vldr3); vldr3=nullptr;
417-
free(block_iw); block_iw=nullptr;
418-
free(block_index); block_index=nullptr;
419-
free(block_size); block_size=nullptr;
407+
delete[] block_iw;
408+
delete[] block_index;
409+
delete[] block_size;
420410

421411
for(int ib=0; ib<GlobalC::pw.bxyz; ++ib)
422412
free(cal_flag[ib]);

source/src_lcao/gint_k_init.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ Gint_k_init::Gint_k_init()
66
nbx = nby = nbz =0;
77
ncxyz = 0;
88
nbz_start = 0;
9-
nnn = new int[1];
109
}
1110

1211
Gint_k_init::~Gint_k_init()
1312
{
14-
delete[] nnn;
1513
}
1614

1715
void Gint_k_init::init(
@@ -34,15 +32,6 @@ void Gint_k_init::init(
3432
assert(nbz>0);
3533
assert(ncxyz>0);
3634

37-
// claculate the maximal orbital numbers
38-
// for each type of atom.
39-
delete[] this->nnn;
40-
this->nnn = new int[GlobalC::ucell.ntype];
41-
for(int it=0; it<GlobalC::ucell.ntype; it++)
42-
{
43-
this->nnn[it] = (GlobalC::ucell.atoms[it].nwl+1) * (GlobalC::ucell.atoms[it].nwl+1);
44-
}
45-
4635
assert( GlobalC::ucell.omega > 0.0);
4736

4837
return;

source/src_lcao/gint_k_init.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class Gint_k_init
2929
int nbz;
3030
int ncxyz;
3131
int nbz_start;
32-
int* nnn;
3332

3433
};
3534

0 commit comments

Comments
 (0)