@@ -59,10 +59,10 @@ void IState_Envelope::begin(const psi::Psi<double>* psid,
5959 }
6060
6161 // for pw_wfc in G space
62- psi::Psi<std::complex <double >> pw_wfc_g ;
62+ psi::Psi<std::complex <double >> psi_g ;
6363 if (out_wfc_pw || out_wfc_r)
6464 {
65- pw_wfc_g .resize (nspin, nbands, kv.ngk [0 ]);
65+ psi_g .resize (nspin, nbands, kv.ngk [0 ]);
6666 }
6767
6868 const double mem_size = sizeof (double ) * double (gg.gridt ->lgd ) * double (nbands) * double (nspin) / 1024.0 / 1024.0 ;
@@ -191,13 +191,13 @@ void IState_Envelope::begin(const psi::Psi<double>* psid,
191191 const double ef_tmp = this ->pes_ ->eferm .get_efval (is);
192192
193193 // only for gamma_only now
194- pw_wfc_g .fix_k (is);
195- this ->set_pw_wfc (wfcpw, is, ib, nspin, pes_->charge ->rho , pw_wfc_g );
194+ psi_g .fix_k (is);
195+ this ->set_pw_wfc (wfcpw, is, ib, nspin, pes_->charge ->rho , psi_g );
196196
197197 // Calculate real-space wave functions
198- pw_wfc_g .fix_k (is);
198+ psi_g .fix_k (is);
199199 std::vector<std::complex <double >> wfc_r (wfcpw->nrxx );
200- wfcpw->recip2real (&pw_wfc_g (ib, 0 ), wfc_r.data (), is);
200+ wfcpw->recip2real (&psi_g (ib, 0 ), wfc_r.data (), is);
201201
202202 // Extract real and imaginary parts
203203 std::vector<double > wfc_real (wfcpw->nrxx );
@@ -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 (), pw_wfc_g , kv, wfcpw);
262+ ModuleIO::write_wfc_pw (ssw.str (), psi_g , kv, wfcpw);
263263 }
264264
265265 if (out_wfc_r)
266266 {
267- ModuleIO::write_psi_r_1 (pw_wfc_g , wfcpw, " wfc_realspace" , false , kv);
267+ ModuleIO::write_psi_r_1 (psi_g , wfcpw, " wfc_realspace" , false , kv);
268268 }
269269
270270 for (int is = 0 ; is < nspin; ++is)
@@ -327,10 +327,10 @@ void IState_Envelope::begin(const psi::Psi<std::complex<double>>* psi,
327327 printf (" Estimated on-the-fly memory consuming by IState_Envelope::begin::wfc_k_grid: %f MB\n " , mem_size);
328328
329329 // for pw_wfc in G space
330- psi::Psi<std::complex <double >> pw_wfc_g (kv.ngk .data ());
330+ psi::Psi<std::complex <double >> psi_g (kv.ngk .data ());
331331 if (out_wf || out_wf_r)
332332 {
333- pw_wfc_g .resize (nks, nbands, wfcpw->npwk_max );
333+ psi_g .resize (nks, nbands, wfcpw->npwk_max );
334334 }
335335
336336 int mode_norm = 0 ;
@@ -402,8 +402,8 @@ void IState_Envelope::begin(const psi::Psi<std::complex<double>>* psi,
402402
403403 if (out_wf || out_wf_r)
404404 {
405- pw_wfc_g .fix_k (ik);
406- this ->set_pw_wfc (wfcpw, ik, ib, nspin, pes_->charge ->rho , pw_wfc_g );
405+ psi_g .fix_k (ik);
406+ this ->set_pw_wfc (wfcpw, 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 (), pw_wfc_g , kv, wfcpw);
420+ ModuleIO::write_wfc_pw (ssw.str (), psi_g , kv, wfcpw);
421421 }
422422 if (out_wf_r)
423423 {
424- ModuleIO::write_psi_r_1 (pw_wfc_g , wfcpw, " wfc_realspace" , false , kv);
424+ ModuleIO::write_psi_r_1 (psi_g , wfcpw, " wfc_realspace" , false , kv);
425425 }
426426
427427 std::cout << " Outputting real-space wave functions in cube format..." << std::endl;
@@ -437,11 +437,11 @@ void IState_Envelope::begin(const psi::Psi<std::complex<double>>* psi,
437437 std::cout << " Processing band " << ib + 1 << " , k-point " << ik << " , spin " << ispin + 1
438438 << std::endl;
439439
440- pw_wfc_g .fix_k (ik);
440+ psi_g .fix_k (ik);
441441
442442 // Calculate real-space wave functions
443443 std::vector<std::complex <double >> wfc_r (wfcpw->nrxx );
444- wfcpw->recip2real (&pw_wfc_g (ib, 0 ), wfc_r.data (), ik);
444+ wfcpw->recip2real (&psi_g (ib, 0 ), wfc_r.data (), ik);
445445
446446 // Extract real and imaginary parts
447447 std::vector<double > wfc_real (wfcpw->nrxx );
@@ -572,11 +572,7 @@ void IState_Envelope::select_bands(const int nbands_istate,
572572 // Fill bands_picked_ with values from out_wfc_kb
573573 // Remaining bands are already set to 0
574574 const int length = std::min (static_cast <int >(out_wfc_kb.size ()), nbands);
575- for (int i = 0 ; i < length; ++i)
576- {
577- // out_wfc_kb rely on function parse_expression
578- bands_picked_[i] = out_wfc_kb[i];
579- }
575+ std::copy (out_wfc_kb.begin (), out_wfc_kb.begin () + length, bands_picked_.begin ());
580576
581577 // Check if there are selected bands below the Fermi surface
582578 bool has_below = false ;
0 commit comments