Skip to content

Refactor: change the name of keyword force_thr_ev2 to force_zero_out for clarity #6313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 19, 2025
Merged
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
6 changes: 3 additions & 3 deletions docs/advanced/input_files/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
- [cal\_force](#cal_force)
- [force\_thr](#force_thr)
- [force\_thr\_ev](#force_thr_ev)
- [force\_thr\_ev2](#force_thr_ev2)
- [force\_zero\_out](#force_zero_out)
- [relax\_bfgs\_w1](#relax_bfgs_w1)
- [relax\_bfgs\_w2](#relax_bfgs_w2)
- [relax\_bfgs\_rmax](#relax_bfgs_rmax)
Expand Down Expand Up @@ -1507,10 +1507,10 @@ These variables are used to control the geometry relaxation.
- **Default**: 0.0257112
- **Unit**: eV/Angstrom (0.03889 Ry/Bohr)

### force_thr_ev2
### force_zero_out

- **Type**: Real
- **Description**: The calculated force will be set to 0 when it is smaller than the parameter `force_thr_ev2`.
- **Description**: The force whose value is smaller than `force_zero_out` will be treated as zero.
- **Default**: 0.0
- **Unit**: eV/Angstrom

Expand Down
4 changes: 2 additions & 2 deletions source/module_io/input_conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ void Input_Conv::Convert()


#ifdef __LCAO
Force_Stress_LCAO<double>::force_invalid_threshold_ev = PARAM.inp.force_thr_ev2;
Force_Stress_LCAO<std::complex<double>>::force_invalid_threshold_ev = PARAM.inp.force_thr_ev2;
Force_Stress_LCAO<double>::force_invalid_threshold_ev = PARAM.inp.force_zero_out;
Force_Stress_LCAO<std::complex<double>>::force_invalid_threshold_ev = PARAM.inp.force_zero_out;
#endif

BFGS_Basic::relax_bfgs_w1 = PARAM.inp.relax_bfgs_w1;
Expand Down
4 changes: 2 additions & 2 deletions source/module_io/read_input_item_relax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ void ReadInput::item_relax()
this->add_item(item);
}
{
Input_Item item("force_thr_ev2");
Input_Item item("force_zero_out");
item.annotation = "force invalid threshold, unit: eV/Angstrom";
read_sync_double(input.force_thr_ev2);
read_sync_double(input.force_zero_out);
this->add_item(item);
}
{
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 @@ -107,7 +107,7 @@ TEST_F(InputParaTest, ParaRead)
EXPECT_TRUE(param.inp.symmetry_autoclose);
EXPECT_EQ(param.inp.cal_force, 0);
EXPECT_NEAR(param.inp.force_thr, 1.0e-3, 1.0e-7);
EXPECT_DOUBLE_EQ(param.inp.force_thr_ev2, 0);
EXPECT_DOUBLE_EQ(param.inp.force_zero_out, 0);
EXPECT_DOUBLE_EQ(param.inp.stress_thr, 1.0e-2);
EXPECT_DOUBLE_EQ(param.inp.press1, 0.0);
EXPECT_DOUBLE_EQ(param.inp.press2, 0.0);
Expand Down
2 changes: 1 addition & 1 deletion source/module_io/test/support/INPUT
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ relax_nmax 1 #number of ion iteration steps
out_stru 0 #output the structure files after each ion step
force_thr 0.001 #force threshold, unit: Ry/Bohr
force_thr_ev 0.0257112 #force threshold, unit: eV/Angstrom
force_thr_ev2 0 #force invalid threshold, unit: eV/Angstrom
force_zero_out 0 #force invalid threshold, unit: eV/Angstrom
relax_cg_thr 0.5 #threshold for switching from cg to bfgs, unit: eV/Angstrom
stress_thr 0.01 #stress threshold
press1 0 #target pressure, unit: KBar
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 @@ -157,7 +157,7 @@ struct Input_para
double relax_cg_thr = 0.5; ///< threshold when cg to bfgs, pengfei add 2011-08-15
double force_thr = -1; ///< threshold of force in unit (Ry/Bohr)
double force_thr_ev = -1; ///< threshold of force in unit (eV/Angstrom)
double force_thr_ev2 = 0; ///< invalid force threshold, mohan add 2011-04-17
double force_zero_out = 0; ///< invalid force threshold, mohan add 2011-04-17
double stress_thr = 0.5; ///< Pengfei Li 2017-11-01 ///<LiuXh update 20180515
double press1 = 0;
double press2 = 0;
Expand Down
Loading