diff --git a/source/module_esolver/esolver_ks_pw.cpp b/source/module_esolver/esolver_ks_pw.cpp index db5c5b613a..16a2e5a0f1 100644 --- a/source/module_esolver/esolver_ks_pw.cpp +++ b/source/module_esolver/esolver_ks_pw.cpp @@ -565,20 +565,8 @@ void ESolver_KS_PW::after_scf(UnitCell& ucell, const int istep, const //------------------------------------------------------------------ ESolver_KS::after_scf(ucell, istep, conv_esolver); - - //------------------------------------------------------------------ - // 3) output wavefunctions in pw basis - //------------------------------------------------------------------ - if (PARAM.inp.out_wfc_pw == 1 || PARAM.inp.out_wfc_pw == 2) - { - std::stringstream ssw; - ssw << PARAM.globalv.global_out_dir << "WAVEFUNC"; - ModuleIO::write_wfc_pw(ssw.str(), this->psi[0], this->kv, this->pw_wfc); - } - //------------------------------------------------------------------ - // 4) transfer data from GPU to CPU in pw basis - // a question: the wavefunctions have been output, then the data transfer occurs? mohan 20250302 + // 3) transfer data from GPU to CPU in pw basis //------------------------------------------------------------------ if (this->device == base_device::GpuDevice) { @@ -586,6 +574,16 @@ void ESolver_KS_PW::after_scf(UnitCell& ucell, const int istep, const this->kspw_psi[0].get_pointer() - this->kspw_psi[0].get_psi_bias(), this->psi[0].size()); } + + //------------------------------------------------------------------ + // 4) output wavefunctions in pw basis + //------------------------------------------------------------------ + if (PARAM.inp.out_wfc_pw == 1 || PARAM.inp.out_wfc_pw == 2) + { + std::stringstream ssw; + ssw << PARAM.globalv.global_out_dir << "WAVEFUNC"; + ModuleIO::write_wfc_pw(ssw.str(), this->psi[0], this->kv, this->pw_wfc); + } //------------------------------------------------------------------ // 5) calculate band-decomposed (partial) charge density in pw basis