21 const std::vector<Eigen::VectorXd>& positions,
22 const Eigen::VectorXd& masses,
23 const std::vector<Eigen::MatrixXd>& physicalHessians,
double beta,
26 using V = Eigen::VectorXd;
27 using M = Eigen::MatrixXd;
28 const std::size_t n = positions.size();
29 const Eigen::Index d = masses.size(), nd = n * d;
30 if (n < 4 || n % 2 || d < 9 || d % 3 || physicalHessians.size() != n ||
31 !(beta > 0) || !std::isfinite(beta) || !(hbar > 0) ||
32 !std::isfinite(hbar) || !masses.allFinite() ||
33 !(masses.array() > 0).all())
34 throw std::invalid_argument(
35 "Matching molecular block ring and positive finite units required");
36 const double h = beta * hbar / n;
37 if (!(h > 0) || !std::isfinite(h))
38 throw std::invalid_argument(
39 "Resolved positive molecular link duration required");
40 const V roots = masses.array().sqrt(), inverse = roots.cwiseInverse();
41 V stacked(nd), stackMass(nd), phase(nd);
42 std::vector<M> curvatures;
44 for (std::size_t j = 0; j < n; ++j) {
45 if (positions[j].size() != d || !positions[j].allFinite() ||
46 physicalHessians[j].rows() != d ||
47 physicalHessians[j].cols() != d || !physicalHessians[j].allFinite())
48 throw std::invalid_argument(
49 "Finite matching molecular block nodes required");
50 if ((physicalHessians[j] - physicalHessians[j].transpose()).norm() >
51 1e-8 * std::max(1., physicalHessians[j].norm()))
52 throw std::invalid_argument(
53 "Symmetric physical block Hessians required");
54 stacked.segment(j * d, d) = positions[j];
55 stackMass.segment(j * d, d) = masses;
56 curvatures.push_back(inverse.asDiagonal() * physicalHessians[j] *
57 inverse.asDiagonal());
59 for (std::size_t j = 0; j < n; ++j) {
60 const auto next = (j + 1) % n, previous = (j + n - 1) % n;
61 phase.segment(j * d, d) =
62 roots.cwiseProduct(positions[next] - positions[previous]);
63 bn += roots.cwiseProduct(positions[next] - positions[j]).squaredNorm();
66 if (rigid.cols() != 6 || !(bn > 0) || !std::isfinite(bn))
67 throw std::domain_error(
68 "Noncollapsed nonlinear molecular block ring required");
69 for (
int repeat = 0; repeat < 2; ++repeat)
70 phase -= rigid * (rigid.transpose() * phase);
71 if (!(phase.norm() > 0))
72 throw std::domain_error(
73 "Resolved molecular block time tangent required");
76 normals.leftCols(6) = rigid;
77 normals.col(6) = phase;
78 std::vector<gaussian::Segment> links;
80 for (std::size_t j = 0; j < n; ++j) {
81 const auto next = (j + 1) % n, previous = (j + n - 1) % n;
83 link.
A = M::Identity(d, d) / h + .5 * h * curvatures[j];
84 link.
rightA = M::Identity(d, d) / h + .5 * h * curvatures[next];
85 link.
L = M::Identity(d, d) / h;
87 link.
logDetL = -d * std::log(h);
88 links.push_back(std::move(link));
89 response.segment(j * d, d) =
90 curvatures[j] * phase.segment(j * d, d) +
91 (2 * phase.segment(j * d, d) - phase.segment(previous * d, d) -
92 phase.segment(next * d, d)) /
101 throw std::domain_error(
102 "Resolved one-index molecular block determinant required");
105 7 * std::log(
double(n)) +
106 .5 * std::log(2 * std::numbers::pi * bn * n / (beta * hbar * hbar));
130 const Eigen::VectorXd& reactantCurvatures,
double reactantLogInertia,
131 double actionRelativeToReactantOverHbar, std::size_t nodes,
double beta,
132 double hbar = 1,
double symmetryFactor = 1)
137 static_cast<Eigen::Index
>(nodes * (reactantCurvatures.size() + 6) -
139 !std::isfinite(reactantLogInertia) ||
140 !std::isfinite(actionRelativeToReactantOverHbar) ||
141 !(symmetryFactor > 0) || !std::isfinite(symmetryFactor))
142 throw std::invalid_argument(
143 "Matched molecular block reactant and channel required");
144 return std::log(symmetryFactor) -
145 std::log(2 * std::numbers::pi * beta * hbar) +
150 actionRelativeToReactantOverHbar;
double molecularBlockLogUnimolecularRate(const MolecularBlockFluctuations &ring, const Eigen::VectorXd &reactantCurvatures, double reactantLogInertia, double actionRelativeToReactantOverHbar, std::size_t nodes, double beta, double hbar=1, double symmetryFactor=1)