@@ -153,28 +153,18 @@ void ModuleBase::Global_File::make_dir_out(
153153#endif
154154 }
155155
156- std::stringstream ss,ss1;
157-
158- // mohan add 2010-09-12
159- if (out_alllog)
160- {
161- ss << " running_" << calculation << " _" << rank + 1 ;
162- open_log (GlobalV::ofs_running, ss.str (), calculation, restart);
163- #if defined(__CUDA) || defined(__ROCM)
164- open_log (GlobalV::ofs_device, " device" + std::to_string (rank), calculation, restart);
165- #endif
166- }
167- else
168- {
169- if (rank==0 )
170- {
171- ss << " running_" << calculation;
172- open_log (GlobalV::ofs_running, ss.str (), calculation, restart);
173- #if defined(__CUDA) || defined(__ROCM)
174- open_log (GlobalV::ofs_device, " device" , calculation, restart);
175- #endif
176- }
177- }
156+ auto open_running_log = [&](const std::string& keyword)
157+ {
158+ std::stringstream ss;
159+ ss << " running_" << keyword;
160+ if (out_alllog) ss << " _" << rank + 1 ;
161+ open_log (GlobalV::ofs_running, ss.str (), keyword, restart);
162+ #if defined(__CUDA) || defined(__ROCM)
163+ open_log (GlobalV::ofs_device, " device" + std::to_string (rank), calculation, restart);
164+ #endif
165+ };
166+ // if linear response solver only, open running_lr.log. else, open running_calculation.log
167+ if (out_alllog || rank == 0 ) { open_running_log (PARAM.inp .esolver_type == " lr" ? " lr" : calculation); }
178168
179169 if (rank==0 )
180170 {
0 commit comments