Virtual run; used solely for dynamic dispatch.
32 {
33 std::vector<std::string> returnFiles;
34 VectorXd freqs;
35
39
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;
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,
pots().total_force_calls(),
false,
120 0.0);
122 env.job_type = "prefactor";
123 env.tags.emplace_back("good", failed ? "false" : "true");
124 env.extras.emplace_back("force_calls", static_cast<double>(env.force_calls));
125 if (!failed) {
126 env.extras.emplace_back("prefactor_reactant_to_product", pref1);
127 env.extras.emplace_back("prefactor_product_to_reactant", pref2);
128 }
129 env.writeResultsDat(results_file);
130
131 if (outFreq && !failed) {
132 for (int i = 0; i < freqs.size(); i++) {
133 if (0. < freqs[i]) {
134 outFreq << std::format("{:f}\n",
135 std::sqrt(freqs[i]) /
137 } else {
138 outFreq << std::format("{:f}\n",
139 -std::sqrt(-freqs[i]) /
141 }
142 }
143 }
144
145 if (std::filesystem::exists("freqs.dat")) {
146 returnFiles.push_back("freqs.dat");
147 }
148 if (std::filesystem::exists("hessian.dat")) {
149 returnFiles.push_back("hessian.dat");
150 }
151
152 return returnFiles;
153}
#define EONC_LOG_CRITICAL(...)
PotRegistry & pots() noexcept
std::shared_ptr< Potential > pot
Set when one Potential is shared across Matters, images, or a caller.
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
JobResultProvenance provenanceForJob(const Parameters ¶ms)
Optimizer backend, engine identity, rgpot pin, and xts ABI from a job.
static JobResultEnvelope fromMinimization(RunStatus status, PotType pot, std::uint64_t fcalls, bool hasE, double energy)