Loading...
Searching...
No Matches
SaddleFamilyRate.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2#include "SaddleFamilyRate.h"
3
4#include <algorithm>
5#include <cmath>
6#include <limits>
7#include <numbers>
8#include <stdexcept>
9
10namespace gpr::quantum {
11double phasePlaneJacobian(const Eigen::VectorXd& normal,
12 const Eigen::VectorXd& derivative,
13 double targetDerivative, const Eigen::VectorXd& point)
14{
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");
28 return jacobian;
29}
30
31double logImFSaddleFamilyRate(double referenceAction,
32 const gaussian::TwistedTraceResult& reference,
33 const std::vector<SaddleFamilyPoint>& family,
34 double hbar, double symmetryFactor)
35{
36 if (!std::isfinite(referenceAction) || !(hbar > 0) ||
37 !std::isfinite(hbar) || !(symmetryFactor > 0) ||
38 !std::isfinite(symmetryFactor) || family.empty() ||
39 reference.dimension < 2 || !(reference.duration > 0) ||
40 !std::isfinite(reference.duration))
41 throw std::invalid_argument(
42 "Finite matched reactant, phase quadrature and positive scales "
43 "required");
44 const double referenceLog = reference.logPositiveTrace();
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() *
56 reference.duration)
57 throw std::invalid_argument(
58 "Finite regular saddle-family points must match the reactant "
59 "measure");
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);
77 }
78 const double largest =
79 *std::max_element(logarithms.begin(), logarithms.end());
80 long double sum = 0;
81 for (double value: logarithms)
82 sum += std::exp(static_cast<long double>(value - largest));
83 const double result =
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");
90 return result;
91}
92} // namespace gpr::quantum
Models for quantum-path (instanton) searches: arc and tail actions, amplitude continuation.
double logImFSaddleFamilyRate(double referenceAction, const gaussian::TwistedTraceResult &reference, const std::vector< SaddleFamilyPoint > &family, double hbar, double symmetryFactor)
double phasePlaneJacobian(const Eigen::VectorXd &normal, const Eigen::VectorXd &derivative, double targetDerivative, const Eigen::VectorXd &point)