@@ -422,19 +422,21 @@ void ESolver_KS_PW<T, Device>::update_pot(const int istep, const int iter)
422422template <typename T, typename Device>
423423void ESolver_KS_PW<T, Device>::iter_finish(const int istep, int & iter)
424424{
425- // call iter_finish() of ESolver_KS
425+ // 1) Call iter_finish() of ESolver_KS
426426 ESolver_KS<T, Device>::iter_finish (istep, iter);
427427
428- // liuyu 2023-10-24
428+ // 2) Update USPP-related quantities
429429 // D in uspp need vloc, thus needs update when veff updated
430430 // calculate the effective coefficient matrix for non-local pseudopotential
431- // projectors
431+ // projectors
432+ // liuyu 2023-10-24
432433 if (PARAM.globalv .use_uspp )
433434 {
434435 ModuleBase::matrix veff = this ->pelec ->pot ->get_effective_v ();
435436 GlobalC::ppcell.cal_effective_D (veff, this ->pw_rhod , GlobalC::ucell);
436437 }
437438
439+ // 3) Print out charge density
438440 if (this ->out_freq_elec && iter % this ->out_freq_elec == 0 )
439441 {
440442 if (PARAM.inp .out_chg [0 ] > 0 )
@@ -475,7 +477,8 @@ void ESolver_KS_PW<T, Device>::iter_finish(const int istep, int& iter)
475477 }
476478 }
477479 }
478- // output wavefunctions
480+
481+ // 4) Print out electronic wavefunctions
479482 if (this ->wf .out_wfc_pw == 1 || this ->wf .out_wfc_pw == 2 )
480483 {
481484 std::stringstream ssw;
@@ -509,6 +512,7 @@ void ESolver_KS_PW<T, Device>::after_scf(const int istep)
509512 ModuleIO::write_wfc_pw (ssw.str (), this ->psi [0 ], this ->kv , this ->pw_wfc );
510513 }
511514
515+ // 4) Transfer data from GPU to CPU
512516 if (this ->device == base_device::GpuDevice)
513517 {
514518 castmem_2d_d2h_op ()(this ->psi [0 ].get_device (),
@@ -518,7 +522,7 @@ void ESolver_KS_PW<T, Device>::after_scf(const int istep)
518522 this ->psi [0 ].size ());
519523 }
520524
521- // Calculate band-decomposed (partial) charge density
525+ // 5) Calculate band-decomposed (partial) charge density
522526 const std::vector<int > bands_to_print = PARAM.inp .bands_to_print ;
523527 if (bands_to_print.size () > 0 )
524528 {
@@ -545,7 +549,7 @@ void ESolver_KS_PW<T, Device>::after_scf(const int istep)
545549 PARAM.inp .if_separate_k );
546550 }
547551
548- // ! 6) calculate Wannier functions
552+ // ! 6) Calculate Wannier functions
549553 if (PARAM.inp .calculation == " nscf" && PARAM.inp .towannier90 )
550554 {
551555 std::cout << FmtCore::format (" \n * * * * * *\n << Start %s.\n " , " Wannier functions calculation" );
@@ -639,6 +643,7 @@ void ESolver_KS_PW<T, Device>::cal_stress(ModuleBase::matrix& stress)
639643template <typename T, typename Device>
640644void ESolver_KS_PW<T, Device>::after_all_runners()
641645{
646+ // ! 1) Output information to screen
642647 GlobalV::ofs_running << " \n\n --------------------------------------------" << std::endl;
643648 GlobalV::ofs_running << std::setprecision (16 );
644649 GlobalV::ofs_running << " !FINAL_ETOT_IS " << this ->pelec ->f_en .etot * ModuleBase::Ry_to_eV << " eV" << std::endl;
@@ -682,10 +687,11 @@ void ESolver_KS_PW<T, Device>::after_all_runners()
682687 {
683688 nspin0 = 2 ;
684689 }
685- // ! print occupation in istate.info
690+
691+ // ! 2) Print occupation numbers into istate.info
686692 ModuleIO::write_istate_info (this ->pelec ->ekb , this ->pelec ->wg , this ->kv , &(GlobalC::Pkpoints));
687693
688- // ! compute density of states
694+ // ! 3) Compute density of states (DOS)
689695 if (PARAM.inp .out_dos )
690696 {
691697 ModuleIO::write_dos_pw (this ->pelec ->ekb ,
@@ -708,7 +714,8 @@ void ESolver_KS_PW<T, Device>::after_all_runners()
708714 }
709715 }
710716
711- if (PARAM.inp .out_band [0 ]) // pengfei 2014-10-13
717+ // ! 4) Print out band structure information
718+ if (PARAM.inp .out_band [0 ])
712719 {
713720 for (int is = 0 ; is < nspin0; is++)
714721 {
@@ -726,12 +733,10 @@ void ESolver_KS_PW<T, Device>::after_all_runners()
726733 }
727734 }
728735
729- if (PARAM.inp .basis_type == " pw" && winput::out_spillage) // xiaohui add 2013-09-01
736+ // ! 5) Calculate the spillage value, used to generate numerical atomic orbitals
737+ if (PARAM.inp .basis_type == " pw" && winput::out_spillage)
730738 {
731- // calculate spillage value.
732-
733- // ! Print out overlap before spillage optimization to generate atomic
734- // orbitals
739+ // ! Print out overlap matrices
735740 if (winput::out_spillage <= 2 )
736741 {
737742 for (int i = 0 ; i < PARAM.inp .bessel_nao_rcuts .size (); i++)
@@ -748,13 +753,13 @@ void ESolver_KS_PW<T, Device>::after_all_runners()
748753 }
749754 }
750755
751- // ! Print out wave functions in real space
756+ // ! 6) Print out electronic wave functions in real space
752757 if (this ->wf .out_wfc_r == 1 ) // Peize Lin add 2021.11.21
753758 {
754759 ModuleIO::write_psi_r_1 (this ->psi [0 ], this ->pw_wfc , " wfc_realspace" , true , this ->kv );
755760 }
756761
757- // ! Use Kubo-Greenwood method to compute conductivities
762+ // ! 7) Use Kubo-Greenwood method to compute conductivities
758763 if (PARAM.inp .cal_cond )
759764 {
760765 EleCond elec_cond (&GlobalC::ucell, &this ->kv , this ->pelec , this ->pw_wfc , this ->psi , &GlobalC::ppcell);
0 commit comments