37 throw std::runtime_error(
38 "Program is not compiled with with millepde2. Please enable \"WITH_MILLEPEDE=ON\" with CMake.");
42 auto exe_path = std::filesystem::path(exe_string);
43 if (not std::filesystem::exists(exe_path))
45 throw std::runtime_error(fmt::format(
"Command {:?} cannot be found or executed!", exe_string));
50 auto pede_program = bpv2::process{
51 ios_, exe_path, launch_args, bpv2::process_stdio{ .in =
nullptr, .out = stdout, .err = stderr }
53 pede_program.async_wait(
54 [](
const std::error_code& err,
int ret)
58 fmt::println(
"Error occured from the pede program. Error message: {}", err.message());
60 fmt::println(
"The pede program is closed successfully with the return value: {}", ret);
65 catch (std::exception& ex)
67 throw std::runtime_error(fmt::format(
"Error occured when launching pede with \"{} {}\": \n {}",
69 fmt::join(launch_args,
" "),
77 auto new_result_path = fs::current_path() / fs::path{
parameter_file_ };
79 if (fs::exists(old_result_path))
82 "Info: copy the file {:?} to the file {:?}!\n", old_result_path.string(), new_result_path.string());
83 fs::copy(old_result_path, new_result_path, fs::copy_options::overwrite_existing);
87 fmt::print(
"Error: millepede.res doesn't exist!\n");