Skip to content

Commit 22b85f9

Browse files
Feature: change the default value of printe from 100 to scf_nmax (#5462)
* change printe's default value from 100 to scf_nmax * delete useless test * correct the docs
1 parent 7c46674 commit 22b85f9

File tree

4 files changed

+9
-36
lines changed

4 files changed

+9
-36
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ Note: In new angle mixing, you should set `mixing_beta_mag >> mixing_beta`. The
11761176

11771177
- **Type**: Integer
11781178
- **Description**: Print out energy for each band for every printe step
1179-
- **Default**: 100
1179+
- **Default**: `scf_nmax`
11801180

11811181
### scf_nmax
11821182

source/module_elecstate/test/elecstate_print_test.cpp

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -390,37 +390,4 @@ TEST_F(ElecStatePrintTest, PrintEtotColorS4)
390390
PARAM.input.noncolin = true;
391391
GlobalV::MY_RANK = 0;
392392
elecstate.print_etot(converged, iter, scf_thr, scf_thr_kin, duration, printe, pw_diag_thr, avg_iter, print);
393-
}
394-
395-
// TEST_F(ElecStatePrintTest, PrintEtotWarning)
396-
// {
397-
// GlobalV::ofs_running.open("test.dat", std::ios::out);
398-
// bool converged = false;
399-
// int iter = 1;
400-
// double scf_thr = 0.1;
401-
// double scf_thr_kin = 0.0;
402-
// double duration = 2.0;
403-
// int printe = 0;
404-
// double pw_diag_thr = 0.1;
405-
// int avg_iter = 2;
406-
// bool print = true;
407-
// elecstate.charge = new Charge;
408-
// elecstate.charge->nrxx = 100;
409-
// elecstate.charge->nxyz = 1000;
410-
// PARAM.input.imp_sol = true;
411-
// PARAM.input.efield_flag = true;
412-
// PARAM.input.gate_flag = true;
413-
// PARAM.sys.two_fermi = false;
414-
// PARAM.input.out_bandgap = true;
415-
// GlobalV::MY_RANK = 0;
416-
// PARAM.input.basis_type = "pw";
417-
// PARAM.input.scf_nmax = 100;
418-
// elecstate::tmp_ks_solver = "unknown";
419-
// testing::internal::CaptureStdout();
420-
// EXPECT_EXIT(elecstate.print_etot(converged, iter, scf_thr, scf_thr_kin, duration, printe, pw_diag_thr, avg_iter, print), ::testing::ExitedWithCode(0), "");
421-
// output = testing::internal::GetCapturedStdout();
422-
// EXPECT_THAT(output, testing::HasSubstr("print_etot found unknown ks_solver_type"));
423-
// GlobalV::ofs_running.close();
424-
// delete elecstate.charge;
425-
// std::remove("test.dat");
426-
// }
393+
}

source/module_io/read_input_item_output.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ void ReadInput::item_output()
8383
{
8484
Input_Item item("printe");
8585
item.annotation = "Print out energy for each band for every printe steps";
86+
item.reset_value = [](const Input_Item& item, Parameter& para) {
87+
if (para.input.printe <= 0) // default is scf_nmax
88+
{
89+
para.input.printe = para.input.scf_nmax;
90+
}
91+
};
8692
read_sync_int(input.printe);
8793
this->add_item(item);
8894
}

source/module_parameter/input_parameter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ struct Input_para
320320
int out_pot = 0; ///< yes or no
321321
int out_wfc_pw = 0; ///< 0: no; 1: txt; 2: dat
322322
bool out_wfc_r = false; ///< 0: no; 1: yes
323-
int printe = 100; ///< mohan add 2011-03-16
323+
int printe = 0; ///< Print out energy for each band for every printe step, default is scf_nmax
324324
std::vector<int> out_band = {0, 8}; ///< band calculation pengfei 2014-10-13
325325
int out_dos = 0; ///< dos calculation. mohan add 20090909
326326
bool out_mul = false; ///< qifeng add 2019-9-10

0 commit comments

Comments
 (0)