Virtual run; used solely for dynamic dispatch.
25 {
26 auto reactant = std::make_unique<Matter>(
pot,
params);
29 throw std::runtime_error("failed to load pos.con");
30 }
32
33 double dRs[] = {1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 5e-3, 0.01, 0.05, 0.1, -1};
34
36
38 reactant.get(),
params.structure_comparison_options.neighbor_cutoff);
40 displacement.resize(reactant->numberOfAtoms(), 3);
41 displacement.setZero();
42 printf("displacing atoms:");
43 for (int i = 0; i < reactant->numberOfAtoms(); i++) {
44 if (reactant->distance(epicenter, i) <= 3.3) {
45 printf(" %i", i);
46 for (int j = 0; j < 3; j++) {
47 if (!reactant->getFixed(i)) {
49 }
50 }
51 }
52 }
53 printf("\n");
54 displacement.normalize();
55
56 std::ofstream results("results.dat");
57 results << "0 termination_reason\n";
58 results << "GOOD termination_reason_text\n";
59 results << "finite_difference job_type\n";
60 results << std::format("{} total_force_calls\n",
62
63 std::ofstream table("curvature.dat");
64 table << std::format("{:>14s} {:>14s}\n", "dR", "curvature");
65 printf("%14s %14s\n", "dR", "curvature");
68 double curvature = 0.0;
69 for (int dRi = 0; dRs[dRi] != -1; dRi++) {
70 posB = posA + displacement * dRs[dRi];
71 reactant->setPositions(posB);
72 forceB = reactant->getForces();
73 curvature =
matDot(forceB - forceA, displacement) / dRs[dRi];
74 table << std::format("{:14.8f} {:14.8f}\n", dRs[dRi], curvature);
75 results << std::format("{:.12e} dR_{}\n", dRs[dRi], dRi);
76 results << std::format("{:.12e} curvature_{}\n", curvature, dRi);
77 printf("%14.8f %14.8f\n", dRs[dRi], curvature);
78 table.flush();
79 }
80
81 std::vector<std::string> returnFiles;
82 returnFiles.push_back("results.dat");
83 returnFiles.push_back("curvature.dat");
84 return returnFiles;
85}
double matDot(const AtomMatrix &a, const AtomMatrix &b)
SIMD-optimized dot product for contiguous Eigen matrices.
Eigen::Matrix< double, Eigen::Dynamic, 3, eOnStorageOrder > AtomMatrix
#define EONC_LOG_CRITICAL(...)
std::shared_ptr< Potential > pot
static PotRegistry & get() noexcept
Process-lifetime singleton.
long minCoordinatedEpiCenter(const Matter *matter, double neighborCutoff)
constexpr bool io_ok(IoStatus s) noexcept