Skip to content

Commit 3100997

Browse files
committed
update dm vector
1 parent e3bff8f commit 3100997

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

source/source_esolver/esolver_ks_lcao.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,9 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(UnitCell& ucell, const int istep, int&
680680
{
681681
ModuleBase::TITLE("ESolver_KS_LCAO", "iter_finish");
682682

683+
const std::vector<std::vector<TK>>& dm_vec
684+
= dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM()->get_DMK_vector();
685+
683686
// 1) calculate the local occupation number matrix and energy correction in DFT+U
684687
if (PARAM.inp.dft_plus_u)
685688
{
@@ -689,11 +692,9 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(UnitCell& ucell, const int istep, int&
689692
{
690693
if (GlobalC::dftu.omc != 2)
691694
{
692-
const std::vector<std::vector<TK>>& tmp_dm
693-
= dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM()->get_DMK_vector();
694695
ModuleDFTU::dftu_cal_occup_m(iter,
695696
ucell,
696-
tmp_dm,
697+
dm_vec,
697698
this->kv,
698699
this->p_chgmix->get_mixing_beta(),
699700
this->p_hamilt);
@@ -707,11 +708,8 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(UnitCell& ucell, const int istep, int&
707708
#ifdef __MLALGO
708709
if (PARAM.inp.deepks_scf)
709710
{
710-
const std::vector<std::vector<TK>>& dm
711-
= dynamic_cast<const elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM()->get_DMK_vector();
712-
713-
ld.dpks_cal_e_delta_band(dm, this->kv.get_nks());
714-
DeePKS_domain::update_dmr(this->kv.kvec_d, dm, ucell, orb_, this->pv, this->gd, ld.dm_r);
711+
ld.dpks_cal_e_delta_band(dm_vec, this->kv.get_nks());
712+
DeePKS_domain::update_dmr(this->kv.kvec_d, dm_vec, ucell, orb_, this->pv, this->gd, ld.dm_r);
715713
this->pelec->f_en.edeepks_scf = ld.E_delta - ld.e_delta_band;
716714
this->pelec->f_en.edeepks_delta = ld.E_delta;
717715
}

0 commit comments

Comments
 (0)