33 std::vector<std::string> returnFiles;
36 std::string reactantFilename(
"reactant.con");
37 std::string saddleFilename(
"saddle.con");
38 std::string productFilename(
"product.con");
40 auto reactant = std::make_unique<Matter>(
pot,
params);
41 auto saddle = std::make_unique<Matter>(
pot,
params);
42 auto product = std::make_unique<Matter>(
pot,
params);
48 throw std::runtime_error(
"failed to load prefactor geometries");
52 product.get(), pref1, pref2);
55 if (
params.prefactor_options.all_free_atoms) {
56 std::string matterFilename;
57 if (
params.prefactor_options.configuration ==
59 matterFilename = reactantFilename;
60 }
else if (
params.prefactor_options.configuration ==
62 matterFilename = saddleFilename;
63 }
else if (
params.prefactor_options.configuration ==
65 matterFilename = productFilename;
72 throw std::runtime_error(
"failed to load prefactor configuration");
81 "Failed to reload reactant/saddle/product for prefactor");
82 throw std::runtime_error(
"failed to load prefactor geometries");
88 assert(3 * atoms.rows() > 0);
90 if (
params.prefactor_options.configuration ==
93 freqs = hessian.
getFreqs(reactant.get(), atoms);
94 }
else if (
params.prefactor_options.configuration ==
97 freqs = hessian.
getFreqs(saddle.get(), atoms);
98 }
else if (
params.prefactor_options.configuration ==
101 freqs = hessian.
getFreqs(product.get(), atoms);
104 bool failed = freqs.size() != 3 * atoms.rows();
106 std::string results_file(
"results.dat");
107 std::string freq_file(
"freq.dat");
108 returnFiles.push_back(results_file);
109 returnFiles.push_back(freq_file);
111 std::ofstream outResults(results_file, std::ios::binary);
112 std::ofstream outFreq(freq_file, std::ios::binary);
115 outResults << std::format(
"{} termination_reason\n", failed ? 1 : 0);
116 outResults << std::format(
"{} termination_reason_text\n",
117 failed ?
"fail" :
"good");
118 outResults <<
"prefactor job_type\n";
119 outResults << std::format(
"{} good\n", failed ?
"false" :
"true");
120 outResults << std::format(
"{} force_calls\n",
122 outResults << std::format(
"{} total_force_calls\n",
126 if (outFreq && !failed) {
127 for (
int i = 0; i < freqs.size(); i++) {
129 outFreq << std::format(
"{:f}\n",
130 std::sqrt(freqs[i]) /
133 outFreq << std::format(
"{:f}\n",
134 -std::sqrt(-freqs[i]) /
140 if (std::filesystem::exists(
"freqs.dat")) {
141 returnFiles.push_back(
"freqs.dat");
143 if (std::filesystem::exists(
"hessian.dat")) {
144 returnFiles.push_back(
"hessian.dat");