Loading...
Searching...
No Matches
ThermalJacobiPeriod.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
6#pragma once
7#include <algorithm>
8
10#include "JacobiAction.h"
11
12namespace gpr::quantum {
20
21// The final native chord carries a linear potential. Its endpoint moves to
22// the contour V=E as E varies; holding that endpoint fixed breaks -dW/dE=tau.
24 const std::vector<Eigen::VectorXd>& path,
25 const std::vector<PotentialEvaluation>& native, double energy,
26 Eigen::VectorXd* turningPoint = nullptr)
27{
28 if (path.size() < 3 || native.size() != path.size())
29 throw std::invalid_argument(
30 "Matching spatial arc nodes and energies required");
31 const auto last = path.size() - 1;
32 const double slope = native[last - 1].energy - native[last].energy;
33 if (!(slope > 0) || !(native[last - 1].energy > energy) ||
34 !std::isfinite(slope))
35 throw std::domain_error(
36 "A descending native outer turning chord is required");
37 auto q = path;
38 auto v = native;
39 const double fraction = (native[last - 1].energy - energy) / slope;
40 q.back() = path[last - 1] + fraction * (path[last] - path[last - 1]);
41 v.back().energy = energy;
42 if (turningPoint) *turningPoint = q.back();
43 return evaluateJacobiPath(q, v, energy);
44}
45
46// A one-way anharmonic excursion and its return join an exact harmonic dwell.
47// The low-energy branch solves 2*t_tail+2*t_arc(E)=beta*hbar in tail duration.
48// Log energy survives underflow; no time beads sample the harmonic dwell.
49// Spatial stationarity, native contour errors and fluctuations remain separate
50// requirements for a physical rate.
52 const Eigen::MatrixXd& well, const std::vector<Eigen::VectorXd>& path,
53 const std::vector<PotentialEvaluation>& native, double thermalPeriod,
54 double hbar)
55{
56 if (path.size() < 3 || native.size() != path.size() ||
57 !(thermalPeriod > 0) || !std::isfinite(thermalPeriod) || !(hbar > 0) ||
58 !std::isfinite(hbar))
59 throw std::invalid_argument(
60 "Finite positive thermal scales and a matching spatial arc "
61 "required");
62 const HarmonicTurningTail tail(well);
63 const auto& cut = path.front();
64 if (cut.size() != well.rows() || !cut.allFinite())
65 throw std::invalid_argument("Harmonic cut and spatial metric differ");
66 const double cutEnergy = .5 * cut.dot(well * cut);
67 double bound = cutEnergy;
68 for (std::size_t j = 0; j + 1 < native.size(); ++j) {
69 if (!(native[j].energy > 0) || !std::isfinite(native[j].energy))
70 throw std::domain_error(
71 "The measured spatial arc must enter the forbidden region");
72 bound = std::min(bound, native[j].energy);
73 }
74 if (!(bound > 0) || !std::isfinite(bound))
75 throw std::domain_error(
76 "A positive harmonic matching energy is required");
77 const double minimumTime = tail.halfDurationForLogEnergy(
78 cut, std::log(bound) - std::log(2.), hbar);
79 const double maximumTime = .5 * thermalPeriod;
80 if (!(minimumTime < maximumTime))
81 throw std::domain_error(
82 "Thermal period is too short for this harmonic-cut branch");
83 auto evaluate = [&](double t) {
84 const auto harmonic = tail.evaluate(cut, t, hbar);
85 Eigen::VectorXd turning;
86 const auto arc =
87 jacobiArcToTurningContour(path, native, harmonic.energy, &turning);
89 out.energy = harmonic.energy;
90 out.logEnergy = harmonic.logEnergy;
91 out.tailHalfDuration = t;
92 out.oneWayArcTime = arc.traversalTime;
93 out.period = 2 * (t + arc.traversalTime);
94 out.periodResidual = out.period - thermalPeriod;
95 out.abbreviatedAction = 2 * arc.action + harmonic.abbreviatedAction;
96 out.canonicalAction =
97 out.abbreviatedAction + thermalPeriod * harmonic.energy;
98 out.outerContourEnergyError =
99 std::abs(native.back().energy - harmonic.energy);
100 out.matchingEnergyError = std::abs(native.front().energy - cutEnergy);
101 out.tailMomentum = harmonic.momentum;
102 out.outerTurningPoint = turning;
103 const Eigen::VectorXd tangent = (path[1] - path.front()).normalized();
104 out.cutMomentumResidual =
105 (harmonic.momentum -
106 std::sqrt(2 * (native.front().energy - harmonic.energy)) * tangent)
107 .norm();
108 out.outerTurningDisplacement = (turning - path.back()).norm();
109 return out;
110 };
111 double right = maximumTime, left = minimumTime;
112 (void)evaluate(right);
113 bool bracketed = false;
114 for (unsigned j = 1; j <= 128; ++j) {
115 const double candidate =
116 maximumTime - (maximumTime - minimumTime) * (double(j) / 128.);
117 const auto lower = evaluate(candidate);
118 if (lower.periodResidual <= 0) {
119 left = candidate;
120 bracketed = true;
121 break;
122 }
123 right = candidate;
124 }
125 if (!bracketed)
126 throw std::domain_error(
127 "No tail-dominated thermal period bracket on this spatial arc");
128 for (unsigned iteration = 0; iteration < 100; ++iteration) {
129 const double t = .5 * (left + right);
130 auto state = evaluate(t);
131 if (std::abs(state.periodResidual) <= 2e-13 * thermalPeriod)
132 return state;
133 if (state.periodResidual > 0)
134 right = t;
135 else
136 left = t;
137 }
138 throw std::runtime_error(
139 "Thermal spatial period matching does not converge");
140}
141} // namespace gpr::quantum
HarmonicTail evaluate(const Eigen::VectorXd &q, double t, double hbar) const
double halfDurationForLogEnergy(const Eigen::VectorXd &q, double logEnergy, double hbar) const
eon_relax_band_t eon_relax_surface_fn void eon_relax_outcome_t * out
Models for quantum-path (instanton) searches: arc and tail actions, amplitude continuation.
JacobiPathEvaluation evaluateJacobiPath(const std::vector< Eigen::VectorXd > &points, const std::vector< PotentialEvaluation > &native, double energy)
ThermalJacobiPeriod matchThermalJacobiPeriod(const Eigen::MatrixXd &well, const std::vector< Eigen::VectorXd > &path, const std::vector< PotentialEvaluation > &native, double thermalPeriod, double hbar)
JacobiPathEvaluation jacobiArcToTurningContour(const std::vector< Eigen::VectorXd > &path, const std::vector< PotentialEvaluation > &native, double energy, Eigen::VectorXd *turningPoint=nullptr)