From 5ee7c0d070242e1b32df1fcb10f0a1fb959402ed Mon Sep 17 00:00:00 2001 From: Qx80610702 <80610702@qq.com> Date: Sat, 2 Apr 2022 11:19:42 +0800 Subject: [PATCH] DFTU restart --- source/src_lcao/ELEC_scf.cpp | 11 ----------- source/src_lcao/dftu.cpp | 15 +++++++++++---- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/source/src_lcao/ELEC_scf.cpp b/source/src_lcao/ELEC_scf.cpp index 47844de6b9..fa1d7be261 100644 --- a/source/src_lcao/ELEC_scf.cpp +++ b/source/src_lcao/ELEC_scf.cpp @@ -489,17 +489,6 @@ void ELEC_scf::scf(const int &istep) GlobalC::chi0_hilbert.Chi(); } - //quxin add for DFT+U for nscf calculation - if(INPUT.dft_plus_u) - { - if(GlobalC::CHR.out_charge) - { - std::stringstream sst; - sst << GlobalV::global_out_dir << "onsite.dm"; - GlobalC::dftu.write_occup_m( sst.str() ); - } - } - for(int is=0; isiter_dftu==1) + if((GlobalV::CALCULATION=="scf" || GlobalV::CALCULATION=="relax" || GlobalV::CALCULATION=="cell-relax") && (!omc) && istep==0 && this->iter_dftu==1 && GlobalC::pot.start_pot != "file") { ModuleBase::timer::tick("DFTU", "cal_energy_correction"); return; @@ -1152,7 +1152,7 @@ void DFTU::cal_eff_pot_mat_complex(const int ik, const int istep, std::complexiter_dftu==1) + if((GlobalV::CALCULATION=="scf" || GlobalV::CALCULATION=="relax" || GlobalV::CALCULATION=="cell-relax") && (!omc) && istep==0 && this->iter_dftu==1 && GlobalC::pot.start_pot != "file") { ModuleBase::timer::tick("DFTU", "cal_eff_pot_mat"); return; @@ -1239,7 +1239,7 @@ void DFTU::cal_eff_pot_mat_real(const int ik, const int istep, double* eff_pot) { ModuleBase::TITLE("DFTU", "cal_eff_pot_mat"); ModuleBase::timer::tick("DFTU", "cal_eff_pot_mat"); - if((GlobalV::CALCULATION=="scf" || GlobalV::CALCULATION=="relax" || GlobalV::CALCULATION=="cell-relax") && (!omc) && istep==0 && this->iter_dftu==1) + if((GlobalV::CALCULATION=="scf" || GlobalV::CALCULATION=="relax" || GlobalV::CALCULATION=="cell-relax") && (!omc) && istep==0 && this->iter_dftu==1 && GlobalC::pot.start_pot != "file") { ModuleBase::timer::tick("DFTU", "cal_eff_pot_mat"); return; @@ -1325,6 +1325,13 @@ void DFTU::cal_eff_pot_mat_real(const int ik, const int istep, double* eff_pot) void DFTU::output() { ModuleBase::TITLE("DFTU", "output"); + + if(GlobalC::CHR.out_charge) + { + std::stringstream sst; + sst << GlobalV::global_out_dir << "onsite.dm"; + this->write_occup_m( sst.str() ); + } GlobalV::ofs_running << "//=========================L(S)DA+U===========================//" << std::endl;