Virtual run; used solely for dynamic dispatch.
27 {
28 std::vector<std::string> returnFiles;
31
32 auto matter1 = std::make_unique<Matter>(
pot,
params);
35 throw std::runtime_error("failed to load " + file1);
36 }
37 auto matter2 = std::make_unique<Matter>(
pot,
params);
40 throw std::runtime_error("failed to load " + file2);
41 }
42
43
44 Matter probe(*matter1);
45 const bool match = probe.compare(
46 *matter2,
params.structure_comparison_options().indistinguishable_atoms);
47
48 double distance = std::numeric_limits<double>::quiet_NaN();
49 double perAtom = std::numeric_limits<double>::quiet_NaN();
50 if (matter1->numberOfAtoms() == matter2->numberOfAtoms()) {
51 distance = matter1->distanceTo(*matter2);
52 perAtom = matter1->perAtomNorm(*matter2);
53 }
54
55 const double e1 = matter1->getPotentialEnergy();
56 const double e2 = matter2->getPotentialEnergy();
57
58 const std::string resultsFilename("results.dat");
59 std::ofstream out(resultsFilename, std::ios::binary);
60 if (!out) {
62 throw std::runtime_error("failed to open " + resultsFilename);
63 }
64 out << std::format("{} termination_reason\n",
66 out << std::format("{} termination_reason_text\n",
68 out << "structure_comparison job_type\n";
69 out << std::format("{} match\n", match ? 1 : 0);
70 out << std::format("{:.12f} distance\n", distance);
71 out << std::format("{:.12f} per_atom_norm\n", perAtom);
72 out << std::format("{:.12f} energy_1\n", e1);
73 out << std::format("{:.12f} energy_2\n", e2);
74 out << std::format("{:.12f} energy_abs_diff\n", std::abs(e1 - e2));
75 out.close();
76 if (!out) {
77 throw std::runtime_error("failed to write " + resultsFilename);
78 }
79 returnFiles.push_back(resultsFilename);
80 return returnFiles;
81}
#define EONC_LOG_CRITICAL(...)
std::shared_ptr< Potential > pot
std::string getRelevantFile(std::string filename)
constexpr bool io_ok(IoStatus s) noexcept