2 #include "Angular/Wigner369j.hpp"
3 #include "Maths/Grid.hpp"
4 #include "Maths/NumCalc_quadIntegrate.hpp"
5 #include "Maths/SphericalBessel.hpp"
6 #include "Physics/NuclearPotentials.hpp"
7 #include "Physics/PhysConst_constants.hpp"
8 #include "Wavefunction/DiracSpinor.hpp"
9 #include "qip/Vector.hpp"
17 enum class Parity { even, odd, blank };
18 enum class Realness { real, imaginary, blank };
28 IntM4x4(
int in00,
int in01,
int in10,
int in11)
29 : e00(in00), e01(in01), e10(in10), e11(in11) {}
31 const int e00, e01, e10, e11;
41 double ff{0.0}, fg{0.0}, gf{0.0}, gg{0.0};
45 constexpr SpinorMatrix(
double iff,
double ifg,
double igf,
double igg)
46 : ff(iff), fg(ifg), gf(igf), gg(igg) {}
47 constexpr SpinorMatrix() {}
49 constexpr SpinorMatrix &
operator+=(
const SpinorMatrix &rhs) {
56 constexpr SpinorMatrix &operator-=(
const SpinorMatrix &rhs) {
63 friend SpinorMatrix operator+(SpinorMatrix lhs,
const SpinorMatrix &rhs) {
66 friend SpinorMatrix operator-(SpinorMatrix lhs,
const SpinorMatrix &rhs) {
69 constexpr SpinorMatrix &operator*=(
double x) {
76 friend SpinorMatrix operator*(SpinorMatrix lhs,
double x) {
return lhs *= x; }
77 friend SpinorMatrix operator*(
double x, SpinorMatrix rhs) {
return rhs *= x; }
89 mFa.f() += fg * Fa.
g();
93 mFa.g() += gf * Fa.
f();
113 const std::vector<double> &inv = {},
int diff_order = 0,
114 Realness RorI = Realness::real,
bool freq_dep =
false)
117 m_diff_order(diff_order),
119 m_freqDependantQ(freq_dep),
120 m_constant(constant),
131 bool m_freqDependantQ{
false};
136 std::vector<double> m_vec;
139 bool freqDependantQ()
const {
return m_freqDependantQ; }
143 bool isZero(
const int ka,
int kb)
const;
146 bool selectrion_rule(
int twoJA,
int piA,
int twoJB,
int piB)
const {
147 if (twoJA == twoJB && twoJA == 0.0)
155 return (m_parity == Parity::even) == (piA == piB);
162 void scale(
double lambda);
165 const std::vector<double> &
getv()
const {
return m_vec; }
167 double getc()
const {
return m_constant; }
168 int get_d_order()
const {
return m_diff_order; }
171 bool imaginaryQ()
const {
return (opC == Realness::imaginary); }
172 int rank()
const {
return m_rank; }
174 int parity()
const {
return (m_parity == Parity::even) ? 1 : -1; }
178 const auto sra_i = imaginaryQ() ? -1 : 1;
184 virtual std::string
name()
const {
return "Operator"; };
186 virtual std::string
units()
const {
return "au"; };
191 virtual double angularCff(
int ,
int )
const {
return 1.0; }
192 virtual double angularCgg(
int,
int)
const {
return 1.0; }
193 virtual double angularCfg(
int,
int)
const {
return 0.0; }
194 virtual double angularCgf(
int,
int)
const {
return 0.0; }
199 virtual double angularF(
const int,
const int)
const = 0;
206 virtual double radialIntegral(
const DiracSpinor &Fa,
210 double rme3js(
const int twoja,
const int twojb,
int two_mb = 1,
211 int two_q = 0)
const;
225 std::optional<int> two_ma = std::nullopt,
226 std::optional<int> two_mb = std::nullopt,
227 std::optional<int> two_q = std::nullopt)
const;
236 const std::vector<double> &in_v = {},
237 const IntM4x4 &in_g = {1, 0, 0, 1},
int in_diff = 0,
238 Realness rori = Realness::real)
252 ScalarOperator(
double in_coef,
const std::vector<double> &in_v = {})
260 virtual double angularF(
const int ka,
const int kb)
const override {
264 return (std::abs(ka) == std::abs(kb)) ? std::sqrt(2.0 * std::abs(ka)) : 0.0;
268 const double c_ff, c_fg, c_gf, c_gg;
271 double virtual angularCff(
int,
int)
const override {
return c_ff; }
272 double virtual angularCgg(
int,
int)
const override {
return c_gg; }
273 double virtual angularCfg(
int,
int)
const override {
return c_fg; }
274 double virtual angularCgf(
int,
int)
const override {
return c_gf; }
284 double virtual angularCff(
int,
int)
const override final {
return 0.0; }
285 double virtual angularCgg(
int,
int)
const override final {
return 0.0; }
286 double virtual angularCfg(
int,
int)
const override final {
return 0.0; }
287 double virtual angularCgf(
int,
int)
const override final {
return 0.0; }
Speacial operator: 0.
Definition: TensorOperator.hpp:279
Speacial case for scalar operator.
Definition: TensorOperator.hpp:233
virtual double angularF(const int ka, const int kb) const override
angularF: links radiation integral to RME. RME = <a||h||b> = angularF(a,b) * radial_int(a,...
Definition: TensorOperator.hpp:260
General operator (virtual base class); operators derive from this.
Definition: TensorOperator.hpp:110
int symm_sign(const DiracSpinor &Fa, const DiracSpinor &Fb) const
returns relative sign between <a||x||b> and <b||x||a>
Definition: TensorOperator.hpp:177
bool imaginaryQ() const
returns true if operator is imaginary (has imag MEs)
Definition: TensorOperator.hpp:171
virtual std::string units() const
Returns units of operator (usually au, may be MHz, etc.)
Definition: TensorOperator.hpp:186
int parity() const
returns parity, as integer (+1 or -1)
Definition: TensorOperator.hpp:174
virtual double angularF(const int, const int) const =0
angularF: links radiation integral to RME. RME = <a||h||b> = angularF(a,b) * radial_int(a,...
const std::vector< double > & getv() const
Returns a const ref to vector v.
Definition: TensorOperator.hpp:165
virtual std::string name() const
Returns "name" of operator (e.g., 'E1')
Definition: TensorOperator.hpp:184
double getc() const
Returns a const ref to constant c.
Definition: TensorOperator.hpp:167
virtual void updateFrequency(const double)
Update frequency for frequency-dependant operators.
Definition: TensorOperator.hpp:159
Stores radial Dirac spinor: F_nk = (f, g)
Definition: DiracSpinor.hpp:41
const std::vector< double > & f() const
Upper (large) radial component function, f.
Definition: DiracSpinor.hpp:117
const std::vector< double > & g() const
Lower (small) radial component function, g.
Definition: DiracSpinor.hpp:124
friend FMT_CONSTEXPR text_style fg(detail::color_type foreground) noexcept
Definition: color.h:322
constexpr int neg1pow_2(int two_a)
Evaluates (-1)^{two_a/2} (for integer a; two_a is even)
Definition: Wigner369j.hpp:121
constexpr int triangle(int j1, int j2, int J)
Returns 1 if triangle rule is satisfied. nb: works with j OR twoj!
Definition: Wigner369j.hpp:131
Dirac Operators: General + derived.
Definition: GenerateOperator.cpp:12
namespace qip::overloads provides operator overloads for std::vector
Definition: Vector.hpp:450
std::vector< T > & operator+=(std::vector< T > &a, const std::vector< T > &b)
Provide addition of two vectors:
Definition: Vector.hpp:454
4x4 Integer matrix (for Gamma/Pauli). Can be real or imag. Not mixed.
Definition: TensorOperator.hpp:27