Virtual run; used solely for dynamic dispatch.
32 {
33 std::vector<std::string> returnFiles;
34 VectorXd freqs;
35
39
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);
43
48 throw std::runtime_error("failed to load prefactor geometries");
49 }
50 double pref1 = 0.0, pref2 = 0.0;
52 params, reactant.get(), saddle.get(), product.get(), pref1, pref2);
53
54 VectorXi atoms;
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;
66 }
71 matterFilename);
72 throw std::runtime_error("failed to load prefactor configuration");
73 }
74
76 } else {
81 "Failed to reload reactant/saddle/product for prefactor");
82 throw std::runtime_error("failed to load prefactor geometries");
83 }
84
86 product.get());
87 }
88 bool failed = (prefStatus == -1) || (atoms.rows() == 0);
89
90 if (!failed) {
91 if (
params.prefactor_options().configuration ==
94 freqs = hessian.getFreqs(reactant.get(), atoms);
95 }
else if (
params.prefactor_options().configuration ==
98 freqs = hessian.getFreqs(saddle.get(), atoms);
99 }
else if (
params.prefactor_options().configuration ==
102 freqs = hessian.getFreqs(product.get(), atoms);
103 }
104 }
105
106 if (!failed) {
107 failed = freqs.size() != 3 * atoms.rows();
108 }
109
110 std::string results_file("results.dat");
111 std::string freq_file("freq.dat");
112 returnFiles.push_back(results_file);
113 returnFiles.push_back(freq_file);
114
115 std::ofstream outFreq(freq_file, std::ios::binary);
116
119 params.potential_options().potential,
121 env.job_type = "prefactor";
122 env.tags.emplace_back("good", failed ? "false" : "true");
123 env.extras.emplace_back("force_calls", static_cast<double>(env.force_calls));
124 if (!failed) {
125 env.extras.emplace_back("prefactor_reactant_to_product", pref1);
126 env.extras.emplace_back("prefactor_product_to_reactant", pref2);
127 }
128 env.writeResultsDat(results_file);
129
130 if (outFreq && !failed) {
131 for (int i = 0; i < freqs.size(); i++) {
132 if (0. < freqs[i]) {
133 outFreq << std::format("{:f}\n",
134 std::sqrt(freqs[i]) /
136 } else {
137 outFreq << std::format("{:f}\n",
138 -std::sqrt(-freqs[i]) /
140 }
141 }
142 }
143
144 if (std::filesystem::exists("freqs.dat")) {
145 returnFiles.push_back("freqs.dat");
146 }
147 if (std::filesystem::exists("hessian.dat")) {
148 returnFiles.push_back("hessian.dat");
149 }
150
151 return returnFiles;
152}
#define EONC_LOG_CRITICAL(...)
std::shared_ptr< Potential > pot
static PotRegistry & get() noexcept
Process-lifetime singleton.
size_t total_force_calls() const noexcept
static constexpr std::string_view PREFACTOR_PRODUCT
static constexpr std::string_view PREFACTOR_SADDLE
static constexpr std::string_view PREFACTOR_REACTANT
VectorXi allFreeAtoms(Matter *matter)
VectorXi movedAtoms(const Parameters ¶meters, Matter *min1, Matter *saddle, Matter *min2)
int getPrefactors(const Parameters ¶meters, Matter *min1, Matter *saddle, Matter *min2, double &pref1, double &pref2)
std::string getRelevantFile(std::string filename)
constexpr bool io_ok(IoStatus s) noexcept
static JobResultEnvelope fromMinimization(RunStatus status, PotType pot, std::uint64_t fcalls, bool hasE, double energy)