|
| 1 | +#include "read_input.h" |
| 2 | +#include "read_input_tool.h" |
1 | 3 | #include "source_base/global_variable.h"
|
2 | 4 | #include "source_base/tool_quit.h"
|
3 | 5 | #include "source_io/module_parameter/parameter.h"
|
4 |
| -#include "read_input.h" |
5 |
| -#include "read_input_tool.h" |
6 | 6 | namespace ModuleIO
|
7 | 7 | {
|
8 | 8 | /// @note Here para.inp has been synchronized of all ranks.
|
@@ -101,7 +101,7 @@ void ReadInput::set_global_dir(const Input_para& inp, System_para& sys)
|
101 | 101 | sys.global_mlkedf_descriptor_dir = sys.global_out_dir + "MLKEDF_Descriptors/";
|
102 | 102 | sys.global_mlkedf_descriptor_dir = to_dir(sys.global_mlkedf_descriptor_dir);
|
103 | 103 |
|
104 |
| - /// get the global directory for DeePKS labels during electronic steps |
| 104 | + /// get the global directory for DeePKS labels during electronic steps |
105 | 105 | sys.global_deepks_label_elec_dir = sys.global_out_dir + "DeePKS_Labels_Elec/";
|
106 | 106 | sys.global_deepks_label_elec_dir = to_dir(sys.global_deepks_label_elec_dir);
|
107 | 107 |
|
@@ -130,17 +130,22 @@ void ReadInput::set_global_dir(const Input_para& inp, System_para& sys)
|
130 | 130 |
|
131 | 131 | // set the global log file
|
132 | 132 | bool out_alllog = inp.out_alllog;
|
| 133 | + // set the global calculation type |
| 134 | + std::string cal_type = inp.calculation; |
133 | 135 | #ifdef __MPI
|
134 | 136 | // because log_file is different for each rank, so we need to bcast the out_alllog
|
135 | 137 | Parallel_Common::bcast_bool(out_alllog);
|
| 138 | + // In `ReadInput::read_parameters`, `bcastfunc(param)` is after `set_global_dir`, |
| 139 | + // so `cal_type` must be synchronized here manually |
| 140 | + Parallel_Common::bcast_string(cal_type); |
136 | 141 | #endif
|
137 | 142 | if (out_alllog)
|
138 | 143 | {
|
139 |
| - PARAM.sys.log_file = "running_" + PARAM.inp.calculation + "_" + std::to_string(PARAM.sys.myrank + 1) + ".log"; |
| 144 | + PARAM.sys.log_file = "running_" + cal_type + "_" + std::to_string(PARAM.sys.myrank + 1) + ".log"; |
140 | 145 | }
|
141 | 146 | else
|
142 | 147 | {
|
143 |
| - PARAM.sys.log_file = "running_" + PARAM.inp.calculation + ".log"; |
| 148 | + PARAM.sys.log_file = "running_" + cal_type + ".log"; |
144 | 149 | }
|
145 | 150 | #ifdef __MPI
|
146 | 151 | Parallel_Common::bcast_string(sys.global_in_card);
|
|
0 commit comments