From 7411b20941ce1de2485a5942af8d3beb6e22fd23 Mon Sep 17 00:00:00 2001 From: kirk0830 Date: Thu, 19 Jun 2025 14:19:44 +0800 Subject: [PATCH 1/3] Refactor: change the name of keyword `force_thr_ev2` to `force_zero_out` for clarity --- docs/advanced/input_files/input-main.md | 6 +++--- source/module_io/input_conv.cpp | 4 ++-- source/module_io/read_input_item_relax.cpp | 4 ++-- source/module_parameter/input_parameter.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/advanced/input_files/input-main.md b/docs/advanced/input_files/input-main.md index 9112ed18e5..f6434d0ada 100644 --- a/docs/advanced/input_files/input-main.md +++ b/docs/advanced/input_files/input-main.md @@ -116,7 +116,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) @@ -1485,10 +1485,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 diff --git a/source/module_io/input_conv.cpp b/source/module_io/input_conv.cpp index 00dc63e15a..3704e17ddf 100644 --- a/source/module_io/input_conv.cpp +++ b/source/module_io/input_conv.cpp @@ -177,8 +177,8 @@ void Input_Conv::Convert() #ifdef __LCAO - Force_Stress_LCAO::force_invalid_threshold_ev = PARAM.inp.force_thr_ev2; - Force_Stress_LCAO>::force_invalid_threshold_ev = PARAM.inp.force_thr_ev2; + Force_Stress_LCAO::force_invalid_threshold_ev = PARAM.inp.force_zero_out; + Force_Stress_LCAO>::force_invalid_threshold_ev = PARAM.inp.force_zero_out; #endif BFGS_Basic::relax_bfgs_w1 = PARAM.inp.relax_bfgs_w1; diff --git a/source/module_io/read_input_item_relax.cpp b/source/module_io/read_input_item_relax.cpp index 1d3e0c62a1..0b51a8520e 100644 --- a/source/module_io/read_input_item_relax.cpp +++ b/source/module_io/read_input_item_relax.cpp @@ -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); } { diff --git a/source/module_parameter/input_parameter.h b/source/module_parameter/input_parameter.h index 8b264dfc69..3649b0b6fe 100644 --- a/source/module_parameter/input_parameter.h +++ b/source/module_parameter/input_parameter.h @@ -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 /// Date: Thu, 19 Jun 2025 14:55:00 +0800 Subject: [PATCH 2/3] update the name of variable in unittest --- source/module_io/test/read_input_ptest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/module_io/test/read_input_ptest.cpp b/source/module_io/test/read_input_ptest.cpp index 2ec4bdce1d..058c895376 100644 --- a/source/module_io/test/read_input_ptest.cpp +++ b/source/module_io/test/read_input_ptest.cpp @@ -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); From 51de4e48d04cf9201c204a38faaac1d2129f166e Mon Sep 17 00:00:00 2001 From: kirk0830 Date: Thu, 19 Jun 2025 15:06:04 +0800 Subject: [PATCH 3/3] update testfile --- source/module_io/test/support/INPUT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/module_io/test/support/INPUT b/source/module_io/test/support/INPUT index b6d31ba51a..d366d5b0db 100644 --- a/source/module_io/test/support/INPUT +++ b/source/module_io/test/support/INPUT @@ -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