Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions source/src_lcao/ELEC_scf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; is<GlobalV::NSPIN; is++)
{
const int precision = 3;
Expand Down
15 changes: 11 additions & 4 deletions source/src_lcao/dftu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ void DFTU::init(
}
}

if(GlobalV::CALCULATION=="nscf")
if(GlobalV::CALCULATION=="nscf" || GlobalC::pot.start_pot == "file")
{
std::stringstream sst;
sst << GlobalV::global_out_dir << "onsite.dm";
Expand Down Expand Up @@ -987,7 +987,7 @@ void DFTU::cal_energy_correction(const int istep)
{
ModuleBase::TITLE("DFTU", "cal_energy_correction");
ModuleBase::timer::tick("DFTU", "cal_energy_correction");
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_energy_correction");
return;
Expand Down Expand Up @@ -1152,7 +1152,7 @@ void DFTU::cal_eff_pot_mat_complex(const int ik, const int istep, std::complex<d
{
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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down