66#include " write_wfc_realspace.h"
77#include " src_pw/global.h"
88#include " module_base/tool_title.h"
9+ #include " module_base/timer.h"
910#include < fstream>
1011#include < stdexcept>
1112#include < cstdlib>
@@ -18,6 +19,7 @@ namespace Write_Wfc_Realspace
1819 void write_wfc_realspace_1 (const ModuleBase::ComplexMatrix*const wfc_g, const std::string &folder_name)
1920 {
2021 ModuleBase::TITLE (" Write_Wfc_Realspace" , " write_wfc_realspace_1" );
22+ ModuleBase::timer::tick (" Write_Wfc_Realspace" , " write_wfc_realspace_1" );
2123
2224 const string outdir = GlobalV::global_out_dir + folder_name + " /" ;
2325 const std::string command0 = " test -d " + outdir + " || mkdir " + outdir;
@@ -54,6 +56,7 @@ namespace Write_Wfc_Realspace
5456#ifdef __MPI
5557 MPI_Waitall ( mpi_requests.size (), mpi_requests.data (), MPI_STATUSES_IGNORE );
5658#endif
59+ ModuleBase::timer::tick (" Write_Wfc_Realspace" , " write_wfc_realspace_1" );
5760 }
5861 // processes output pipeline:
5962 //
@@ -71,13 +74,15 @@ namespace Write_Wfc_Realspace
7174 // Output: wfc_r[ir]
7275 std::vector<std::complex <double >> cal_wfc_r (const ModuleBase::ComplexMatrix &wfc_g, const int ik, const int ib)
7376 {
77+ ModuleBase::timer::tick (" Write_Wfc_Realspace" , " cal_wfc_r" );
7478 ModuleBase::GlobalFunc::ZEROS (GlobalC::UFFT.porter , GlobalC::pw.nrxx );
7579 std::vector<std::complex <double >> wfc_r (GlobalC::pw.nrxx );
7680 for (int ig=0 ; ig<GlobalC::kv.ngk [ik]; ++ig)
7781 GlobalC::UFFT.porter [ GlobalC::pw.ig2fftw [GlobalC::wf.igk (ik,ig)] ] = wfc_g (ib,ig);
7882 GlobalC::pw.FFT_wfc .FFT3D (GlobalC::UFFT.porter ,1 );
7983 for (int ir=0 ; ir<GlobalC::pw.nrxx ; ++ir)
8084 wfc_r[ir] = GlobalC::UFFT.porter [ir];
85+ ModuleBase::timer::tick (" Write_Wfc_Realspace" , " cal_wfc_r" );
8186 return wfc_r;
8287 }
8388
@@ -90,6 +95,7 @@ namespace Write_Wfc_Realspace
9095 void write_charge_realspace_1 (const std::vector<double > &chg_r, const std::string &file_name)
9196#endif
9297 {
98+ ModuleBase::timer::tick (" Write_Wfc_Realspace" , " write_charge_realspace_1" );
9399 std::ofstream ofs;
94100
95101#ifdef __MPI
@@ -140,7 +146,7 @@ namespace Write_Wfc_Realspace
140146 const int ir = (ix*GlobalC::pw.ncy +iy)*GlobalC::pw.nczp +iz;
141147 ofs<<chg_r[ir]<<" " ;
142148 }
143- ofs<<std::endl ;
149+ ofs<<" \n " ;
144150 }
145151 }
146152 ofs.close ();
@@ -156,5 +162,6 @@ namespace Write_Wfc_Realspace
156162 mpi_request = MPI_REQUEST_NULL;
157163 }
158164#endif
165+ ModuleBase::timer::tick (" Write_Wfc_Realspace" , " write_charge_realspace_1" );
159166 }
160167};
0 commit comments