Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/advanced/input_files/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ Note: In new angle mixing, you should set `mixing_beta_mag >> mixing_beta`. The

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

### scf_thr_type
Expand Down
4 changes: 2 additions & 2 deletions source/module_esolver/esolver_ks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,10 +673,10 @@ void ESolver_KS<T, Device>::iter_finish(int& iter)
this->pelec->f_en.etot_old = this->pelec->f_en.etot;

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

Expand Down
1 change: 1 addition & 0 deletions source/module_esolver/esolver_ks_pw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ void ESolver_KS_PW<T, Device>::update_pot(const int istep, const int iter)
}
this->pelec->pot->update_from_charge(this->pelec->charge, &GlobalC::ucell);
this->pelec->f_en.descf = this->pelec->cal_delta_escf();
MPI_Bcast(&(this->pelec->f_en.descf), 1, MPI_DOUBLE, 0, PARAPW_WORLD);
}
else
{
Expand Down
1 change: 1 addition & 0 deletions source/module_esolver/esolver_sdft_pw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ void ESolver_SDFT_PW::hamilt2density(int istep, int iter, double ethr)
}
#endif
}
MPI_Bcast(&(this->pelec->f_en.deband), 1, MPI_DOUBLE, 0, PARAPW_WORLD);
}

double ESolver_SDFT_PW::cal_energy()
Expand Down
2 changes: 1 addition & 1 deletion source/module_io/test/read_input_ptest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ TEST_F(InputParaTest, ParaRead)
EXPECT_EQ(PARAM.inp.test_force, 0);
EXPECT_EQ(param.inp.test_stress, 0);
EXPECT_NEAR(param.inp.scf_thr, 1.0e-8, 1.0e-15);
EXPECT_NEAR(param.inp.scf_ene_thr, -1.0, 1.0e-15);
EXPECT_NEAR(param.inp.scf_ene_thr, 1.0, 1.0e-15);
EXPECT_EQ(param.inp.scf_nmax, 50);
EXPECT_EQ(param.inp.relax_nmax, 1);
EXPECT_EQ(param.inp.out_stru, 0);
Expand Down
2 changes: 1 addition & 1 deletion source/module_parameter/input_parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ struct Input_para
bool gamma_only = false; ///< for plane wave.
int scf_nmax = 100; ///< number of max elec iter
double scf_thr = -1.0; ///< \sum |rhog_out - rhog_in |^2
double scf_ene_thr = -1.0; ///< energy threshold for scf convergence, in eV
double scf_ene_thr = 1.0; ///< energy threshold for scf convergence, in eV
int scf_thr_type = -1; ///< type of the criterion of scf_thr, 1: reci drho, 2: real drho
bool final_scf = false; ///< whether to do final scf

Expand Down
Loading