Skip to content

Commit 9e0aa86

Browse files
committed
Fix naming of PW_Basis instance
1 parent 2b26032 commit 9e0aa86

File tree

2 files changed

+85
-85
lines changed

2 files changed

+85
-85
lines changed

source/module_io/get_wf_lcao.cpp

Lines changed: 72 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ IState_Envelope::~IState_Envelope()
1919

2020
// For gamma_only
2121
void IState_Envelope::begin(const psi::Psi<double>* psid,
22-
const ModulePW::PW_Basis* rhopw,
23-
const ModulePW::PW_Basis_K* wfcpw,
24-
const ModulePW::PW_Basis_Big* bigpw,
22+
const ModulePW::PW_Basis* pw_rhod,
23+
const ModulePW::PW_Basis_K* pw_wfc,
24+
const ModulePW::PW_Basis_Big* pw_big,
2525
const Parallel_Orbitals& para_orb,
2626
Gint_Gamma& gg,
2727
const int& out_wfc_pw,
@@ -93,7 +93,7 @@ void IState_Envelope::begin(const psi::Psi<double>* psid,
9393

9494
for (int is = 0; is < nspin; ++is)
9595
{
96-
ModuleBase::GlobalFunc::ZEROS(pes_->charge->rho[is], wfcpw->nrxx);
96+
ModuleBase::GlobalFunc::ZEROS(pes_->charge->rho[is], pw_wfc->nrxx);
9797

9898
psid->fix_k(is);
9999
#ifdef __MPI
@@ -122,19 +122,19 @@ void IState_Envelope::begin(const psi::Psi<double>* psid,
122122
const double ef_tmp = this->pes_->eferm.get_efval(is);
123123
ModuleIO::write_cube(
124124
#ifdef __MPI
125-
bigpw->bz,
126-
bigpw->nbz,
127-
rhopw->nplane,
128-
rhopw->startz_current,
125+
pw_big->bz,
126+
pw_big->nbz,
127+
pw_rhod->nplane,
128+
pw_rhod->startz_current,
129129
#endif
130130
pes_->charge->rho_save[is],
131131
is,
132132
nspin,
133133
0,
134134
ss.str(),
135-
rhopw->nx,
136-
rhopw->ny,
137-
rhopw->nz,
135+
pw_rhod->nx,
136+
pw_rhod->ny,
137+
pw_rhod->nz,
138138
ef_tmp,
139139
&(GlobalC::ucell));
140140
}
@@ -165,7 +165,7 @@ void IState_Envelope::begin(const psi::Psi<double>* psid,
165165

166166
for (int is = 0; is < nspin; ++is)
167167
{
168-
ModuleBase::GlobalFunc::ZEROS(pes_->charge->rho[is], wfcpw->nrxx);
168+
ModuleBase::GlobalFunc::ZEROS(pes_->charge->rho[is], pw_wfc->nrxx);
169169

170170
psid->fix_k(is);
171171
#ifdef __MPI
@@ -192,17 +192,17 @@ void IState_Envelope::begin(const psi::Psi<double>* psid,
192192

193193
// only for gamma_only now
194194
psi_g.fix_k(is);
195-
this->set_pw_wfc(wfcpw, is, ib, nspin, pes_->charge->rho, psi_g);
195+
this->set_pw_wfc(pw_wfc, is, ib, nspin, pes_->charge->rho, psi_g);
196196

197197
// Calculate real-space wave functions
198198
psi_g.fix_k(is);
199-
std::vector<std::complex<double>> wfc_r(wfcpw->nrxx);
200-
wfcpw->recip2real(&psi_g(ib, 0), wfc_r.data(), is);
199+
std::vector<std::complex<double>> wfc_r(pw_wfc->nrxx);
200+
pw_wfc->recip2real(&psi_g(ib, 0), wfc_r.data(), is);
201201

202202
// Extract real and imaginary parts
203-
std::vector<double> wfc_real(wfcpw->nrxx);
204-
std::vector<double> wfc_imag(wfcpw->nrxx);
205-
for (int ir = 0; ir < wfcpw->nrxx; ++ir)
203+
std::vector<double> wfc_real(pw_wfc->nrxx);
204+
std::vector<double> wfc_imag(pw_wfc->nrxx);
205+
for (int ir = 0; ir < pw_wfc->nrxx; ++ir)
206206
{
207207
wfc_real[ir] = wfc_r[ir].real();
208208
wfc_imag[ir] = wfc_r[ir].imag();
@@ -213,19 +213,19 @@ void IState_Envelope::begin(const psi::Psi<double>* psid,
213213
ss_real << global_out_dir << "BAND" << ib + 1 << "_GAMMA" << "_SPIN" << is + 1 << "_REAL.cube";
214214
ModuleIO::write_cube(
215215
#ifdef __MPI
216-
bigpw->bz,
217-
bigpw->nbz,
218-
rhopw->nplane,
219-
rhopw->startz_current,
216+
pw_big->bz,
217+
pw_big->nbz,
218+
pw_rhod->nplane,
219+
pw_rhod->startz_current,
220220
#endif
221221
wfc_real.data(),
222222
is,
223223
nspin,
224224
0,
225225
ss_real.str(),
226-
rhopw->nx,
227-
rhopw->ny,
228-
rhopw->nz,
226+
pw_rhod->nx,
227+
pw_rhod->ny,
228+
pw_rhod->nz,
229229
ef_tmp,
230230
&(GlobalC::ucell));
231231

@@ -234,19 +234,19 @@ void IState_Envelope::begin(const psi::Psi<double>* psid,
234234
ss_imag << global_out_dir << "BAND" << ib + 1 << "_GAMMA" << "_SPIN" << is + 1 << "_IMAG.cube";
235235
ModuleIO::write_cube(
236236
#ifdef __MPI
237-
bigpw->bz,
238-
bigpw->nbz,
239-
rhopw->nplane,
240-
rhopw->startz_current,
237+
pw_big->bz,
238+
pw_big->nbz,
239+
pw_rhod->nplane,
240+
pw_rhod->startz_current,
241241
#endif
242242
wfc_imag.data(),
243243
is,
244244
nspin,
245245
0,
246246
ss_imag.str(),
247-
rhopw->nx,
248-
rhopw->ny,
249-
rhopw->nz,
247+
pw_rhod->nx,
248+
pw_rhod->ny,
249+
pw_rhod->nz,
250250
ef_tmp,
251251
&(GlobalC::ucell));
252252
}
@@ -259,12 +259,12 @@ void IState_Envelope::begin(const psi::Psi<double>* psid,
259259
ssw << global_out_dir << "WAVEFUNC";
260260
std::cout << " Write G-space wave functions into \"" << global_out_dir << "/" << ssw.str() << "\" files."
261261
<< std::endl;
262-
ModuleIO::write_wfc_pw(ssw.str(), psi_g, kv, wfcpw);
262+
ModuleIO::write_wfc_pw(ssw.str(), psi_g, kv, pw_wfc);
263263
}
264264

265265
if (out_wfc_r)
266266
{
267-
ModuleIO::write_psi_r_1(psi_g, wfcpw, "wfc_realspace", false, kv);
267+
ModuleIO::write_psi_r_1(psi_g, pw_wfc, "wfc_realspace", false, kv);
268268
}
269269

270270
for (int is = 0; is < nspin; ++is)
@@ -280,9 +280,9 @@ void IState_Envelope::begin(const psi::Psi<double>* psid,
280280

281281
// For multi-k
282282
void IState_Envelope::begin(const psi::Psi<std::complex<double>>* psi,
283-
const ModulePW::PW_Basis* rhopw,
284-
const ModulePW::PW_Basis_K* wfcpw,
285-
const ModulePW::PW_Basis_Big* bigpw,
283+
const ModulePW::PW_Basis* pw_rhod,
284+
const ModulePW::PW_Basis_K* pw_wfc,
285+
const ModulePW::PW_Basis_Big* pw_big,
286286
const Parallel_Orbitals& para_orb,
287287
Gint_k& gk,
288288
const int& out_wf,
@@ -330,7 +330,7 @@ void IState_Envelope::begin(const psi::Psi<std::complex<double>>* psi,
330330
psi::Psi<std::complex<double>> psi_g(kv.ngk.data());
331331
if (out_wf || out_wf_r)
332332
{
333-
psi_g.resize(nks, nbands, wfcpw->npwk_max);
333+
psi_g.resize(nks, nbands, pw_wfc->npwk_max);
334334
}
335335

336336
int mode_norm = 0;
@@ -360,7 +360,7 @@ void IState_Envelope::begin(const psi::Psi<std::complex<double>>* psi,
360360
{
361361
const int ispin = kv.isk[ik];
362362
ModuleBase::GlobalFunc::ZEROS(pes_->charge->rho[ispin],
363-
wfcpw->nrxx); // terrible, you make changes on another instance's data???
363+
pw_wfc->nrxx); // terrible, you make changes on another instance's data???
364364
std::cout << " Calculate envelope function for kpoint " << ik + 1 << ", band" << ib + 1 << std::endl;
365365
// 2d-to-grid conversion is unified into `wfc_2d_to_grid`.
366366
psi->fix_k(ik);
@@ -382,19 +382,19 @@ void IState_Envelope::begin(const psi::Psi<std::complex<double>>* psi,
382382

383383
ModuleIO::write_cube(
384384
#ifdef __MPI
385-
bigpw->bz,
386-
bigpw->nbz,
387-
rhopw->nplane,
388-
rhopw->startz_current,
385+
pw_big->bz,
386+
pw_big->nbz,
387+
pw_rhod->nplane,
388+
pw_rhod->startz_current,
389389
#endif
390390
pes_->charge->rho[ispin],
391391
ispin,
392392
nspin,
393393
0,
394394
ss.str(),
395-
rhopw->nx,
396-
rhopw->ny,
397-
rhopw->nz,
395+
pw_rhod->nx,
396+
pw_rhod->ny,
397+
pw_rhod->nz,
398398
ef_tmp,
399399
&(GlobalC::ucell),
400400
3,
@@ -403,7 +403,7 @@ void IState_Envelope::begin(const psi::Psi<std::complex<double>>* psi,
403403
if (out_wf || out_wf_r)
404404
{
405405
psi_g.fix_k(ik);
406-
this->set_pw_wfc(wfcpw, ik, ib, nspin, pes_->charge->rho, psi_g);
406+
this->set_pw_wfc(pw_wfc, ik, ib, nspin, pes_->charge->rho, psi_g);
407407
}
408408
}
409409
}
@@ -417,11 +417,11 @@ void IState_Envelope::begin(const psi::Psi<std::complex<double>>* psi,
417417
ssw << global_out_dir << "WAVEFUNC";
418418
std::cout << " write G-space wave functions into \"" << global_out_dir << "/" << ssw.str() << "\" files."
419419
<< std::endl;
420-
ModuleIO::write_wfc_pw(ssw.str(), psi_g, kv, wfcpw);
420+
ModuleIO::write_wfc_pw(ssw.str(), psi_g, kv, pw_wfc);
421421
}
422422
if (out_wf_r)
423423
{
424-
ModuleIO::write_psi_r_1(psi_g, wfcpw, "wfc_realspace", false, kv);
424+
ModuleIO::write_psi_r_1(psi_g, pw_wfc, "wfc_realspace", false, kv);
425425
}
426426

427427
std::cout << " Outputting real-space wave functions in cube format..." << std::endl;
@@ -440,13 +440,13 @@ void IState_Envelope::begin(const psi::Psi<std::complex<double>>* psi,
440440
psi_g.fix_k(ik);
441441

442442
// Calculate real-space wave functions
443-
std::vector<std::complex<double>> wfc_r(wfcpw->nrxx);
444-
wfcpw->recip2real(&psi_g(ib, 0), wfc_r.data(), ik);
443+
std::vector<std::complex<double>> wfc_r(pw_wfc->nrxx);
444+
pw_wfc->recip2real(&psi_g(ib, 0), wfc_r.data(), ik);
445445

446446
// Extract real and imaginary parts
447-
std::vector<double> wfc_real(wfcpw->nrxx);
448-
std::vector<double> wfc_imag(wfcpw->nrxx);
449-
for (int ir = 0; ir < wfcpw->nrxx; ++ir)
447+
std::vector<double> wfc_real(pw_wfc->nrxx);
448+
std::vector<double> wfc_imag(pw_wfc->nrxx);
449+
for (int ir = 0; ir < pw_wfc->nrxx; ++ir)
450450
{
451451
wfc_real[ir] = wfc_r[ir].real();
452452
wfc_imag[ir] = wfc_r[ir].imag();
@@ -459,19 +459,19 @@ void IState_Envelope::begin(const psi::Psi<std::complex<double>>* psi,
459459
const double ef_tmp = this->pes_->eferm.get_efval(ispin);
460460
ModuleIO::write_cube(
461461
#ifdef __MPI
462-
bigpw->bz,
463-
bigpw->nbz,
464-
rhopw->nplane,
465-
rhopw->startz_current,
462+
pw_big->bz,
463+
pw_big->nbz,
464+
pw_rhod->nplane,
465+
pw_rhod->startz_current,
466466
#endif
467467
wfc_real.data(),
468468
ispin,
469469
nspin,
470470
0,
471471
ss_real.str(),
472-
rhopw->nx,
473-
rhopw->ny,
474-
rhopw->nz,
472+
pw_rhod->nx,
473+
pw_rhod->ny,
474+
pw_rhod->nz,
475475
ef_tmp,
476476
&(GlobalC::ucell));
477477

@@ -481,19 +481,19 @@ void IState_Envelope::begin(const psi::Psi<std::complex<double>>* psi,
481481
<< "_IMAG.cube";
482482
ModuleIO::write_cube(
483483
#ifdef __MPI
484-
bigpw->bz,
485-
bigpw->nbz,
486-
rhopw->nplane,
487-
rhopw->startz_current,
484+
pw_big->bz,
485+
pw_big->nbz,
486+
pw_rhod->nplane,
487+
pw_rhod->startz_current,
488488
#endif
489489
wfc_imag.data(),
490490
ispin,
491491
nspin,
492492
0,
493493
ss_imag.str(),
494-
rhopw->nx,
495-
rhopw->ny,
496-
rhopw->nz,
494+
pw_rhod->nx,
495+
pw_rhod->ny,
496+
pw_rhod->nz,
497497
ef_tmp,
498498
&(GlobalC::ucell));
499499
}
@@ -627,7 +627,7 @@ void IState_Envelope::select_bands(const int nbands_istate,
627627
}
628628

629629
// for each band
630-
void IState_Envelope::set_pw_wfc(const ModulePW::PW_Basis_K* wfcpw,
630+
void IState_Envelope::set_pw_wfc(const ModulePW::PW_Basis_K* pw_wfc,
631631
const int& ik,
632632
const int& ib,
633633
const int& nspin,
@@ -640,19 +640,19 @@ void IState_Envelope::set_pw_wfc(const ModulePW::PW_Basis_K* wfcpw,
640640
ModuleBase::TITLE("IState_Envelope", "set_pw_wfc");
641641
}
642642

643-
std::vector<std::complex<double>> Porter(wfcpw->nrxx);
643+
std::vector<std::complex<double>> Porter(pw_wfc->nrxx);
644644
// here I refer to v_hartree, but I don't know how to deal with NSPIN=4
645645
const int nspin0 = (nspin == 2) ? 2 : 1;
646646
for (int is = 0; is < nspin0; ++is)
647647
{
648-
for (int ir = 0; ir < wfcpw->nrxx; ++ir)
648+
for (int ir = 0; ir < pw_wfc->nrxx; ++ir)
649649
{
650650
Porter[ir] += std::complex<double>(rho[is][ir], 0.0);
651651
}
652652
}
653653

654654
// call FFT
655-
wfcpw->real2recip(Porter.data(), &wfc_g(ib, 0), ik);
655+
pw_wfc->real2recip(Porter.data(), &wfc_g(ib, 0), ik);
656656
}
657657

658658
#ifdef __MPI

source/module_io/get_wf_lcao.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ class IState_Envelope
1818

1919
/// For gamma_only
2020
void begin(const psi::Psi<double>* psid,
21-
const ModulePW::PW_Basis* rhopw,
22-
const ModulePW::PW_Basis_K* wfcpw,
23-
const ModulePW::PW_Basis_Big* bigpw,
21+
const ModulePW::PW_Basis* pw_rhod,
22+
const ModulePW::PW_Basis_K* pw_wfc,
23+
const ModulePW::PW_Basis_Big* pw_big,
2424
const Parallel_Orbitals& para_orb,
2525
Gint_Gamma& gg,
2626
const int& out_wfc_pw,
@@ -37,9 +37,9 @@ class IState_Envelope
3737

3838
/// tmp, delete after Gint is refactored.
3939
void begin(const psi::Psi<double>* psid,
40-
const ModulePW::PW_Basis* rhopw,
41-
const ModulePW::PW_Basis_K* wfcpw,
42-
const ModulePW::PW_Basis_Big* bigpw,
40+
const ModulePW::PW_Basis* pw_rhod,
41+
const ModulePW::PW_Basis_K* pw_wfc,
42+
const ModulePW::PW_Basis_Big* pw_big,
4343
const Parallel_Orbitals& para_orb,
4444
Gint_k& gg,
4545
const int& out_wfc_pw,
@@ -59,9 +59,9 @@ class IState_Envelope
5959

6060
/// For multi-k
6161
void begin(const psi::Psi<std::complex<double>>* psi,
62-
const ModulePW::PW_Basis* rhopw,
63-
const ModulePW::PW_Basis_K* wfcpw,
64-
const ModulePW::PW_Basis_Big* bigpw,
62+
const ModulePW::PW_Basis* pw_rhod,
63+
const ModulePW::PW_Basis_K* pw_wfc,
64+
const ModulePW::PW_Basis_Big* pw_big,
6565
const Parallel_Orbitals& para_orb,
6666
Gint_k& gk,
6767
const int& out_wfc_pw,
@@ -78,9 +78,9 @@ class IState_Envelope
7878

7979
/// tmp, delete after Gint is refactored.
8080
void begin(const psi::Psi<std::complex<double>>* psi,
81-
const ModulePW::PW_Basis* rhopw,
82-
const ModulePW::PW_Basis_K* wfcpw,
83-
const ModulePW::PW_Basis_Big* bigpw,
81+
const ModulePW::PW_Basis* pw_rhod,
82+
const ModulePW::PW_Basis_K* pw_wfc,
83+
const ModulePW::PW_Basis_Big* pw_big,
8484
const Parallel_Orbitals& para_orb,
8585
Gint_Gamma& gk,
8686
const int& out_wfc_pw,
@@ -106,7 +106,7 @@ class IState_Envelope
106106
const int mode,
107107
const int fermi_band);
108108

109-
void set_pw_wfc(const ModulePW::PW_Basis_K* wfcpw,
109+
void set_pw_wfc(const ModulePW::PW_Basis_K* pw_wfc,
110110
const int& ik,
111111
const int& ib,
112112
const int& nspin,

0 commit comments

Comments
 (0)