Skip to content

Commit f381836

Browse files
mohanchenkirk0830
andauthored
Update esolver_ks_pw.cpp (#5498)
Co-authored-by: kirk0830 <[email protected]>
1 parent 6bff8e3 commit f381836

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

source/module_esolver/esolver_ks_pw.cpp

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -422,19 +422,21 @@ void ESolver_KS_PW<T, Device>::update_pot(const int istep, const int iter)
422422
template <typename T, typename Device>
423423
void 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");
@@ -638,6 +642,7 @@ void ESolver_KS_PW<T, Device>::cal_stress(ModuleBase::matrix& stress)
638642
template <typename T, typename Device>
639643
void ESolver_KS_PW<T, Device>::after_all_runners()
640644
{
645+
//! 1) Output information to screen
641646
GlobalV::ofs_running << "\n\n --------------------------------------------" << std::endl;
642647
GlobalV::ofs_running << std::setprecision(16);
643648
GlobalV::ofs_running << " !FINAL_ETOT_IS " << this->pelec->f_en.etot * ModuleBase::Ry_to_eV << " eV" << std::endl;
@@ -681,10 +686,11 @@ void ESolver_KS_PW<T, Device>::after_all_runners()
681686
{
682687
nspin0 = 2;
683688
}
684-
//! print occupation in istate.info
689+
690+
//! 2) Print occupation numbers into istate.info
685691
ModuleIO::write_istate_info(this->pelec->ekb, this->pelec->wg, this->kv, &(GlobalC::Pkpoints));
686692

687-
//! compute density of states
693+
//! 3) Compute density of states (DOS)
688694
if (PARAM.inp.out_dos)
689695
{
690696
ModuleIO::write_dos_pw(this->pelec->ekb,
@@ -707,7 +713,8 @@ void ESolver_KS_PW<T, Device>::after_all_runners()
707713
}
708714
}
709715

710-
if (PARAM.inp.out_band[0]) // pengfei 2014-10-13
716+
//! 4) Print out band structure information
717+
if (PARAM.inp.out_band[0])
711718
{
712719
for (int is = 0; is < nspin0; is++)
713720
{
@@ -725,12 +732,10 @@ void ESolver_KS_PW<T, Device>::after_all_runners()
725732
}
726733
}
727734

728-
if (PARAM.inp.basis_type == "pw" && winput::out_spillage) // xiaohui add 2013-09-01
735+
//! 5) Calculate the spillage value, used to generate numerical atomic orbitals
736+
if (PARAM.inp.basis_type == "pw" && winput::out_spillage)
729737
{
730-
// calculate spillage value.
731-
732-
// ! Print out overlap before spillage optimization to generate atomic
733-
// orbitals
738+
// ! Print out overlap matrices
734739
if (winput::out_spillage <= 2)
735740
{
736741
for (int i = 0; i < PARAM.inp.bessel_nao_rcuts.size(); i++)
@@ -747,13 +752,13 @@ void ESolver_KS_PW<T, Device>::after_all_runners()
747752
}
748753
}
749754

750-
//! Print out wave functions in real space
755+
//! 6) Print out electronic wave functions in real space
751756
if (this->wf.out_wfc_r == 1) // Peize Lin add 2021.11.21
752757
{
753758
ModuleIO::write_psi_r_1(this->psi[0], this->pw_wfc, "wfc_realspace", true, this->kv);
754759
}
755760

756-
//! Use Kubo-Greenwood method to compute conductivities
761+
//! 7) Use Kubo-Greenwood method to compute conductivities
757762
if (PARAM.inp.cal_cond)
758763
{
759764
EleCond elec_cond(&GlobalC::ucell, &this->kv, this->pelec, this->pw_wfc, this->psi, &GlobalC::ppcell);

0 commit comments

Comments
 (0)