Skip to content

Commit b426c1f

Browse files
committed
exchange '/bignxyz' in recip2real and real2recip
1 parent a63a862 commit b426c1f

File tree

10 files changed

+19
-27
lines changed

10 files changed

+19
-27
lines changed

source/module_pw/pw_transform.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void PW_Basis:: real2recip(std::complex<double> * in, std::complex<double> * out
3535

3636
for(int ig = 0 ; ig < this->npw ; ++ig)
3737
{
38-
out[ig] = this->ft.aux1[this->ig2isz[ig]];
38+
out[ig] = this->ft.aux1[this->ig2isz[ig]] / double(this->bignxyz);
3939
}
4040
return;
4141
ModuleBase::timer::tick("PW_Basis", "real2recip");
@@ -72,7 +72,7 @@ void PW_Basis:: real2recip(double * in, std::complex<double> * out)
7272

7373
for(int ig = 0 ; ig < this->npw ; ++ig)
7474
{
75-
out[ig] = this->ft.aux1[this->ig2isz[ig]];
75+
out[ig] = this->ft.aux1[this->ig2isz[ig]] / double(this->bignxyz);
7676
}
7777
ModuleBase::timer::tick("PW_Basis", "real2recip_gamma_only");
7878
return;
@@ -105,7 +105,7 @@ void PW_Basis:: recip2real(std::complex<double> * in, std::complex<double> * out
105105

106106
for(int ir = 0 ; ir < this->nrxx ; ++ir)
107107
{
108-
out[ir] = this->ft.aux1[ir] / double(this->bignxyz);
108+
out[ir] = this->ft.aux1[ir];
109109
}
110110
ModuleBase::timer::tick("PW_Basis", "recip2real");
111111

@@ -144,7 +144,7 @@ void PW_Basis:: recip2real(std::complex<double> * in, double * out)
144144
{
145145
for(int ipy = 0 ; ipy < npy ; ++ipy)
146146
{
147-
out[ix*npy + ipy] = this->ft.r_rspace[ix*npy*2 + ipy] / double(this->bignxyz);
147+
out[ix*npy + ipy] = this->ft.r_rspace[ix*npy*2 + ipy];
148148
}
149149
}
150150
ModuleBase::timer::tick("PW_Basis", "recip2real_gamma_only");
@@ -167,7 +167,7 @@ void PW_Basis:: real2recip(std::complex<float> * in, std::complex<float> * out)
167167

168168
for(int ig = 0 ; ig < this->npw ; ++ig)
169169
{
170-
out[ig] = this->ft.auxf1[this->ig2isz[ig]];
170+
out[ig] = this->ft.auxf1[this->ig2isz[ig]] / float(this->bignxyz);
171171
}
172172
return;
173173
}
@@ -192,7 +192,7 @@ void PW_Basis:: real2recip(float * in, std::complex<float> * out)
192192

193193
for(int ig = 0 ; ig < this->npw ; ++ig)
194194
{
195-
out[ig] = this->ft.auxf1[this->ig2isz[ig]];
195+
out[ig] = this->ft.auxf1[this->ig2isz[ig]] / float(this->bignxyz);
196196
}
197197
return;
198198
}
@@ -214,7 +214,7 @@ void PW_Basis:: recip2real(std::complex<float> * in, std::complex<float> * out)
214214

215215
for(int ir = 0 ; ir < this->nrxx ; ++ir)
216216
{
217-
out[ir] = this->ft.auxf1[ir] / float(this->bignxyz);
217+
out[ir] = this->ft.auxf1[ir];
218218
}
219219

220220
return;
@@ -240,7 +240,7 @@ void PW_Basis:: recip2real(std::complex<float> * in, float * out)
240240
{
241241
for(int ipy = 0 ; ipy < npy ; ++ipy)
242242
{
243-
out[ix*npy + ipy] = this->ft.rf_rspace[ix*npy*2 + ipy] / float(this->bignxyz);
243+
out[ix*npy + ipy] = this->ft.rf_rspace[ix*npy*2 + ipy];
244244
}
245245
}
246246
return;

source/module_pw/pw_transform_k.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void PW_Basis_K:: real2recip(std::complex<double> * in, std::complex<double> * o
3131

3232
for(int igl = 0 ; igl < this->npwk[ik] ; ++igl)
3333
{
34-
out[igl] = this->ft.aux1[this->igl2isz_k[igl+ik*this->npwk_max]];
34+
out[igl] = this->ft.aux1[this->igl2isz_k[igl+ik*this->npwk_max]] / double(this->bignxyz);
3535
}
3636
return;
3737
ModuleBase::timer::tick("PW_Basis_K", "real2recip");
@@ -68,7 +68,7 @@ void PW_Basis_K:: real2recip(double * in, std::complex<double> * out, int ik)
6868

6969
for(int igl = 0 ; igl < this->npwk[ik] ; ++igl)
7070
{
71-
out[igl] = this->ft.aux1[this->igl2isz_k[igl+ik*this->npwk_max]];
71+
out[igl] = this->ft.aux1[this->igl2isz_k[igl+ik*this->npwk_max]] / double(this->bignxyz);
7272
}
7373
ModuleBase::timer::tick("PW_Basis_K", "real2recip_gamma_only");
7474
return;
@@ -97,7 +97,7 @@ void PW_Basis_K:: recip2real(std::complex<double> * in, std::complex<double> * o
9797

9898
for(int ir = 0 ; ir < this->nrxx ; ++ir)
9999
{
100-
out[ir] = this->ft.aux1[ir] / double(this->bignxyz);
100+
out[ir] = this->ft.aux1[ir];
101101
}
102102
ModuleBase::timer::tick("PW_Basis_K", "recip2real");
103103

@@ -136,7 +136,7 @@ void PW_Basis_K:: recip2real(std::complex<double> * in, double * out, int ik)
136136
{
137137
for(int ipy = 0 ; ipy < npy ; ++ipy)
138138
{
139-
out[ix*npy + ipy] = this->ft.r_rspace[ix*npy*2 + ipy] / double(this->bignxyz);
139+
out[ix*npy + ipy] = this->ft.r_rspace[ix*npy*2 + ipy];
140140
}
141141
}
142142
ModuleBase::timer::tick("PW_Basis_K", "recip2real_gamma_only");
@@ -159,7 +159,7 @@ void PW_Basis_K:: real2recip(std::complex<float> * in, std::complex<float> * out
159159

160160
for(int igl = 0 ; igl < this->npwk[ik] ; ++igl)
161161
{
162-
out[igl] = this->ft.auxf1[this->igl2isz_k[igl+ik*this->npwk_max]];
162+
out[igl] = this->ft.auxf1[this->igl2isz_k[igl+ik*this->npwk_max]] / float(this->bignxyz);
163163
}
164164
return;
165165
}
@@ -184,7 +184,7 @@ void PW_Basis_K:: real2recip(float * in, std::complex<float> * out, int ik)
184184

185185
for(int igl = 0 ; igl < this->npwk[ik] ; ++igl)
186186
{
187-
out[igl] = this->ft.auxf1[this->igl2isz_k[igl+ik*this->npwk_max]];
187+
out[igl] = this->ft.auxf1[this->igl2isz_k[igl+ik*this->npwk_max]] / float(this->bignxyz);
188188
}
189189
return;
190190
}
@@ -206,7 +206,7 @@ void PW_Basis_K:: recip2real(std::complex<float> * in, std::complex<float> * out
206206

207207
for(int ir = 0 ; ir < this->nrxx ; ++ir)
208208
{
209-
out[ir] = this->ft.auxf1[ir] / float(this->bignxyz);
209+
out[ir] = this->ft.auxf1[ir];
210210
}
211211

212212
return;
@@ -232,7 +232,7 @@ void PW_Basis_K:: recip2real(std::complex<float> * in, float * out, int ik)
232232
{
233233
for(int ipy = 0 ; ipy < npy ; ++ipy)
234234
{
235-
out[ix*npy + ipy] = this->ft.rf_rspace[ix*npy*2 + ipy] / float(this->bignxyz);
235+
out[ix*npy + ipy] = this->ft.rf_rspace[ix*npy*2 + ipy];
236236
}
237237
}
238238
return;

source/module_pw/test/test1-2.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ TEST_F(PWTEST,test1_2)
8787
ModuleBase::Vector3<double> real_r(ix, iy, iz);
8888
double phase_im = -delta_g * real_r;
8989
complex<double> phase(0,ModuleBase::TWO_PI * phase_im);
90-
tmp[ixy * nz + iz] /= nxyz;
9190
tmp[ixy * nz + iz] *= exp(phase);
9291
}
9392
}

source/module_pw/test/test1-2f.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ TEST_F(PWTEST,test1_2f)
8787
ModuleBase::Vector3<double> real_r(ix, iy, iz);
8888
double phase_im = -delta_g * real_r;
8989
complex<double> phase(0,ModuleBase::TWO_PI * phase_im);
90-
tmp[ixy * nz + iz] /= nxyz;
9190
tmp[ixy * nz + iz] *= exp(phase);
9291
}
9392
}

source/module_pw/test/test1-3.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ TEST_F(PWTEST,test1_3)
8989
ModuleBase::Vector3<double> real_r(ix, iy, iz);
9090
double phase_im = -delta_g * real_r;
9191
complex<double> phase(0,ModuleBase::TWO_PI * phase_im);
92-
tmp[ixy * nz + iz] /= nxyz;
9392
tmp[ixy * nz + iz] *= exp(phase);
9493
}
9594
}

source/module_pw/test/test1-3f.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ TEST_F(PWTEST,test1_3f)
8989
ModuleBase::Vector3<double> real_r(ix, iy, iz);
9090
double phase_im = -delta_g * real_r;
9191
complex<double> phase(0,ModuleBase::TWO_PI * phase_im);
92-
tmp[ixy * nz + iz] /= nxyz;
9392
tmp[ixy * nz + iz] *= exp(phase);
9493
}
9594
}
@@ -112,7 +111,7 @@ TEST_F(PWTEST,test1_3f)
112111
{
113112
for(int iz = 0 ; iz < nplane ; ++iz)
114113
{
115-
EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhor[ixy*nplane+iz],1e-6);
114+
EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhor[ixy*nplane+iz],1e-4);
116115
}
117116
}
118117

source/module_pw/test/test1-4.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ TEST_F(PWTEST,test1_4)
9898
ModuleBase::Vector3<double> real_r(ix, iy, iz);
9999
double phase_im = -delta_g * real_r;
100100
complex<double> phase(0,ModuleBase::TWO_PI * phase_im);
101-
tmp[ixy * nz + iz] /= nxyz;
102101
tmp[ixy * nz + iz] *= exp(phase);
103102
}
104103
}

source/module_pw/test/test1-4f.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ TEST_F(PWTEST,test1_4f)
9898
ModuleBase::Vector3<double> real_r(ix, iy, iz);
9999
double phase_im = -delta_g * real_r;
100100
complex<double> phase(0,ModuleBase::TWO_PI * phase_im);
101-
tmp[ixy * nz + iz] /= nxyz;
102101
tmp[ixy * nz + iz] *= exp(phase);
103102
}
104103
}
@@ -119,8 +118,8 @@ TEST_F(PWTEST,test1_4f)
119118
{
120119
for(int iz = 0 ; iz < nplane ; ++iz)
121120
{
122-
EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhor[ixy*nplane+iz].real(),1e-6);
123-
EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhor[ixy*nplane+iz].imag(),1e-6);
121+
EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhor[ixy*nplane+iz].real(),1e-4);
122+
EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhor[ixy*nplane+iz].imag(),1e-4);
124123
}
125124
}
126125

source/module_pw/test/test2-2.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ TEST_F(PWTEST,test2_2)
8888
ModuleBase::Vector3<double> real_r(ix, iy, iz);
8989
double phase_im = -delta_g * real_r;
9090
complex<double> phase(0,ModuleBase::TWO_PI * phase_im);
91-
tmp[ixy * nz + iz] /= nxyz;
9291
tmp[ixy * nz + iz] *= exp(phase);
9392
}
9493
}

source/module_pw/test/test2-3.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ TEST_F(PWTEST,test2_3)
8989
ModuleBase::Vector3<double> real_r(ix, iy, iz);
9090
double phase_im = -delta_g * real_r;
9191
complex<double> phase(0,ModuleBase::TWO_PI * phase_im);
92-
tmp[ixy * nz + iz] /= nxyz;
9392
tmp[ixy * nz + iz] *= exp(phase);
9493
}
9594
}

0 commit comments

Comments
 (0)