Skip to content

Commit 93eca60

Browse files
committed
fix wrong value of nmaxgr
1 parent e2e3d75 commit 93eca60

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

source/module_basis/module_pw/pw_basis.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ void PW_Basis::getstartgr()
7272
{
7373
if(this->gamma_only) this->nmaxgr = ( this->npw > (this->nrxx+1)/2 ) ? this->npw : (this->nrxx+1)/2;
7474
else this->nmaxgr = ( this->npw > this->nrxx ) ? this->npw : this->nrxx;
75-
this->nmaxgr = (this->nz * this->nst > this->nxy * nplane) ? this->nz * this->nst : this->nxy * nplane;
7675

7776
//---------------------------------------------
7877
// sum : starting plane of FFT box.

source/module_basis/module_pw/pw_basis.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,11 @@ class PW_Basis
237237
int nx=0, ny=0, nz=0, nxyz=0, nxy=0; // Gamma_only: fftny = int(ny/2)-1 , others: fftny = ny
238238
int liy=0, riy=0;// liy: the left edge of the pw ball; riy: the right edge of the pw ball in the y direction
239239
int lix=0, rix=0;// lix: the left edge of the pw ball; rix: the right edge of the pw ball in the x direction
240-
bool xprime = true; // true: when do recip2real, x-fft will be done last and when doing real2recip, x-fft will be done first; false: y-fft
241-
// For gamma_only, true: we use half x; false: we use half y
240+
bool xprime = true; // true: when do recip2real, x-fft will be done last and when doing real2recip, x-fft will be
241+
// done first; false: y-fft For gamma_only, true: we use half x; false: we use half y
242242
int ng_xeq0 = 0; //only used when xprime = true, number of g whose gx = 0
243-
int nmaxgr=0; // Gamma_only: max between npw and (nrxx+1)/2, others: max between npw and nrxx
244-
// Thus complex<double>[nmaxgr] is able to contain either reciprocal or real data
243+
int nmaxgr = 0; // Gamma_only: max between npw and (nrxx+1)/2, others: max between npw and nrxx
244+
// Thus complex<double>[nmaxgr] is able to contain either reciprocal or real data
245245
// FFT ft;
246246
FFT_Bundle fft_bundle;
247247
//The position of pointer in and out can be equal(in-place transform) or different(out-of-place transform).

source/module_io/unk_overlap_pw.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ std::complex<double> unkOverlap_pw::unkdotp_G0(const ModulePW::PW_Basis* rhopw,
7575
std::complex<double>* phase = new std::complex<double>[rhopw->nmaxgr];
7676

7777
// get the phase value in realspace
78-
for (int ig = 0; ig < rhopw->nmaxgr; ig++)
78+
for (int ig = 0; ig < rhopw->npw; ig++)
7979
{
8080
ModuleBase::Vector3<double> delta_G = rhopw->gdirect[ig] - G;
8181
if (delta_G.norm2() < 1e-10) // rhopw->gdirect[ig] == G
@@ -89,7 +89,7 @@ std::complex<double> unkOverlap_pw::unkdotp_G0(const ModulePW::PW_Basis* rhopw,
8989
rhopw->recip2real(phase, phase);
9090
wfcpw->recip2real(&evc[0](ik_L, iband_L, 0), psi_r, ik_L);
9191

92-
for (int ir = 0; ir < rhopw->nmaxgr; ir++)
92+
for (int ir = 0; ir < rhopw->nrxx; ir++)
9393
{
9494
psi_r[ir] = psi_r[ir] * phase[ir];
9595
}

0 commit comments

Comments
 (0)