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