Skip to content

Commit db9c16c

Browse files
authored
Move DeePKS printing message from screen to log file. (#6281)
1 parent 20142c8 commit db9c16c

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

source/module_hamilt_lcao/module_deepks/LCAO_deepks_interface.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ void LCAO_Deepks_Interface<TK, TR>::out_deepks_labels(const double& etot,
2828
const psi::Psi<TK>& psi,
2929
const elecstate::DensityMatrix<TK, double>* dm,
3030
hamilt::HamiltLCAO<TK, TR>* p_ham,
31-
const int rank)
31+
const int rank,
32+
std::ostream& ofs_running)
3233
{
3334
ModuleBase::TITLE("LCAO_Deepks_Interface", "out_deepks_labels");
3435
ModuleBase::timer::tick("LCAO_Deepks_Interface", "out_deepks_labels");
@@ -535,10 +536,16 @@ void LCAO_Deepks_Interface<TK, TR>::out_deepks_labels(const double& etot,
535536
if (PARAM.inp.deepks_scf)
536537
{
537538
DeePKS_domain::cal_e_delta_band(dm->get_DMK_vector(), *h_delta, nks, nspin, ParaV, e_delta_band);
538-
std::cout << "E_delta_band = " << std::setprecision(8) << e_delta_band << " Ry"
539-
<< " = " << std::setprecision(8) << e_delta_band * ModuleBase::Ry_to_eV << " eV" << std::endl;
540-
std::cout << "E_delta_NN = " << std::setprecision(8) << E_delta << " Ry"
541-
<< " = " << std::setprecision(8) << E_delta * ModuleBase::Ry_to_eV << " eV" << std::endl;
539+
if (rank == 0)
540+
{
541+
ofs_running << " DeePKS Energy Correction" << std::endl;
542+
ofs_running << " -----------------------------------------------" << std::endl;
543+
ofs_running << " E_delta_band = " << std::setprecision(8) << e_delta_band << " Ry"
544+
<< " = " << std::setprecision(8) << e_delta_band * ModuleBase::Ry_to_eV << " eV" << std::endl;
545+
ofs_running << " E_delta_NN = " << std::setprecision(8) << E_delta << " Ry"
546+
<< " = " << std::setprecision(8) << E_delta * ModuleBase::Ry_to_eV << " eV" << std::endl;
547+
ofs_running << " -----------------------------------------------" << std::endl;
548+
}
542549
if (PARAM.inp.deepks_out_unittest)
543550
{
544551
LCAO_deepks_io::print_dm(nks, PARAM.globalv.nlocal, ParaV->nrow, dm->get_DMK_vector());

source/module_hamilt_lcao/module_deepks/LCAO_deepks_interface.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ class LCAO_Deepks_Interface
4444
const psi::Psi<TK>& psid,
4545
const elecstate::DensityMatrix<TK, double>* dm,
4646
hamilt::HamiltLCAO<TK, TR>* p_ham,
47-
const int rank);
47+
const int rank,
48+
std::ostream& ofs_running);
4849

4950
private:
5051
std::shared_ptr<LCAO_Deepks<TK>> ld;

source/module_io/ctrl_output_lcao.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ void ctrl_output_lcao(UnitCell& ucell,
173173
*psi,
174174
pelec->get_DM(),
175175
p_ham_deepks,
176-
GlobalV::MY_RANK);
176+
GlobalV::MY_RANK,
177+
GlobalV::ofs_running);
177178
#endif
178179

179180
//------------------------------------------------------------------

0 commit comments

Comments
 (0)