Skip to content

Commit 5a5ff7f

Browse files
authored
Fix: add warning_quit if some parameter is repeated in INPUT (#4639)
* Fix: add warning_quit if some parameters ar iseated in INPUT * delete repeated parameters in INPUT * delete repeated INPUT
1 parent edc877f commit 5a5ff7f

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

source/module_io/read_input.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,13 @@ void ReadInput::read_txt_input(Parameter& param, const std::string& filename)
234234
{
235235
Input_Item* p_item = &(it->second);
236236
this->readvalue_items.push_back(p_item);
237+
if(p_item->is_read())
238+
{
239+
std::string warningstr = "The parameter " + p_item->label + " has been read twice.";
240+
ModuleBase::WARNING_QUIT("ReadInput", warningstr);
241+
}
237242
// qianrui delete '/' 2024-07-10, because path has '/' head.
238-
read_information(ifs, it->second.str_values, "#!");
243+
read_information(ifs, p_item->str_values, "#!");
239244
}
240245
else
241246
{

source/module_io/test/support/INPUT

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ nspin 1 #1: single spin; 2: up and down spin; 4: noncol
1818
kspacing 0 #unit in 1/bohr, should be > 0, default is 0 which means read KPT file
1919
min_dist_coef 0.2 #factor related to the allowed minimum distance between two atoms
2020
nbands 8 #number of bands
21-
nbands_sto 256 #number of stochastic bands
2221
nbands_istate 5 #number of bands around Fermi level for get_pchg calulation
2322
symmetry 1 #the control of symmetry
2423
init_vel False #read velocity from STRU or not

tests/integrate/108_PW_RE_PINT_RKS/INPUT

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ suffix autotest
55
relax_nmax 100
66
force_thr_ev 0.01
77
stress_thr 1
8-
out_stru 1
98
out_level ie
109
pseudo_rcut 10.0
1110
pseudo_mesh 1

tests/integrate/601_NO_TDDFT_vel_Si/INPUT

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@ scf_nmax 50
99
scf_thr 1e-6
1010

1111
ks_solver scalapack_gvx
12-
basis_type lcao
1312
gamma_only 0
14-
md_nstep 2
1513

1614
mixing_type broyden
1715
mixing_beta 0.7
1816
mixing_gg0 0.0
19-
scf_thr 1.0e-6
2017

2118
calculation md
2219
esolver_type tddft

0 commit comments

Comments
 (0)