77
88#include " src_io/read_txt_tools.h"
99#include " module_base/global_variable.h"
10- #include " module_base/tool_title.h"
1110
1211#ifdef USE_CEREAL_SERIALIZATION
1312#include " src_lcao/serialization_cereal.h"
@@ -17,36 +16,26 @@ namespace Read_Txt_Input
1716{
1817 void Input_Process::read_and_convert (const std::string &file_name)
1918 {
20- ModuleBase::TITLE (" Input_Process" ," read_and_convert" );
2119 if (GlobalV::MY_RANK==0 )
2220 {
2321 this ->read (file_name);
2422 this ->check_transform ();
2523 this ->default_2 ();
26- // Peize Lin delete 2022.01.06 temporarily
27- // this->out(GlobalV::global_out_dir + file_name);
24+ this ->out (GlobalV::global_out_dir + file_name);
2825 }
2926 this ->bcast ();
30- // Peize Lin add 2022.01.06 temporarily
31- this ->out (GlobalV::global_out_dir + file_name + " -new-" +std::to_string (GlobalV::MY_RANK));
3227 this ->convert ();
3328 }
3429
3530 void Input_Process::read (const std::string &file_name)
3631 {
37- ModuleBase::TITLE (" Input_Process" ," read" );
3832 const std::map<std::string, std::vector<std::string>> inputs_read
3933 = Read_Txt_Tools::read_file_to_map (file_name, {" #" ," \\ " }, true );
4034 for (const auto & input_read : inputs_read)
4135 {
4236 const auto item_ptr = this ->input .list .find (input_read.first );
4337 if (item_ptr==this ->input .list .end ())
44- {
45- // Peize Lin delete interrupt 2022.01.06 temporarily
46- // throw std::out_of_range("input_read.first");
47- GlobalV::ofs_warning<<" INPUT-new '" << input_read.first << " ' IS NOT USED!" << std::endl;
48- continue ;
49- }
38+ throw std::out_of_range (" input_read.first" );
5039 Read_Txt_Input::Input_Item &item = item_ptr->second ;
5140
5241 item.values_size_read = input_read.second .size ();
@@ -63,7 +52,6 @@ namespace Read_Txt_Input
6352
6453 void Input_Process::check_transform ()
6554 {
66- ModuleBase::TITLE (" Input_Process" ," check_transform" );
6755 for (auto &tmp : this ->input .list )
6856 {
6957 Read_Txt_Input::Input_Item &item = tmp.second ;
@@ -93,15 +81,13 @@ namespace Read_Txt_Input
9381
9482 void Input_Process::default_2 ()
9583 {
96- ModuleBase::TITLE (" Input_Process" ," default_2" );
9784 for (auto &item : this ->input .list )
9885 item.second .default_2 (item.second , this ->input .list );
9986 this ->default_2_global (this ->input .list );
10087 }
10188
10289 void Input_Process::out (const std::string &file_name) const
10390 {
104- ModuleBase::TITLE (" Input_Process" ," out" );
10591 std::ofstream ofs (file_name);
10692 for (const std::string &label : this ->input .output_labels )
10793 {
@@ -119,9 +105,9 @@ namespace Read_Txt_Input
119105 if (item.values_type [i]==" s" )
120106 ofs<<item.values [i].gets ()<<" " ;
121107 else if (item.values_type [i]==" d" )
122- ofs<<item.values [i].getd ()<<" " ;
108+ ofs<<std::to_string ( item.values [i].getd () )<<" " ;
123109 else if (item.values_type [i]==" i" )
124- ofs<<item.values [i].geti ()<<" " ;
110+ ofs<<std::to_string ( item.values [i].geti () )<<" " ;
125111 else if (item.values_type [i]==" b" )
126112 {
127113 if (item.values [i].getb ())
@@ -139,18 +125,15 @@ namespace Read_Txt_Input
139125
140126 void Input_Process::bcast ()
141127 {
142- ModuleBase::TITLE (" Input_Process" ," bcast" );
143128#ifdef USE_CEREAL_SERIALIZATION
144- for (auto &item : this ->input .list )
145- ModuleBase::bcast_data_cereal (item.second , MPI_COMM_WORLD, 0 );
129+ ModuleBase::bcast_data_cereal (this ->input .list , MPI_COMM_WORLD, 0 );
146130#else
147131#error Input_Process::bcast() needs cereal
148132#endif
149133 }
150134
151135 void Input_Process::convert ()
152136 {
153- ModuleBase::TITLE (" Input_Process" ," convert" );
154137 for (auto &item : this ->input .list )
155138 item.second .convert (item.second );
156139 this ->convert_global (this ->input .list );
0 commit comments