Skip to content

Commit 9d40ac6

Browse files
SCF converges if both drho and dene is smaller than threshold
1 parent 1b3f76e commit 9d40ac6

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ Note: In new angle mixing, you should set `mixing_beta_mag >> mixing_beta`. The
11871187

11881188
- **Type**: Real
11891189
- **Description**: It's the energy threshold for electronic iteration. It represents the total energy error between two sequential densities from electronic iterations.
1190-
- **Default**: -1.0. If the user does not set this parameter, it will not take effect.
1190+
- **Default**: 1.0. If the user does not set this parameter, it will not take effect.
11911191
- **Unit**: eV
11921192

11931193
### scf_thr_type

source/module_esolver/esolver_ks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ 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->conv_esolver == 1) // only check when density is converged
677677
{
678678
this->conv_esolver
679679
= (iter != 1 && std::abs(this->pelec->f_en.etot_delta * ModuleBase::Ry_to_eV) < this->scf_ene_thr);

source/module_io/test/read_input_ptest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ TEST_F(InputParaTest, ParaRead)
164164
EXPECT_EQ(PARAM.inp.test_force, 0);
165165
EXPECT_EQ(param.inp.test_stress, 0);
166166
EXPECT_NEAR(param.inp.scf_thr, 1.0e-8, 1.0e-15);
167-
EXPECT_NEAR(param.inp.scf_ene_thr, -1.0, 1.0e-15);
167+
EXPECT_NEAR(param.inp.scf_ene_thr, 1.0, 1.0e-15);
168168
EXPECT_EQ(param.inp.scf_nmax, 50);
169169
EXPECT_EQ(param.inp.relax_nmax, 1);
170170
EXPECT_EQ(param.inp.out_stru, 0);

source/module_parameter/input_parameter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ struct Input_para
112112
bool gamma_only = false; ///< for plane wave.
113113
int scf_nmax = 100; ///< number of max elec iter
114114
double scf_thr = -1.0; ///< \sum |rhog_out - rhog_in |^2
115-
double scf_ene_thr = -1.0; ///< energy threshold for scf convergence, in eV
115+
double scf_ene_thr = 1.0; ///< energy threshold for scf convergence, in eV
116116
int scf_thr_type = -1; ///< type of the criterion of scf_thr, 1: reci drho, 2: real drho
117117
bool final_scf = false; ///< whether to do final scf
118118

0 commit comments

Comments
 (0)