Skip to content

Commit 6bfe505

Browse files
authored
Merge pull request #114 from Qx80610702/develop
DFTU restart
2 parents c4e0387 + 5ee7c0d commit 6bfe505

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

source/src_lcao/ELEC_scf.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -489,17 +489,6 @@ void ELEC_scf::scf(const int &istep)
489489
GlobalC::chi0_hilbert.Chi();
490490
}
491491

492-
//quxin add for DFT+U for nscf calculation
493-
if(INPUT.dft_plus_u)
494-
{
495-
if(GlobalC::CHR.out_charge)
496-
{
497-
std::stringstream sst;
498-
sst << GlobalV::global_out_dir << "onsite.dm";
499-
GlobalC::dftu.write_occup_m( sst.str() );
500-
}
501-
}
502-
503492
for(int is=0; is<GlobalV::NSPIN; is++)
504493
{
505494
const int precision = 3;

source/src_lcao/dftu.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ void DFTU::init(
253253
}
254254
}
255255

256-
if(GlobalV::CALCULATION=="nscf")
256+
if(GlobalV::CALCULATION=="nscf" || GlobalC::pot.start_pot == "file")
257257
{
258258
std::stringstream sst;
259259
sst << GlobalV::global_out_dir << "onsite.dm";
@@ -987,7 +987,7 @@ void DFTU::cal_energy_correction(const int istep)
987987
{
988988
ModuleBase::TITLE("DFTU", "cal_energy_correction");
989989
ModuleBase::timer::tick("DFTU", "cal_energy_correction");
990-
if((GlobalV::CALCULATION=="scf" || GlobalV::CALCULATION=="relax" || GlobalV::CALCULATION=="cell-relax") && (!omc) && istep==0 && this->iter_dftu==1)
990+
if((GlobalV::CALCULATION=="scf" || GlobalV::CALCULATION=="relax" || GlobalV::CALCULATION=="cell-relax") && (!omc) && istep==0 && this->iter_dftu==1 && GlobalC::pot.start_pot != "file")
991991
{
992992
ModuleBase::timer::tick("DFTU", "cal_energy_correction");
993993
return;
@@ -1152,7 +1152,7 @@ void DFTU::cal_eff_pot_mat_complex(const int ik, const int istep, std::complex<d
11521152
{
11531153
ModuleBase::TITLE("DFTU", "cal_eff_pot_mat");
11541154
ModuleBase::timer::tick("DFTU", "cal_eff_pot_mat");
1155-
if((GlobalV::CALCULATION=="scf" || GlobalV::CALCULATION=="relax" || GlobalV::CALCULATION=="cell-relax") && (!omc) && istep==0 && this->iter_dftu==1)
1155+
if((GlobalV::CALCULATION=="scf" || GlobalV::CALCULATION=="relax" || GlobalV::CALCULATION=="cell-relax") && (!omc) && istep==0 && this->iter_dftu==1 && GlobalC::pot.start_pot != "file")
11561156
{
11571157
ModuleBase::timer::tick("DFTU", "cal_eff_pot_mat");
11581158
return;
@@ -1239,7 +1239,7 @@ void DFTU::cal_eff_pot_mat_real(const int ik, const int istep, double* eff_pot)
12391239
{
12401240
ModuleBase::TITLE("DFTU", "cal_eff_pot_mat");
12411241
ModuleBase::timer::tick("DFTU", "cal_eff_pot_mat");
1242-
if((GlobalV::CALCULATION=="scf" || GlobalV::CALCULATION=="relax" || GlobalV::CALCULATION=="cell-relax") && (!omc) && istep==0 && this->iter_dftu==1)
1242+
if((GlobalV::CALCULATION=="scf" || GlobalV::CALCULATION=="relax" || GlobalV::CALCULATION=="cell-relax") && (!omc) && istep==0 && this->iter_dftu==1 && GlobalC::pot.start_pot != "file")
12431243
{
12441244
ModuleBase::timer::tick("DFTU", "cal_eff_pot_mat");
12451245
return;
@@ -1325,6 +1325,13 @@ void DFTU::cal_eff_pot_mat_real(const int ik, const int istep, double* eff_pot)
13251325
void DFTU::output()
13261326
{
13271327
ModuleBase::TITLE("DFTU", "output");
1328+
1329+
if(GlobalC::CHR.out_charge)
1330+
{
1331+
std::stringstream sst;
1332+
sst << GlobalV::global_out_dir << "onsite.dm";
1333+
this->write_occup_m( sst.str() );
1334+
}
13281335

13291336
GlobalV::ofs_running << "//=========================L(S)DA+U===========================//" << std::endl;
13301337

0 commit comments

Comments
 (0)