12 const Eigen::VectorXd& derivative,
13 double targetDerivative,
const Eigen::VectorXd& point)
15 if (!normal.size() || derivative.size() != normal.size() ||
16 point.size() != normal.size() || !normal.allFinite() ||
17 !derivative.allFinite() || !point.allFinite() ||
18 !std::isfinite(targetDerivative) ||
19 std::abs(normal.squaredNorm() - 1) > 1e-12 ||
20 std::abs(normal.dot(derivative)) >
21 1e-12 * std::max(1., derivative.norm()))
22 throw std::invalid_argument(
23 "Finite matching unit phase plane and tangent derivative required");
24 const double jacobian = std::abs(targetDerivative - derivative.dot(point));
25 if (!(jacobian > 0) || !std::isfinite(jacobian))
26 throw std::domain_error(
27 "Phase plane does not define a resolved regular chart");
33 const std::vector<SaddleFamilyPoint>& family,
34 double hbar,
double symmetryFactor)
36 if (!std::isfinite(referenceAction) || !(hbar > 0) ||
37 !std::isfinite(hbar) || !(symmetryFactor > 0) ||
38 !std::isfinite(symmetryFactor) || family.empty() ||
41 throw std::invalid_argument(
42 "Finite matched reactant, phase quadrature and positive scales "
45 std::vector<double> logarithms;
46 for (
const auto& point: family) {
47 const auto& result = point.fluctuations;
48 if (!std::isfinite(point.action) || !(point.quadratureWeight > 0) ||
49 !std::isfinite(point.quadratureWeight) ||
50 !(point.phaseJacobian > 0) || !std::isfinite(point.phaseJacobian) ||
51 result.codimension != 1 ||
52 result.dimension != reference.
dimension - 1 ||
53 !std::isfinite(result.duration) ||
54 std::abs(result.duration - reference.
duration) >
55 128 * std::numeric_limits<double>::epsilon() *
57 throw std::invalid_argument(
58 "Finite regular saddle-family points must match the reactant "
60 if (!result.logAbsNormalizedDet ||
61 !std::isfinite(*result.logAbsNormalizedDet) ||
62 result.inertia.negative != 1 || result.inertia.zero ||
63 result.unresolvedBorderEigenvalues ||
64 result.inertia.positive !=
65 static_cast<std::size_t
>(result.dimension - 1))
66 throw std::domain_error(
67 "Each transverse saddle Gaussian must have exactly one "
68 "resolved negative mode");
69 const double value = std::log(point.quadratureWeight) +
70 std::log(point.phaseJacobian) +
71 (referenceAction - point.action) / hbar -
72 .5 * *result.logAbsNormalizedDet - referenceLog;
73 if (!std::isfinite(value))
74 throw std::overflow_error(
75 "Unrepresentable saddle-family logarithm");
76 logarithms.push_back(value);
78 const double largest =
79 *std::max_element(logarithms.begin(), logarithms.end());
81 for (
double value: logarithms)
82 sum += std::exp(
static_cast<long double>(value - largest));
84 largest +
static_cast<double>(std::log(sum)) +
85 std::log(symmetryFactor) - std::log(reference.
duration) -
86 .5 * (std::log(2 * std::numbers::pi) + std::log(hbar));
87 if (!std::isfinite(result))
88 throw std::overflow_error(
89 "Unrepresentable saddle-family rate logarithm");