Skip to content

Commit 6409c3a

Browse files
committed
Fix deepmodeling#5969: First copy then output in the right order in ks_pw
1 parent f1508aa commit 6409c3a

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

source/module_esolver/esolver_ks_pw.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -565,27 +565,25 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep, const
565565
//------------------------------------------------------------------
566566
ESolver_KS<T, Device>::after_scf(ucell, istep, conv_esolver);
567567

568-
569-
//------------------------------------------------------------------
570-
// 3) output wavefunctions in pw basis
571-
//------------------------------------------------------------------
572-
if (PARAM.inp.out_wfc_pw == 1 || PARAM.inp.out_wfc_pw == 2)
573-
{
574-
std::stringstream ssw;
575-
ssw << PARAM.globalv.global_out_dir << "WAVEFUNC";
576-
ModuleIO::write_wfc_pw(ssw.str(), this->psi[0], this->kv, this->pw_wfc);
577-
}
578-
579568
//------------------------------------------------------------------
580-
// 4) transfer data from GPU to CPU in pw basis
581-
// a question: the wavefunctions have been output, then the data transfer occurs? mohan 20250302
569+
// 3) transfer data from GPU to CPU in pw basis
582570
//------------------------------------------------------------------
583571
if (this->device == base_device::GpuDevice)
584572
{
585573
castmem_2d_d2h_op()(this->psi[0].get_pointer() - this->psi[0].get_psi_bias(),
586574
this->kspw_psi[0].get_pointer() - this->kspw_psi[0].get_psi_bias(),
587575
this->psi[0].size());
588576
}
577+
578+
//------------------------------------------------------------------
579+
// 4) output wavefunctions in pw basis
580+
//------------------------------------------------------------------
581+
if (PARAM.inp.out_wfc_pw == 1 || PARAM.inp.out_wfc_pw == 2)
582+
{
583+
std::stringstream ssw;
584+
ssw << PARAM.globalv.global_out_dir << "WAVEFUNC";
585+
ModuleIO::write_wfc_pw(ssw.str(), this->psi[0], this->kv, this->pw_wfc);
586+
}
589587

590588
//------------------------------------------------------------------
591589
// 5) calculate band-decomposed (partial) charge density in pw basis

0 commit comments

Comments
 (0)