Skip to content

Commit 821b184

Browse files
Feature: make SCF converges only if drho and dene is smaller than threshold (#5357)
* SCF converges if both drho and dene is smaller than threshold * Update source/module_esolver/esolver_ks.cpp update corresponding comment Co-authored-by: dyzheng <[email protected]> --------- Co-authored-by: dyzheng <[email protected]>
1 parent f33650f commit 821b184

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

source/module_esolver/esolver_ks.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,10 +673,10 @@ void ESolver_KS<T, Device>::iter_finish(int& iter)
673673
this->pelec->f_en.etot_old = this->pelec->f_en.etot;
674674

675675
// add a energy threshold for SCF convergence
676-
if (this->conv_esolver == 0) // only check when density is not converged
676+
if (this->scf_ene_thr > 0.0 && this->conv_esolver == 1) // only check when density is converged
677677
{
678678
this->conv_esolver
679-
= (iter != 1 && std::abs(this->pelec->f_en.etot_delta * ModuleBase::Ry_to_eV) < this->scf_ene_thr);
679+
= (std::abs(this->pelec->f_en.etot_delta * ModuleBase::Ry_to_eV) < this->scf_ene_thr);
680680
}
681681
}
682682

0 commit comments

Comments
 (0)