Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 5 additions & 2 deletions source/module_io/read_input_item_relax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@ void ReadInput::item_relax()
= {"scf", "nscf", "get_S", "get_pchg", "get_wf", "test_memory", "test_neighbour", "gen_bessel"};
if (std::find(singlelist.begin(), singlelist.end(), calculation) != singlelist.end())
{
para.input.relax_nmax = 1;
if (para.input.relax_nmax != 0)
{
para.input.relax_nmax = 1;
}
}
else if (calculation == "relax" || calculation == "cell-relax")
{
if (para.input.relax_nmax == 0) // default value
if (para.input.relax_nmax < 0)
{
para.input.relax_nmax = 50;
}
Expand Down
8 changes: 8 additions & 0 deletions source/module_io/test_serial/read_input_item_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,17 @@ TEST_F(InputTest, Item_test)
it->second.reset_value(it->second, param);
EXPECT_EQ(param.input.relax_nmax, 1);

param.input.relax_nmax = 0;
it->second.reset_value(it->second, param);
EXPECT_EQ(param.input.relax_nmax, 0);

param.input.calculation = "relax";
param.input.relax_nmax = 0;
it->second.reset_value(it->second, param);
EXPECT_EQ(param.input.relax_nmax, 0);

param.input.relax_nmax = -1;
it->second.reset_value(it->second, param);
EXPECT_EQ(param.input.relax_nmax, 50);
}
{ // out_stru
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 @@ -152,7 +152,7 @@ struct Input_para
bool relax_new = true;
bool relax = false; ///< allow relaxation along the specific direction
double relax_scale_force = 0.5;
int relax_nmax = 0; ///< number of max ionic iter
int relax_nmax = -1; ///< number of max ionic iter
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)
Expand Down
Loading