77
88#include " src_io/read_txt_tools.h"
99#include " module_base/global_variable.h"
10+ #include " module_base/tool_title.h"
1011
1112#ifdef USE_CEREAL_SERIALIZATION
1213#include " src_lcao/serialization_cereal.h"
@@ -16,26 +17,36 @@ namespace Read_Txt_Input
1617{
1718 void Input_Process::read_and_convert (const std::string &file_name)
1819 {
20+ ModuleBase::TITLE (" Input_Process" ," read_and_convert" );
1921 if (GlobalV::MY_RANK==0 )
2022 {
2123 this ->read (file_name);
2224 this ->check_transform ();
2325 this ->default_2 ();
24- this ->out (GlobalV::global_out_dir + file_name);
26+ // Peize Lin delete 2022.01.06 temporarily
27+ // this->out(GlobalV::global_out_dir + file_name);
2528 }
2629 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));
2732 this ->convert ();
2833 }
2934
3035 void Input_Process::read (const std::string &file_name)
3136 {
37+ ModuleBase::TITLE (" Input_Process" ," read" );
3238 const std::map<std::string, std::vector<std::string>> inputs_read
3339 = Read_Txt_Tools::read_file_to_map (file_name, {" #" ," \\ " }, true );
3440 for (const auto & input_read : inputs_read)
3541 {
3642 const auto item_ptr = this ->input .list .find (input_read.first );
3743 if (item_ptr==this ->input .list .end ())
38- throw std::out_of_range (" input_read.first" );
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+ }
3950 Read_Txt_Input::Input_Item &item = item_ptr->second ;
4051
4152 item.values_size_read = input_read.second .size ();
@@ -52,6 +63,7 @@ namespace Read_Txt_Input
5263
5364 void Input_Process::check_transform ()
5465 {
66+ ModuleBase::TITLE (" Input_Process" ," check_transform" );
5567 for (auto &tmp : this ->input .list )
5668 {
5769 Read_Txt_Input::Input_Item &item = tmp.second ;
@@ -81,13 +93,15 @@ namespace Read_Txt_Input
8193
8294 void Input_Process::default_2 ()
8395 {
96+ ModuleBase::TITLE (" Input_Process" ," default_2" );
8497 for (auto &item : this ->input .list )
8598 item.second .default_2 (item.second , this ->input .list );
8699 this ->default_2_global (this ->input .list );
87100 }
88101
89102 void Input_Process::out (const std::string &file_name) const
90103 {
104+ ModuleBase::TITLE (" Input_Process" ," out" );
91105 std::ofstream ofs (file_name);
92106 for (const std::string &label : this ->input .output_labels )
93107 {
@@ -105,9 +119,9 @@ namespace Read_Txt_Input
105119 if (item.values_type [i]==" s" )
106120 ofs<<item.values [i].gets ()<<" " ;
107121 else if (item.values_type [i]==" d" )
108- ofs<<std::to_string ( item.values [i].getd () )<<" " ;
122+ ofs<<item.values [i].getd ()<<" " ;
109123 else if (item.values_type [i]==" i" )
110- ofs<<std::to_string ( item.values [i].geti () )<<" " ;
124+ ofs<<item.values [i].geti ()<<" " ;
111125 else if (item.values_type [i]==" b" )
112126 {
113127 if (item.values [i].getb ())
@@ -125,15 +139,18 @@ namespace Read_Txt_Input
125139
126140 void Input_Process::bcast ()
127141 {
142+ ModuleBase::TITLE (" Input_Process" ," bcast" );
128143#ifdef USE_CEREAL_SERIALIZATION
129- ModuleBase::bcast_data_cereal (this ->input .list , MPI_COMM_WORLD, 0 );
144+ for (auto &item : this ->input .list )
145+ ModuleBase::bcast_data_cereal (item.second , MPI_COMM_WORLD, 0 );
130146#else
131147#error Input_Process::bcast() needs cereal
132148#endif
133149 }
134150
135151 void Input_Process::convert ()
136152 {
153+ ModuleBase::TITLE (" Input_Process" ," convert" );
137154 for (auto &item : this ->input .list )
138155 item.second .convert (item.second );
139156 this ->convert_global (this ->input .list );
0 commit comments