ampsci
High-precision calculations for one- and two-valence atomic systems
QED.hpp
1#pragma once
2#include "DiracOperator/GenerateOperator.hpp"
3#include "DiracOperator/Operators/hfs.hpp"
4#include "DiracOperator/TensorOperator.hpp"
5#include "IO/InputBlock.hpp"
6#include "Physics/PhysConst_constants.hpp"
7#include "Potentials/FGRadPot.hpp"
8#include "Wavefunction/Wavefunction.hpp"
9#include "qip/Vector.hpp"
10#include <cmath>
11
12namespace DiracOperator {
13
14//==============================================================================
15//! Flambaum-Ginges radiative potential operator
16class Vrad final : public ScalarOperator {
17public:
18 Vrad(QED::RadPot rad_pot)
19 : ScalarOperator(Parity::even, 1.0), m_Vrad(std::move(rad_pot)) {}
20 std::string name() const override final { return "Vrad"; }
21 std::string units() const override final { return "au"; }
22
23 virtual DiracSpinor radial_rhs(const int kappa_a,
24 const DiracSpinor &Fb) const override final {
25 auto dF = m_Vrad.Vel(Fb.l()) * Fb;
26 using namespace qip::overloads;
27 const auto &Hmag = m_Vrad.Hmag(Fb.l());
28 dF.f() -= Hmag * Fb.g();
29 dF.g() -= Hmag * Fb.f();
30 if (kappa_a != Fb.kappa())
31 return 0.0 * dF;
32 return dF;
33 }
34
35 virtual double radialIntegral(const DiracSpinor &Fa,
36 const DiracSpinor &Fb) const override final {
37 // nb: faster not to do this, but nicer this way
38 return Fa * radial_rhs(Fa.kappa(), Fb);
39 }
40
41 const QED::RadPot &RadPot() const { return m_Vrad; }
42
43private:
44 QED::RadPot m_Vrad;
45};
46
47//==============================================================================
48inline std::unique_ptr<DiracOperator::TensorOperator>
49generate_Vrad(const IO::InputBlock &input, const Wavefunction &wf) {
50 using namespace DiracOperator;
51 input.check(
52 {{{"Ueh", " Uehling (vacuum pol). [1.0]"},
53 {"SE_h", " self-energy high-freq electric. [1.0]"},
54 {"SE_l", " self-energy low-freq electric. [1.0]"},
55 {"SE_m", " self-energy magnetic. [1.0]"},
56 {"WK", " Wickman-Kroll. [0.0]"},
57 {"rcut", "Maximum radius (au) to calculate Rad Pot for [5.0]"},
58 {"scale_rN", "Scale factor for Nuclear size. 0 for pointlike, 1 for "
59 "typical [1.0]"},
60 {"scale_l", "List of doubles. Extra scaling factor for each l e.g., "
61 "1,0,1 => include for s and d, but not for p [1.0]"},
62 {"readwrite", "Read/write potential? [true]"}}});
63 if (input.has_option("help")) {
64 return nullptr;
65 }
66
67 const auto x_Ueh = input.get("Ueh", 1.0);
68 const auto x_SEe_h = input.get("SE_h", 1.0);
69 const auto x_SEe_l = input.get("SE_l", 1.0);
70 const auto x_SEm = input.get("SE_m", 1.0);
71 const auto x_wk = input.get("WK", 0.0);
72 const auto rcut = input.get("rcut", 5.0);
73 const auto scale_rN = input.get("scale_rN", 1.0);
74 const auto x_spd = input.get("scale_l", std::vector{1.0});
75 const auto readwrite = input.get("readwrite", true);
76
77 const auto r_N_au =
78 std::sqrt(5.0 / 3.0) * scale_rN * wf.nucleus().r_rms() / PhysConst::aB_fm;
79
80 auto qed = QED::RadPot(wf.grid().r(), wf.Znuc(), r_N_au, rcut,
81 {x_Ueh, x_SEe_h, x_SEe_l, x_SEm, x_wk}, x_spd, true,
82 readwrite, wf.run_label());
83
84 return std::make_unique<Vrad>(std::move(qed));
85}
86
87//==============================================================================
88//! @brief Effective VertexQED operator
89/*! @details
90Takes in any TensorOperator (DiracOperator) h, and forms the corresponding
91effective QED vertex operator, defined:
92
93\f[
94\hat h_{\rm vertex} = A \alpha \exp(-b r / \lambda_c)
95\f]
96
97where
98
99\f[ \lambda_c = 1/ \alpha \approx 137 \f]
100
101A and b are fitting factors; typically b=1
102 */
103class VertexQED final : public TensorOperator {
104
105public: // constructor
106 VertexQED(const TensorOperator *const h0, const Grid &rgrid, double a = 1.0,
107 double b = 1.0)
108 : TensorOperator(h0->rank(), h0->parity() == 1 ? Parity::even : Parity::odd,
109 h0->getc(), vertex_func(rgrid, a, b, h0->getv()),
110 h0->imaginaryQ() ? Realness::imaginary : Realness::real,
111 h0->freqDependantQ()),
112 m_h0(h0) {}
113
114 std::string name() const override final {
115 return m_h0->name() + "_vertexQED";
116 }
117 std::string units() const override final { return m_h0->units(); }
118
119 double angularF(const int ka, const int kb) const override final {
120 return m_h0->angularF(ka, kb);
121 }
122
123 double angularCff(int ka, int kb) const override final {
124 return m_h0->angularCff(ka, kb);
125 }
126 double angularCgg(int ka, int kb) const override final {
127 return m_h0->angularCgg(ka, kb);
128 }
129 double angularCfg(int ka, int kb) const override final {
130 return m_h0->angularCfg(ka, kb);
131 }
132 double angularCgf(int ka, int kb) const override final {
133 return m_h0->angularCgf(ka, kb);
134 }
135
136 // Have m_h0 pointer, so delete copy/asign constructors
137 VertexQED(const DiracOperator::VertexQED &) = delete;
138 VertexQED &operator=(const DiracOperator::VertexQED &) = delete;
139
140private:
141 const TensorOperator *const m_h0;
142
143public:
144 //! Fitting factor for hyperfine. Default a(Z)
145 static double a(double z) { return 1.0 + 28.5 / z; }
146
147 //! Takes existing radial vector, multiplies by:
148 //! @details
149 //! a(Z) * a0 * exp( - b * r / a0).
150 //! a0 = alpha = 1/137.
151 //! b=1 by default. A should be fitted.
152 //! a(Z) = 1.0 + 28.5/Z
153 //! nb: can give it an empty vector, to just get the exponential function
154 static std::vector<double> vertex_func(const Grid &rgrid, double a, double b,
155 std::vector<double> v = {}) {
156
157 const double a0 = PhysConst::alpha;
158 if (v.empty()) {
159 // If v is empty, means it should be {1,1,1,1,...}
160 v.resize(rgrid.num_points(), 1.0);
161 }
162
163 for (auto i = 0ul; i < rgrid.num_points(); ++i) {
164 auto exp = a * a0 * std::exp(-b * rgrid.r(i) / a0);
165 v[i] *= exp;
166 }
167 return v;
168 }
169};
170
171//==============================================================================
172//! Magnetic loop vacuum polarisation (Uehling vertex)
173class MLVP final : public TensorOperator {
174
175public:
176 //! rN is nuclear (charge) radius, in atomic units
177 MLVP(const DiracOperator::hfs *const h0, const Grid &rgrid, double rN)
178 : TensorOperator(h0->rank(), h0->parity() == 1 ? Parity::even : Parity::odd,
179 h0->getc(), MLVP_func(rgrid, rN, h0->getv()),
180 h0->imaginaryQ() ? Realness::imaginary : Realness::real,
181 h0->freqDependantQ()),
182 m_h0(*h0) {}
183
184 std::string name() const override final { return "MLVP"; }
185 std::string units() const override final { return m_h0.units(); }
186
187 double angularF(const int ka, const int kb) const override final {
188 return m_h0.angularF(ka, kb);
189 }
190 double angularCff(int ka, int kb) const override final {
191 return m_h0.angularCff(ka, kb);
192 }
193 double angularCgg(int ka, int kb) const override final {
194 return m_h0.angularCgg(ka, kb);
195 }
196 double angularCfg(int ka, int kb) const override final {
197 return m_h0.angularCfg(ka, kb);
198 }
199 double angularCgf(int ka, int kb) const override final {
200 return m_h0.angularCgf(ka, kb);
201 }
202
203public:
204 // Store a copy?
206
207public:
208 // public since may as well be
209 // This multiplies the original operator by Z(r), which is the MLVP correction
210 static std::vector<double> MLVP_func(const Grid &rgrid, double rN,
211 std::vector<double> v = {}) {
212 // rN must be in atomic units
213
214 if (v.empty()) {
215 // If v is empty, means it should be {1,1,1,1,...}
216 v.resize(rgrid.num_points(), 1.0);
217 }
218
219 // compute the integral at each radial grid point
220 for (auto i = 0ul; i < rgrid.num_points(); ++i) {
221 const auto Z_mvlp = FGRP::Q_MLVP(rgrid.r(i), rN);
222 // multiply the operator
223 v[i] *= Z_mvlp;
224 }
225
226 return v;
227 }
228};
229
230//==============================================================================
231inline std::unique_ptr<DiracOperator::TensorOperator>
232generate_MLVP(const IO::InputBlock &input, const Wavefunction &wf) {
233 using namespace DiracOperator;
234 input.check(
235 {{"rN",
236 "Nuclear radius (in fm), for finite-nuclear size "
237 "correction to Uehling loop. If not given, taken from wavefunction."},
238 {"hfs_options{}",
239 "Options for hyperfine operator that sits inside the MLVP operator. "
240 " [see `ampsci -o hfs`]."}});
241 if (input.has_option("help")) {
242 return nullptr;
243 }
244
245 // 1. generate regular hfs operator
246 const auto t_options = input.getBlock("hfs_options");
247 auto oper_options = t_options ? *t_options : IO::InputBlock{};
248
249 // 2. MLVP
250 const auto rN_fm =
251 input.get("rN", std::sqrt(5.0 / 3.0) * wf.nucleus().r_rms());
252
253 if (oper_options.get("print", true)) {
254 std::cout << "\nGenerate MLVP operator for hfs, with parameters:\n";
255 if (rN_fm != 0.0)
256 std::cout << "Using finite nuclear charge in Uehling loop, with rN="
257 << rN_fm << " fm.\n";
258 else
259 std::cout << "Using pointlike Uehling loop.\n";
260 }
261
262 const auto h = generate_hfs(oper_options, wf);
263
264 const auto r_N_au = rN_fm / PhysConst::aB_fm;
265
266 return std::make_unique<MLVP>(dynamic_cast<DiracOperator::hfs *>(h.get()),
267 wf.grid(), r_N_au);
268}
269
270} // namespace DiracOperator
Magnetic loop vacuum polarisation (Uehling vertex)
Definition QED.hpp:173
std::string units() const override final
Returns units of operator as a string (usually au, may be MHz, etc.)
Definition QED.hpp:185
std::string name() const override final
Returns "name" of operator (e.g., 'E1')
Definition QED.hpp:184
double angularCgf(int ka, int kb) const override final
Angular coefficient C_gf for the g_a*f_b term of the radial integral.
Definition QED.hpp:199
double angularCff(int ka, int kb) const override final
Angular coefficient C_ff for the f_a*f_b term of the radial integral.
Definition QED.hpp:190
double angularCgg(int ka, int kb) const override final
Angular coefficient C_gg for the g_a*g_b term of the radial integral.
Definition QED.hpp:193
MLVP(const DiracOperator::hfs *const h0, const Grid &rgrid, double rN)
rN is nuclear (charge) radius, in atomic units
Definition QED.hpp:177
double angularCfg(int ka, int kb) const override final
Angular coefficient C_fg for the f_a*g_b term of the radial integral.
Definition QED.hpp:196
double angularF(const int ka, const int kb) const override final
Angular factor A_ab linking the radial integral to the RME.
Definition QED.hpp:187
Rank-0 (scalar) tensor operator; derives from TensorOperator with k=0.
Definition TensorOperator.hpp:560
General tensor operator (virtual base class); all single-particle (one-body) tenosor operators derive...
Definition TensorOperator.hpp:197
virtual double angularCgf(int, int) const
Angular coefficient C_gf for the g_a*f_b term of the radial integral.
Definition TensorOperator.hpp:380
bool freqDependantQ() const
Returns true if the operator is frequency-dependent (requires updateFrequency() calls).
Definition TensorOperator.hpp:260
bool imaginaryQ() const
returns true if operator is imaginary (has imag MEs)
Definition TensorOperator.hpp:323
virtual std::string units() const
Returns units of operator as a string (usually au, may be MHz, etc.)
Definition TensorOperator.hpp:341
int parity() const
returns parity, as integer (+1 or -1)
Definition TensorOperator.hpp:329
virtual double angularF(const int, const int) const =0
Angular factor A_ab linking the radial integral to the RME.
virtual double angularCfg(int, int) const
Angular coefficient C_fg for the f_a*g_b term of the radial integral.
Definition TensorOperator.hpp:378
virtual std::string name() const
Returns "name" of operator (e.g., 'E1')
Definition TensorOperator.hpp:339
double getc() const
Returns the "overall" constant c.
Definition TensorOperator.hpp:320
virtual double angularCgg(int, int) const
Angular coefficient C_gg for the g_a*g_b term of the radial integral.
Definition TensorOperator.hpp:376
virtual double angularCff(int kappa_a, int kappa_b) const
Angular coefficient C_ff for the f_a*f_b term of the radial integral.
Definition TensorOperator.hpp:371
int rank() const
Rank k of operator.
Definition TensorOperator.hpp:326
const std::vector< double > & getv() const
Returns a const ref to the stored vector v.
Definition TensorOperator.hpp:317
Effective VertexQED operator.
Definition QED.hpp:103
double angularCff(int ka, int kb) const override final
Angular coefficient C_ff for the f_a*f_b term of the radial integral.
Definition QED.hpp:123
static std::vector< double > vertex_func(const Grid &rgrid, double a, double b, std::vector< double > v={})
Takes existing radial vector, multiplies by:
Definition QED.hpp:154
double angularCgg(int ka, int kb) const override final
Angular coefficient C_gg for the g_a*g_b term of the radial integral.
Definition QED.hpp:126
std::string units() const override final
Returns units of operator as a string (usually au, may be MHz, etc.)
Definition QED.hpp:117
double angularCfg(int ka, int kb) const override final
Angular coefficient C_fg for the f_a*g_b term of the radial integral.
Definition QED.hpp:129
std::string name() const override final
Returns "name" of operator (e.g., 'E1')
Definition QED.hpp:114
static double a(double z)
Fitting factor for hyperfine. Default a(Z)
Definition QED.hpp:145
double angularCgf(int ka, int kb) const override final
Angular coefficient C_gf for the g_a*f_b term of the radial integral.
Definition QED.hpp:132
double angularF(const int ka, const int kb) const override final
Angular factor A_ab linking the radial integral to the RME.
Definition QED.hpp:119
Flambaum-Ginges radiative potential operator.
Definition QED.hpp:16
virtual double radialIntegral(const DiracSpinor &Fa, const DiracSpinor &Fb) const override final
Radial integral R_ab, defined by RME = angularF(a,b) * radialIntegral(a,b).
Definition QED.hpp:35
std::string units() const override final
Returns units of operator as a string (usually au, may be MHz, etc.)
Definition QED.hpp:21
std::string name() const override final
Returns "name" of operator (e.g., 'E1')
Definition QED.hpp:20
virtual DiracSpinor radial_rhs(const int kappa_a, const DiracSpinor &Fb) const override final
Computes the right-hand spinor dF_b for the radial integral.
Definition QED.hpp:23
Generalised hyperfine-structure operator, including relevant nuclear moment.
Definition hfs.hpp:229
Stores radial Dirac spinor: F_nk = (f, g)
Definition DiracSpinor.hpp:42
Holds grid, including type + Jacobian (dr/du)
Definition Grid.hpp:31
const std::vector< double > & r() const
Grid points, r.
Definition Grid.hpp:75
auto num_points() const
Number of grid points.
Definition Grid.hpp:64
Holds list of Options, and a list of other InputBlocks. Can be initialised with a list of options,...
Definition InputBlock.hpp:153
bool check(std::initializer_list< std::string > blocks, const std::vector< std::pair< std::string, std::string > > &list, bool print=false) const
Check all the options and blocks in this; if any of them are not present in 'list',...
Definition InputBlock.hpp:606
std::optional< InputBlock > getBlock(std::string_view name) const
Returns optional InputBlock. Contains InputBlock if block of given name exists; empty otherwise.
Definition InputBlock.hpp:454
bool has_option(std::string_view key) const
Check is option is present (even if not set) in current block.
Definition InputBlock.hpp:212
T get(std::string_view key, T default_value) const
If 'key' exists in the options, returns value. Else, returns default_value. Note: If two keys with sa...
Definition InputBlock.hpp:428
Constructs and stores the Flambaum-Ginges QED Radiative Potential.
Definition RadPot.hpp:16
std::vector< double > Vel(int l=0) const
Returns entire electric part of potential.
Definition RadPot.cpp:155
std::vector< double > Hmag(int) const
Returns H_mag (magnetic self-energy form vactor)
Definition RadPot.cpp:164
Stores Wavefunction (set of valence orbitals, grid, HF etc.)
Definition Wavefunction.hpp:37
const Grid & grid() const
Returns a const reference to the radial grid.
Definition Wavefunction.hpp:82
int Znuc() const
Nuclear charge, Z.
Definition Wavefunction.hpp:99
const std::string & run_label() const
Atomic symbol, including core ionisation degree and run_label.
Definition Wavefunction.hpp:205
const Nuclear::Nucleus & nucleus() const
Returns Nuclear::nucleus object (contains nuc. parameters)
Definition Wavefunction.hpp:97
Dirac operators: TensorOperator base class and derived implementations for single-particle (one-body)...
Definition GenerateOperator.cpp:3
Parity
Parity of operator.
Definition TensorOperator.hpp:57
Realness
Specifies whether an operator's matrix elements are real or imaginary.
Definition TensorOperator.hpp:69
double Q_MLVP(double r, double rN)
Magnetic-loop vacuum polarisation, includes finite-nuclear size.
Definition FGRadPot.cpp:280
constexpr double alpha
Fine-structure constant: alpha = 1/137.035 999 177(21) [CODATA 2022].
Definition PhysConst_constants.hpp:24
namespace qip::overloads provides operator overloads for std::vector
Definition Vector.hpp:451