Loading...
Searching...
No Matches
gpr::quantum::ThermalGeodesicSeed Class Reference

#include <gpr/quantum/ThermalGeodesicSeed.h>

Public Member Functions

 ThermalGeodesicSeed (const M &well, const std::vector< V > &path, const std::vector< PotentialEvaluation > &values, double period, double hbar)
const ThermalJacobiPeriod & matching () const
V at (double time) const
std::vector< V > ring (std::size_t beads) const

Detailed Description

Definition at line 15 of file ThermalGeodesicSeed.h.

Constructor & Destructor Documentation

◆ ThermalGeodesicSeed()

gpr::quantum::ThermalGeodesicSeed::ThermalGeodesicSeed ( const M & well,
const std::vector< V > & path,
const std::vector< PotentialEvaluation > & values,
double period,
double hbar )
inline

Definition at line 31 of file ThermalGeodesicSeed.h.

34 : path_(path), period_(period)
35 {
36 match_ = matchThermalJacobiPeriod(well, path, values, period, hbar);
37 Eigen::SelfAdjointEigenSolver<M> eigen(well);
38 if (eigen.info() != Eigen::Success ||
39 eigen.eigenvalues().minCoeff() <= 0)
40 throw std::invalid_argument("Positive thermal seed well required");
41 modes_ = eigen.eigenvectors();
42 frequencies_ = eigen.eigenvalues().cwiseSqrt();
43 modalCut_ = modes_.transpose() * path.front();
44 path_.back() = match_.outerTurningPoint;
45 for (const auto& value: values)
46 energies_.push_back(value.energy);
47 energies_.back() = match_.energy;
48 double duration = 0.;
49 for (std::size_t j = 0; j + 1 < path_.size(); ++j) {
50 const double a = energies_[j] - match_.energy;
51 const double b = energies_[j + 1] - match_.energy;
52 const double length = (path_[j + 1] - path_[j]).norm();
53 if (!(a > 0) || !(b >= 0) || !(length > 0) ||
54 !std::isfinite(length))
55 throw std::domain_error("Resolved thermal seed arc required");
56 const double time =
57 std::sqrt(2.) * length / (std::sqrt(a) + std::sqrt(b));
58 if (!(time > 0) || !std::isfinite(time))
59 throw std::domain_error(
60 "Finite thermal seed traversal time required");
61 times_.push_back(time);
62 duration += time;
63 }
64 if (std::abs(2 * (match_.tailHalfDuration + duration) - period_) >
65 1e-10 * std::max(1., period_))
66 throw std::runtime_error(
67 "Thermal seed traversal does not match its period");
68 }
ThermalJacobiPeriod matchThermalJacobiPeriod(const Eigen::MatrixXd &well, const std::vector< Eigen::VectorXd > &path, const std::vector< PotentialEvaluation > &native, double thermalPeriod, double hbar)

Member Function Documentation

◆ at()

V gpr::quantum::ThermalGeodesicSeed::at ( double time) const
inline

Definition at line 75 of file ThermalGeodesicSeed.h.

76 {
77 if (!std::isfinite(time) || time < 0 || time > period_)
78 throw std::invalid_argument(
79 "Thermal seed time must lie in one period");
80 time = std::min(time, period_ - time);
81 if (time >= .5 * period_) return path_.back();
82 if (time <= match_.tailHalfDuration) {
83 V modal(modalCut_.size());
84 for (Eigen::Index j = 0; j < modal.size(); ++j)
85 modal[j] =
86 modalCut_[j] * std::exp(logCosh(frequencies_[j] * time) -
87 logCosh(frequencies_[j] *
88 match_.tailHalfDuration));
89 return modes_ * modal;
90 }
91 time -= match_.tailHalfDuration;
92 for (std::size_t j = 0; j < times_.size(); ++j) {
93 if (time > times_[j] && j + 1 < times_.size()) {
94 time -= times_[j];
95 continue;
96 }
97 const double length = (path_[j + 1] - path_[j]).norm();
98 const double scaledTime = std::clamp(time, 0., times_[j]) / length;
99 const double fraction =
100 scaledTime *
101 (std::sqrt(2 * (energies_[j] - match_.energy)) +
102 .5 * (energies_[j + 1] - energies_[j]) * scaledTime);
103 if (!std::isfinite(fraction) || fraction < -1e-12 ||
104 fraction > 1 + 1e-12)
105 throw std::runtime_error(
106 "Thermal seed interpolation leaves its link");
107 return path_[j] +
108 std::clamp(fraction, 0., 1.) * (path_[j + 1] - path_[j]);
109 }
110 throw std::runtime_error("Thermal seed arc has no containing link");
111 }

◆ matching()

const ThermalJacobiPeriod & gpr::quantum::ThermalGeodesicSeed::matching ( ) const
inline

Definition at line 70 of file ThermalGeodesicSeed.h.

71 {
72 return match_;
73 }

◆ ring()

std::vector< V > gpr::quantum::ThermalGeodesicSeed::ring ( std::size_t beads) const
inline

Definition at line 113 of file ThermalGeodesicSeed.h.

114 {
115 if (beads < 4)
116 throw std::invalid_argument(
117 "At least four thermal seed beads required");
118 std::vector<V> result(beads);
119 result[0] = at(0.);
120 for (std::size_t j = 1; j <= beads / 2; ++j) {
121 result[j] = at(period_ * (double(j) / beads));
122 result[beads - j] = result[j];
123 }
124 return result;
125 }

The documentation for this class was generated from the following file: