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 56 of file Tunneling.h.

Constructor & Destructor Documentation

◆ Profile()

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

Definition at line 88 of file Tunneling.cpp.

89 : s_(std::move(s)),
90 v_(std::move(v)),
91 m_(s_.size(), 0.0) {
92 const size_t n = s_.size();
93 if (n < 2 || v_.size() != n) {
94 throw std::invalid_argument(
95 "a profile needs matching s and V with two points or more");
96 }
97 for (size_t k = 1; k < n; ++k) {
98 if (!(s_[k] > s_[k - 1])) {
99 throw std::invalid_argument(
100 "the path coordinate must increase along the band");
101 }
102 }
103 for (size_t k = 1; k + 1 < n; ++k) {
104 const double h0 = s_[k] - s_[k - 1];
105 const double h1 = s_[k + 1] - s_[k];
106 const double d0 = (v_[k] - v_[k - 1]) / h0;
107 const double d1 = (v_[k + 1] - v_[k]) / h1;
108 if (d0 * d1 <= 0.0) {
109 m_[k] = 0.0;
110 } else {
111 const double w1 = 2.0 * h1 + h0;
112 const double w2 = h1 + 2.0 * h0;
113 m_[k] = (w1 + w2) / (w1 / d0 + w2 / d1);
114 }
115 }
116}
std::vector< double > m_
Definition Tunneling.h:64
std::vector< double > s_
Definition Tunneling.h:64
std::vector< double > v_
Definition Tunneling.h:64
const std::vector< double > & v() const
Definition Tunneling.h:61
const std::vector< double > & s() const
Definition Tunneling.h:60

Member Function Documentation

◆ operator()()

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

Definition at line 118 of file Tunneling.cpp.

118 {
119 x = std::clamp(x, s_.front(), s_.back());
120 auto it = std::upper_bound(s_.begin(), s_.end(), x);
121 size_t k = static_cast<size_t>(std::distance(s_.begin(), it));
122 k = std::clamp<size_t>(k == 0 ? 0 : k - 1, 0, s_.size() - 2);
123 const double h = s_[k + 1] - s_[k];
124 const double t = (x - s_[k]) / h;
125 const double t2 = t * t;
126 const double t3 = t2 * t;
127 return (2 * t3 - 3 * t2 + 1) * v_[k] + (t3 - 2 * t2 + t) * h * m_[k] +
128 (-2 * t3 + 3 * t2) * v_[k + 1] + (t3 - t2) * h * m_[k + 1];
129}

◆ s()

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

Definition at line 60 of file Tunneling.h.

60{ return s_; }

◆ v()

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

Definition at line 61 of file Tunneling.h.

61{ return v_; }

Member Data Documentation

◆ m_

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

Definition at line 64 of file Tunneling.h.

◆ s_

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

Definition at line 64 of file Tunneling.h.

◆ v_

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

Definition at line 64 of file Tunneling.h.


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