Loading...
Searching...
No Matches
eonc::tunneling::Profile Class Reference

Energy along the path, interpolated as a monotone cubic (Fritsch and Carlson), flat at both ends because the ends of a band are minima. More...

#include <Tunneling.h>

Public Member Functions

 Profile (std::vector< double > s, std::vector< double > v)
double operator() (double x) const
const std::vector< double > & s () const
const std::vector< double > & v () const

Private Attributes

std::vector< double > s_
std::vector< double > v_
std::vector< double > m_

Detailed Description

Energy along the path, interpolated as a monotone cubic (Fritsch and Carlson), flat at both ends because the ends of a band are minima.

A monotone interpolant cannot invent a dip below the data, which would change the forbidden region the WKB integral runs over.

Definition at line 54 of file Tunneling.h.

Constructor & Destructor Documentation

◆ Profile()

eonc::tunneling::Profile::Profile ( std::vector< double > s,
std::vector< double > v )

Definition at line 61 of file Tunneling.cpp.

62 : s_(std::move(s)),
63 v_(std::move(v)),
64 m_(s_.size(), 0.0) {
65 const size_t n = s_.size();
66 if (n < 2 || v_.size() != n) {
67 throw std::invalid_argument(
68 "a profile needs matching s and V with two points or more");
69 }
70 for (size_t k = 1; k < n; ++k) {
71 if (!(s_[k] > s_[k - 1])) {
72 throw std::invalid_argument(
73 "the path coordinate must increase along the band");
74 }
75 }
76 for (size_t k = 1; k + 1 < n; ++k) {
77 const double h0 = s_[k] - s_[k - 1];
78 const double h1 = s_[k + 1] - s_[k];
79 const double d0 = (v_[k] - v_[k - 1]) / h0;
80 const double d1 = (v_[k + 1] - v_[k]) / h1;
81 if (d0 * d1 <= 0.0) {
82 m_[k] = 0.0;
83 } else {
84 const double w1 = 2.0 * h1 + h0;
85 const double w2 = h1 + 2.0 * h0;
86 m_[k] = (w1 + w2) / (w1 / d0 + w2 / d1);
87 }
88 }
89}
std::vector< double > m_
Definition Tunneling.h:62
std::vector< double > s_
Definition Tunneling.h:62
std::vector< double > v_
Definition Tunneling.h:62
const std::vector< double > & v() const
Definition Tunneling.h:59
const std::vector< double > & s() const
Definition Tunneling.h:58

Member Function Documentation

◆ operator()()

double eonc::tunneling::Profile::operator() ( double x) const

Definition at line 91 of file Tunneling.cpp.

91 {
92 x = std::clamp(x, s_.front(), s_.back());
93 auto it = std::upper_bound(s_.begin(), s_.end(), x);
94 size_t k = static_cast<size_t>(std::distance(s_.begin(), it));
95 k = std::clamp<size_t>(k == 0 ? 0 : k - 1, 0, s_.size() - 2);
96 const double h = s_[k + 1] - s_[k];
97 const double t = (x - s_[k]) / h;
98 const double t2 = t * t;
99 const double t3 = t2 * t;
100 return (2 * t3 - 3 * t2 + 1) * v_[k] + (t3 - 2 * t2 + t) * h * m_[k] +
101 (-2 * t3 + 3 * t2) * v_[k + 1] + (t3 - t2) * h * m_[k + 1];
102}

◆ s()

const std::vector< double > & eonc::tunneling::Profile::s ( ) const
inline

Definition at line 58 of file Tunneling.h.

58{ return s_; }

◆ v()

const std::vector< double > & eonc::tunneling::Profile::v ( ) const
inline

Definition at line 59 of file Tunneling.h.

59{ return v_; }

Member Data Documentation

◆ m_

std::vector<double> eonc::tunneling::Profile::m_
private

Definition at line 62 of file Tunneling.h.

◆ s_

std::vector<double> eonc::tunneling::Profile::s_
private

Definition at line 62 of file Tunneling.h.

◆ v_

std::vector<double> eonc::tunneling::Profile::v_
private

Definition at line 62 of file Tunneling.h.


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