ampsci
c++ program for high-precision atomic structure calculations of single-valence systems
Loading...
Searching...
No Matches
RadPot.hpp
1#pragma once
2#include "FGRadPot.hpp"
3#include "IO/FRW_fileReadWrite.hpp"
4#include "IO/InputBlock.hpp"
5#include "Maths/Interpolator.hpp"
6#include "Physics/PhysConst_constants.hpp"
7#include "qip/Vector.hpp"
8#include <algorithm>
9#include <vector>
10
11namespace QED {
12
13//==============================================================================
15class RadPot {
16
17public:
18 //============================================================================
20 struct Scale {
21 double u, h, l, m, wk;
22 };
23
24 //============================================================================
26
30 struct Xl {
31
32 private:
33 std::vector<double> m_x;
34
35 public:
36 Xl();
37 Xl(std::vector<double> x);
38
39 double operator()(int l) const;
40 };
41
42 //============================================================================
43private:
44 double m_Z, m_rN, m_rcut;
45 Scale m_f;
46 Xl m_xl;
47 bool print;
48
49 std::vector<double> mVu{}; // Uehling
50 std::vector<double> mVh{}; // High-freq electric SE (without A)
51 std::vector<double> mVl{}; // Low-freq electric SE (without B)
52 std::vector<double> mHm{}; // Magnetic FF
53 std::vector<double> mVwk{}; // Approx Wickman-Kroll
54
55public:
57 RadPot();
58
60
63 RadPot(const std::vector<double> &r, double Z, double rN = 0.0,
64 double rcut = 0.0, Scale f = {1.0, 1.0, 1.0, 1.0, 0.0}, Xl xl = {},
65 bool tprint = true, bool do_readwrite = true);
66
67 bool read_write(const std::vector<double> &r, IO::FRW::RoW rw);
68
69 void form_potentials(const std::vector<double> &r);
70
72 std::vector<double> Vel(int l = 0) const;
74 std::vector<double> Hmag(int) const;
75 std::vector<double> Vu(int l = 0) const;
76 std::vector<double> Vl(int l = 0) const;
77 std::vector<double> Vh(int l = 0) const;
78
79 template <typename Func>
80 std::vector<double> fill(Func f, const std::vector<double> &r);
81
82 template <typename Func>
83 std::vector<double> fill(Func f, const std::vector<double> &r,
84 std::size_t stride);
85};
86
87//============================================================================
88//==============================================================================
89template <typename Func>
90std::vector<double> RadPot::fill(Func f, const std::vector<double> &r) {
91 std::vector<double> v;
92 v.resize(r.size());
93
94 const auto rcut = m_rcut == 0.0 ? r.back() : m_rcut;
95
96 // index for r cut-off
97 const auto icut = std::size_t(std::distance(
98 begin(r),
99 std::find_if(begin(r), end(r), [rcut](auto ri) { return ri > rcut; })));
100
101#pragma omp parallel for
102 for (auto i = 0ul; i < icut; ++i) {
103 // nb: Use H -> H+V (instead of H-> H-V), so change sign!
104 v[i] = -f(m_Z, r[i], m_rN);
105 }
106 return v;
107}
108
109//==============================================================================
110template <typename Func>
111std::vector<double> RadPot::fill(Func f, const std::vector<double> &r,
112 std::size_t stride) {
113
114 const auto rcut = m_rcut == 0.0 ? r.back() : m_rcut;
115
116 // index for r cut-off
117 const auto icut =
118 std::size_t(std::distance(
119 begin(r), std::find_if(begin(r), end(r),
120 [rcut](auto ri) { return ri > rcut; }))) /
121 stride;
122
123 std::vector<double> tv, tr;
124 tv.resize(icut);
125 tr.resize(icut);
126
127#pragma omp parallel for
128 for (auto i = 0ul; i < icut; ++i) {
129 // nb: Use H -> H+V (instead of H-> H-V), so change sign!
130 tv[i] = -f(m_Z, r[i * stride], m_rN);
131 tr[i] = r[i * stride];
132 }
133 return stride == 1 ? tv : Interpolator::interpolate(tr, tv, r);
134}
135
136//==============================================================================
138RadPot ConstructRadPot(const std::vector<double> &r, double Z_eff, double rN_au,
139 const IO::InputBlock &input = {}, bool print = true,
140 bool do_readwrite = true);
141
142} // namespace QED
Holds list of Options, and a list of other InputBlocks. Can be initialised with a list of options,...
Definition InputBlock.hpp:142
Class holds Flambaum-Ginges QED Radiative Potential.
Definition RadPot.hpp:15
std::vector< double > Vel(int l=0) const
Returns entire electric part of potential.
Definition RadPot.cpp:151
RadPot()
Empty constructor.
Definition RadPot.cpp:25
std::vector< double > Hmag(int) const
Returns H_mag.
Definition RadPot.cpp:160
double f(RaB r, PrincipalQN n, DiracQN k, Zeff z, AlphaFS a)
Upper radial component.
Definition DiracHydrogen.cpp:71
std::vector< double > interpolate(const std::vector< double > &x_in, const std::vector< double > &y_in, const std::vector< double > &x_out, Method method=Method::cspline)
Performs interpolation using GSL (GNU Scientific Library)
Definition Interpolator.hpp:162
void QED(const IO::InputBlock &input, const Wavefunction &wf)
Calculates QED corrections to energies and matrix elements.
Definition qed.cpp:20
Scale factors for Uehling, high, low, magnetic, Wickman-Kroll.
Definition RadPot.hpp:20
Extra fitting for s,p,d etc. states.
Definition RadPot.hpp:30