@@ -645,15 +645,14 @@ void ESolver_KS_PW<T, Device>::iter_finish(UnitCell& ucell, const int istep, int
645645 // ----------------------------------------------------------
646646 // 3) Print out electronic wavefunctions in pw basis
647647 // ----------------------------------------------------------
648- if (PARAM.inp .out_wfc_pw == 1 || PARAM.inp .out_wfc_pw == 2 )
649- {
650- if (iter % PARAM.inp .out_freq_elec == 0 || iter == PARAM.inp .scf_nmax || conv_esolver)
651- {
652- std::stringstream ssw;
653- ssw << PARAM.globalv .global_out_dir << " WAVEFUNC" ;
654- ModuleIO::write_wfc_pw (ssw.str (), this ->psi [0 ], this ->kv , this ->pw_wfc );
655- }
656- }
648+ if (iter % PARAM.inp .out_freq_elec == 0 || iter == PARAM.inp .scf_nmax || conv_esolver)
649+ {
650+ ModuleIO::write_wfc_pw (GlobalV::KPAR, GlobalV::MY_POOL, GlobalV::MY_RANK,
651+ PARAM.inp .nbands , PARAM.inp .nspin , PARAM.globalv .npol ,
652+ GlobalV::RANK_IN_POOL, GlobalV::NPROC_IN_POOL,
653+ PARAM.inp .out_wfc_pw , PARAM.inp .ecutwfc , PARAM.globalv .global_out_dir ,
654+ this ->psi [0 ], this ->kv , this ->pw_wfc , GlobalV::ofs_running);
655+ }
657656
658657 // ----------------------------------------------------------
659658 // 4) check if oscillate for delta_spin method
@@ -707,17 +706,7 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep, const
707706 }
708707
709708 // ------------------------------------------------------------------
710- // 4) output wavefunctions in pw basis
711- // ------------------------------------------------------------------
712- if (PARAM.inp .out_wfc_pw == 1 || PARAM.inp .out_wfc_pw == 2 )
713- {
714- std::stringstream ssw;
715- ssw << PARAM.globalv .global_out_dir << " WAVEFUNC" ;
716- ModuleIO::write_wfc_pw (ssw.str (), this ->psi [0 ], this ->kv , this ->pw_wfc );
717- }
718-
719- // ------------------------------------------------------------------
720- // 5) calculate band-decomposed (partial) charge density in pw basis
709+ // 4) calculate band-decomposed (partial) charge density in pw basis
721710 // ------------------------------------------------------------------
722711 const std::vector<int > out_pchg = PARAM.inp .out_pchg ;
723712 if (out_pchg.size () > 0 )
@@ -745,8 +734,16 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep, const
745734 PARAM.inp .if_separate_k );
746735 }
747736
737+
738+ // tmp 2025-05-17, mohan note
739+ ModuleIO::write_wfc_pw (GlobalV::KPAR, GlobalV::MY_POOL, GlobalV::MY_RANK,
740+ PARAM.inp .nbands , PARAM.inp .nspin , PARAM.globalv .npol ,
741+ GlobalV::RANK_IN_POOL, GlobalV::NPROC_IN_POOL,
742+ PARAM.inp .out_wfc_pw , PARAM.inp .ecutwfc , PARAM.globalv .global_out_dir ,
743+ this ->psi [0 ], this ->kv , this ->pw_wfc , GlobalV::ofs_running);
744+
748745 // ------------------------------------------------------------------
749- // ! 6 ) calculate Wannier functions in pw basis
746+ // ! 5 ) calculate Wannier functions in pw basis
750747 // ------------------------------------------------------------------
751748 if (PARAM.inp .calculation == " nscf" && PARAM.inp .towannier90 )
752749 {
@@ -764,7 +761,7 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep, const
764761 }
765762
766763 // ------------------------------------------------------------------
767- // ! 7 ) calculate Berry phase polarization in pw basis
764+ // ! 6 ) calculate Berry phase polarization in pw basis
768765 // ------------------------------------------------------------------
769766 if (PARAM.inp .calculation == " nscf" && berryphase::berry_phase_flag && ModuleSymmetry::Symmetry::symm_flag != 1 )
770767 {
@@ -775,7 +772,7 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep, const
775772 }
776773
777774 // ------------------------------------------------------------------
778- // 8 ) write spin constrian results in pw basis
775+ // 7 ) write spin constrian results in pw basis
779776 // spin constrain calculations, write atomic magnetization and magnetic force.
780777 // ------------------------------------------------------------------
781778 if (PARAM.inp .sc_mag_switch )
@@ -787,7 +784,7 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep, const
787784 }
788785
789786 // ------------------------------------------------------------------
790- // 9 ) write onsite occupations for charge and magnetizations
787+ // 8 ) write onsite occupations for charge and magnetizations
791788 // ------------------------------------------------------------------
792789 if (PARAM.inp .onsite_radius > 0 )
793790 { // float type has not been implemented
0 commit comments