@@ -647,15 +647,14 @@ void ESolver_KS_PW<T, Device>::iter_finish(UnitCell& ucell, const int istep, int
647647 // ----------------------------------------------------------
648648 // 3) Print out electronic wavefunctions in pw basis
649649 // ----------------------------------------------------------
650- if (PARAM.inp .out_wfc_pw == 1 || PARAM.inp .out_wfc_pw == 2 )
651- {
652- if (iter % PARAM.inp .out_freq_elec == 0 || iter == PARAM.inp .scf_nmax || conv_esolver)
653- {
654- std::stringstream ssw;
655- ssw << PARAM.globalv .global_out_dir << " WAVEFUNC" ;
656- ModuleIO::write_wfc_pw (ssw.str (), this ->psi [0 ], this ->kv , this ->pw_wfc );
657- }
658- }
650+ if (iter % PARAM.inp .out_freq_elec == 0 || iter == PARAM.inp .scf_nmax || conv_esolver)
651+ {
652+ ModuleIO::write_wfc_pw (GlobalV::KPAR, GlobalV::MY_POOL, GlobalV::MY_RANK,
653+ PARAM.inp .nbands , PARAM.inp .nspin , PARAM.globalv .npol ,
654+ GlobalV::RANK_IN_POOL, GlobalV::NPROC_IN_POOL,
655+ PARAM.inp .out_wfc_pw , PARAM.inp .ecutwfc , PARAM.globalv .global_out_dir ,
656+ this ->psi [0 ], this ->kv , this ->pw_wfc , GlobalV::ofs_running);
657+ }
659658
660659 // ----------------------------------------------------------
661660 // 4) check if oscillate for delta_spin method
@@ -709,17 +708,7 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep, const
709708 }
710709
711710 // ------------------------------------------------------------------
712- // 4) output wavefunctions in pw basis
713- // ------------------------------------------------------------------
714- if (PARAM.inp .out_wfc_pw == 1 || PARAM.inp .out_wfc_pw == 2 )
715- {
716- std::stringstream ssw;
717- ssw << PARAM.globalv .global_out_dir << " WAVEFUNC" ;
718- ModuleIO::write_wfc_pw (ssw.str (), this ->psi [0 ], this ->kv , this ->pw_wfc );
719- }
720-
721- // ------------------------------------------------------------------
722- // 5) calculate band-decomposed (partial) charge density in pw basis
711+ // 4) calculate band-decomposed (partial) charge density in pw basis
723712 // ------------------------------------------------------------------
724713 const std::vector<int > out_pchg = PARAM.inp .out_pchg ;
725714 if (out_pchg.size () > 0 )
@@ -747,8 +736,16 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep, const
747736 PARAM.inp .if_separate_k );
748737 }
749738
739+
740+ // tmp 2025-05-17, mohan note
741+ ModuleIO::write_wfc_pw (GlobalV::KPAR, GlobalV::MY_POOL, GlobalV::MY_RANK,
742+ PARAM.inp .nbands , PARAM.inp .nspin , PARAM.globalv .npol ,
743+ GlobalV::RANK_IN_POOL, GlobalV::NPROC_IN_POOL,
744+ PARAM.inp .out_wfc_pw , PARAM.inp .ecutwfc , PARAM.globalv .global_out_dir ,
745+ this ->psi [0 ], this ->kv , this ->pw_wfc , GlobalV::ofs_running);
746+
750747 // ------------------------------------------------------------------
751- // ! 6 ) calculate Wannier functions in pw basis
748+ // ! 5 ) calculate Wannier functions in pw basis
752749 // ------------------------------------------------------------------
753750 if (PARAM.inp .calculation == " nscf" && PARAM.inp .towannier90 )
754751 {
@@ -766,7 +763,7 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep, const
766763 }
767764
768765 // ------------------------------------------------------------------
769- // ! 7 ) calculate Berry phase polarization in pw basis
766+ // ! 6 ) calculate Berry phase polarization in pw basis
770767 // ------------------------------------------------------------------
771768 if (PARAM.inp .calculation == " nscf" && berryphase::berry_phase_flag && ModuleSymmetry::Symmetry::symm_flag != 1 )
772769 {
@@ -777,7 +774,7 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep, const
777774 }
778775
779776 // ------------------------------------------------------------------
780- // 8 ) write spin constrian results in pw basis
777+ // 7 ) write spin constrian results in pw basis
781778 // spin constrain calculations, write atomic magnetization and magnetic force.
782779 // ------------------------------------------------------------------
783780 if (PARAM.inp .sc_mag_switch )
@@ -789,7 +786,7 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep, const
789786 }
790787
791788 // ------------------------------------------------------------------
792- // 9 ) write onsite occupations for charge and magnetizations
789+ // 8 ) write onsite occupations for charge and magnetizations
793790 // ------------------------------------------------------------------
794791 if (PARAM.inp .onsite_radius > 0 )
795792 { // float type has not been implemented
0 commit comments