@@ -390,38 +390,32 @@ void ESolver_OF::print_info(const bool conv_esolver)
390390{
391391 if (this ->iter_ == 0 )
392392 {
393- std::cout << " = ============================= Running OFDFT "
393+ std::cout << " ============================= Running OFDFT "
394394 " =============================="
395395 << std::endl;
396- std::cout << " Iter Etot(Ha) Mu(Ha) Theta "
397- " PotNorm deltaE(Ha)"
396+ std::cout << " ITER ETOT/eV EDIFF/eV EFERMI/eV POTNORM TIME/s"
398397 << std::endl;
399- // cout << "======================================== Running OFDFT
400- // ========================================" << endl; cout << "Iter
401- // Etot(Ha) Theta PotNorm min/max(den)
402- // min/max(dE/dPhi)" << endl;
403398 }
404- // ============ used to compare with PROFESS3.0 ================
405- // double minDen = this->chr.rho[0][0];
406- // double maxDen = this->chr.rho[0][0];
407- // double minPot = this->pdEdphi_[0][0];
408- // double maxPot = this->pdEdphi_[0][0];
409- // for (int i = 0; i < this->pw_rho->nrxx; ++i)
410- // {
411- // if (this->chr.rho[0][i] < minDen) minDen =
412- // this->chr.rho[0][i]; if (this->chr.rho[0][i] > maxDen)
413- // maxDen = this->chr.rho[0][i]; if (this->pdEdphi_[0][i] < minPot)
414- // minPot = this->pdEdphi_[0][i]; if (this->pdEdphi_[0][i] > maxPot)
415- // maxPot = this->pdEdphi_[0][i];
416- // }
417- std::cout << std::setw (6 ) << this ->iter_ << std::setw (22 ) << std::scientific << std::setprecision (12 )
418- << this ->energy_current_ / 2 . << std::setw (12 ) << std::setprecision (3 ) << this ->pelec ->eferm .get_efval (0 ) / 2 .
419- << std::setw (12 ) << this ->theta_ [0 ] << std::setw (12 ) << this ->normdLdphi_ << std::setw (12 )
420- << (this ->energy_current_ - this ->energy_last_ ) / 2 . << std::endl;
421- // ============ used to compare with PROFESS3.0 ================
422- // << setw(10) << minDen << "/ " << setw(12) << maxDen
423- // << setw(10) << minPot << "/ " << setw(10) << maxPot << endl;
424- // =============================================================
399+
400+ std::map<std::string, std::string> prefix_map = {
401+ {" cg1" , " CG" },
402+ {" cg2" , " CG" },
403+ {" tn" , " TN" }
404+ };
405+ std::string iteration = prefix_map[PARAM.inp .of_method ] + std::to_string (this ->iter_ );
406+ #ifdef __MPI
407+ double duration = (double )(MPI_Wtime () - this ->iter_time );
408+ #else
409+ double duration
410+ = (std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now () - this ->iter_time )).count ()
411+ / static_cast <double >(1e6 );
412+ #endif
413+ std::cout << " " << std::setw (8 ) << iteration
414+ << std::setw (18 ) << std::scientific << std::setprecision (8 ) << this ->energy_current_ * ModuleBase::Ry_to_eV
415+ << std::setw (18 ) << (this ->energy_current_ - this ->energy_last_ ) * ModuleBase::Ry_to_eV
416+ << std::setw (13 ) << std::setprecision (4 ) << this ->pelec ->eferm .get_efval (0 ) * ModuleBase::Ry_to_eV
417+ << std::setw (13 ) << std::setprecision (4 ) << this ->normdLdphi_
418+ << std::setw (6 ) << std::fixed << std::setprecision (2 ) << duration << std::endl;
425419
426420 GlobalV::ofs_running << std::setprecision (12 );
427421 GlobalV::ofs_running << std::setiosflags (std::ios::right);
@@ -533,5 +527,12 @@ void ESolver_OF::print_info(const bool conv_esolver)
533527 /* formats=*/ {" %20s" , " %20.12f" , " %20.12f" }, 0 );
534528 table << titles << energies_Ry << energies_eV;
535529 GlobalV::ofs_running << table.str () << std::endl;
530+
531+ // reset the iter_time for the next iteration
532+ #ifdef __MPI
533+ this ->iter_time = MPI_Wtime ();
534+ #else
535+ this ->iter_time = std::chrono::system_clock::now ();
536+ #endif
536537}
537538} // namespace ModuleESolver
0 commit comments