Skip to content

Commit 2861312

Browse files
authored
Fix: skip mix_dmr after the last iteration (#6331)
* don't mix_dmr in the last step * fix test reference values
1 parent 71a7b2d commit 2861312

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

source/source_esolver/esolver_ks_lcao.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -821,11 +821,14 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(UnitCell& ucell, const int istep, int&
821821
ESolver_KS<TK>::iter_finish(ucell, istep, iter, conv_esolver);
822822

823823
// 5) mix density matrix if mixing_restart + mixing_dmr + not first
824-
// mixing_restart at every iter
825-
if (PARAM.inp.mixing_restart > 0 && this->p_chgmix->mixing_restart_count > 0 && PARAM.inp.mixing_dmr)
824+
// mixing_restart at every iter except the last iter
825+
if(iter != PARAM.inp.scf_nmax && !conv_esolver)
826826
{
827-
elecstate::DensityMatrix<TK, double>* dm = dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM();
828-
this->p_chgmix->mix_dmr(dm);
827+
if (PARAM.inp.mixing_restart > 0 && this->p_chgmix->mixing_restart_count > 0 && PARAM.inp.mixing_dmr)
828+
{
829+
elecstate::DensityMatrix<TK, double>* dm = dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM();
830+
this->p_chgmix->mix_dmr(dm);
831+
}
829832
}
830833

831834
// 6) save charge density
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
etotref -3376.2723454300949015
22
etotperatomref -1688.1361727150
33
totalforceref 36.032716
4-
totalstressref 12211.003288
4+
totalstressref 12211.003182
55
totaltimeref 2.21
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
etotref -7661.7030524582096405
22
etotperatomref -1915.4257631146
3-
totalforceref 24.669066
4-
totalstressref 7358.093426
3+
totalforceref 24.663512
4+
totalstressref 7359.638478
55
totaltimeref 27.05
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
etotref -5909.5419790928954171
22
etotperatomref -1969.8473263643
3-
totalforceref 955.111693
4-
totalstressref 46844.269362
3+
totalforceref 955.111630
4+
totalstressref 46844.260877
55
totaltimeref 1.25
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
etotref -6789.2817503491569369
22
etotperatomref -3394.6408751746
3-
totalforceref 11.329526
4-
totalstressref 4894.902744
3+
totalforceref 11.335196
4+
totalstressref 4892.274915
55
totaltimeref 4.70

0 commit comments

Comments
 (0)