Virtual run; used solely for dynamic dispatch.
23 {
24 std::vector<std::string> returnFiles;
25 std::string posInFilename("pos.con");
26 std::string resultsFilename("results.dat");
27
28 auto pos = std::make_unique<Matter>(
pot,
params);
30 QUILL_LOG_CRITICAL(
log,
"Failed to load {}", posInFilename);
31 throw std::runtime_error("failed to load " + posInFilename);
32 }
33
34 QUILL_LOG_DEBUG(
log,
"Energy: {:.12f}", pos->getPotentialEnergy());
35 std::stringstream freeForcesStream;
36 freeForcesStream << pos->getForcesFree();
37 QUILL_LOG_DEBUG(
log,
"(free) Forces:\n{}", freeForcesStream.str());
38 QUILL_LOG_DEBUG(
log,
"Max atom force: {:.12f}", pos->maxForce());
39
40 std::ofstream outFile(resultsFilename, std::ios::binary);
41 if (!outFile) {
42 QUILL_LOG_CRITICAL(
log,
"Failed to open {}", resultsFilename);
43 throw std::runtime_error("failed to open " + resultsFilename);
44 }
45
46
47
48 outFile << std::format("{} termination_reason\n",
50 outFile << std::format("{} termination_reason_text\n",
52 outFile << "point job_type\n";
53 outFile << std::format(
54 "{} potential_type\n",
55 magic_enum::enum_name<PotType>(
params.potential_options.potential));
56 outFile << std::format("{} total_force_calls\n",
58 outFile << std::format("{:.12f} potential_energy\n",
59 pos->getPotentialEnergy());
60 outFile << std::format("{:.12f} Energy\n", pos->getPotentialEnergy());
61 outFile << std::format("{:.12f} Max_Force\n", pos->maxForce());
62 outFile.close();
63 if (!outFile) {
64 QUILL_LOG_CRITICAL(
log,
"Failed to write {}", resultsFilename);
65 throw std::runtime_error("failed to write " + resultsFilename);
66 }
67 returnFiles.push_back(resultsFilename);
68
69 return returnFiles;
70}
std::shared_ptr< Potential > pot
static PotRegistry & get() noexcept
Process-lifetime singleton.
constexpr bool io_ok(IoStatus s) noexcept