ampsci
High-precision calculations for one- and two-valence atomic systems
p.hpp
1#pragma once
2#include "DiracOperator/TensorOperator.hpp"
3#include "IO/InputBlock.hpp"
4#include "Wavefunction/Wavefunction.hpp"
5#include "qip/Vector.hpp"
6
7namespace DiracOperator {
8
9//==============================================================================
10
11//! Momentum operator p = -i grad
12class p final : public TensorOperator {
13public:
14 p() : TensorOperator(1, Parity::odd, 1.0, {}, Realness::imaginary) {}
15 std::string name() const override final { return "p"; }
16 std::string units() const override final { return "i au"; }
17
18 double angularF(const int ka, const int kb) const override final {
19 return -1.0 * Angular::Ck_kk(1, ka, kb);
20 }
21
22 double angularCff(int, int) const override final { return 1.0; }
23 double angularCgg(int, int) const override final { return 1.0; }
24 double angularCfg(int, int) const override final { return 0.0; }
25 double angularCgf(int, int) const override final { return 0.0; }
26
27 virtual DiracSpinor radial_rhs(const int kappa_a,
28 const DiracSpinor &Fb) const override final {
29 // {(f' + eta/r f) , (g' + xi/r g)}
30 const auto kappa_b = Fb.kappa();
31 DiracSpinor dF(0, kappa_a, Fb.grid_sptr());
32
33 // const double eta = (kappa_a == kappa_b + 1) ? kappa_a : -kappa_b;
34 // const double xi = (kappa_a == kappa_b + 1) ? kappa_b : -kappa_a;
35
36 const auto la = Angular::l_k(kappa_a);
37 const auto lb = Fb.l();
38 const auto lta = Angular::l_k(-kappa_a);
39 const auto ltb = Angular::l_k(-kappa_b);
40 const double eta = (la == lb - 1) ? lb : -lb - 1;
41 const double xi = (lta == ltb - 1) ? ltb : -ltb - 1;
42
43 const auto &gr = Fb.grid();
44 const auto df = NumCalc::derivative(Fb.f(), gr.drdu(), gr.du(), 1);
45 const auto dg = NumCalc::derivative(Fb.g(), gr.drdu(), gr.du(), 1);
46
47 using namespace qip::overloads;
48 dF.f() = df + eta * (Fb.f() / gr.r());
49 dF.g() = dg + xi * (Fb.g() / gr.r());
50 dF.max_pt() = Fb.max_pt(); //?
51 return dF;
52 }
53
54 virtual double radialIntegral(const DiracSpinor &Fa,
55 const DiracSpinor &Fb) const override final {
56 // nb: faster not to do this, but nicer this way
57 return Fa * radial_rhs(Fa.kappa(), Fb);
58 }
59};
60
61//==============================================================================
62inline std::unique_ptr<DiracOperator::TensorOperator>
63generate_p(const IO::InputBlock &input, const Wavefunction &) {
64 input.check({{"", "no input"}});
65 if (input.has_option("help")) {
66 return nullptr;
67 }
68 return std::make_unique<DiracOperator::p>();
69}
70
71} // namespace DiracOperator
General tensor operator (virtual base class); all single-particle (one-body) tenosor operators derive...
Definition TensorOperator.hpp:197
Momentum operator p = -i grad.
Definition p.hpp:12
double angularCff(int, int) const override final
Angular coefficient C_ff for the f_a*f_b term of the radial integral.
Definition p.hpp:22
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 p.hpp:27
double angularCgg(int, int) const override final
Angular coefficient C_gg for the g_a*g_b term of the radial integral.
Definition p.hpp:23
double angularCgf(int, int) const override final
Angular coefficient C_gf for the g_a*f_b term of the radial integral.
Definition p.hpp:25
std::string units() const override final
Returns units of operator as a string (usually au, may be MHz, etc.)
Definition p.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 p.hpp:54
double angularCfg(int, int) const override final
Angular coefficient C_fg for the f_a*g_b term of the radial integral.
Definition p.hpp:24
std::string name() const override final
Returns "name" of operator (e.g., 'E1')
Definition p.hpp:15
double angularF(const int ka, const int kb) const override final
Angular factor A_ab linking the radial integral to the RME.
Definition p.hpp:18
Stores radial Dirac spinor: F_nk = (f, g)
Definition DiracSpinor.hpp:42
auto max_pt() const
Effective size(); index after last non-zero point (index for f[i])
Definition DiracSpinor.hpp:145
const std::vector< double > & f() const
Upper (large) radial component function, f.
Definition DiracSpinor.hpp:126
int kappa() const
Dirac quantum number, kappa.
Definition DiracSpinor.hpp:88
const std::vector< double > & g() const
Lower (small) radial component function, g.
Definition DiracSpinor.hpp:133
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
bool has_option(std::string_view key) const
Check is option is present (even if not set) in current block.
Definition InputBlock.hpp:212
Stores Wavefunction (set of valence orbitals, grid, HF etc.)
Definition Wavefunction.hpp:37
constexpr int l_k(int ka)
returns l given kappa
Definition Wigner369j.hpp:44
double Ck_kk(int k, int ka, int kb)
Reduced relativistic angular ME: <ka||C^k||kb>. Takes kappa values.
Definition Wigner369j.hpp:486
Dirac operators: TensorOperator base class and derived implementations for single-particle (one-body)...
Definition GenerateOperator.cpp:3
namespace qip::overloads provides operator overloads for std::vector
Definition Vector.hpp:451