2#include "Angular/Wigner369j.hpp"
3#include "Maths/Grid.hpp"
4#include "Maths/NumCalc_quadIntegrate.hpp"
5#include "Maths/SphericalBessel.hpp"
6#include "Physics/PhysConst_constants.hpp"
7#include "Potentials/NuclearPotentials.hpp"
8#include "Wavefunction/DiracSpinor.hpp"
9#include "qip/Vector.hpp"
57enum class Parity { even, odd, Error };
219 const std::vector<double> &vec = {},
220 Realness RorI = Realness::real,
bool freq_dep =
false,
221 bool odd_in_omega =
false)
225 m_freqDependantQ(freq_dep),
226 m_oddInOmegaQ(odd_in_omega),
227 m_constant(constant),
254 bool m_freqDependantQ{
false};
255 bool m_oddInOmegaQ{
false};
260 std::vector<double> m_vec;
276 double omega()
const {
return m_omega; }
280 bool isZero(
int ka,
int kb)
const;
286 if (twoJA == twoJB && twoJA == 0.0)
292 return (m_parity == Parity::even) == (piA == piB);
314 if (!m_freqDependantQ)
317 <<
"Must reimplement updateFrequency() for freq. dep operators!\n";
318 std::cout << this->
name() <<
"\n";
332 std::cout <<
"Must reimplement updateRank() is needed\n";
333 std::cout << this->
name() <<
"\n";
338 const std::vector<double> &
getv()
const {
return m_vec; }
341 double getc()
const {
return m_constant; }
344 bool imaginaryQ()
const {
return (m_Realness == Realness::imaginary); }
347 int rank()
const {
return m_rank; }
350 int parity()
const {
return (m_parity == Parity::even) ? 1 : -1; }
360 virtual std::string
name()
const {
return "Operator"; };
362 virtual std::string
units()
const {
return "au"; };
393 (void)kappa_a, (
void)kappa_b;
427 double angularCxy(uint8_t x, uint8_t y,
int kappa_a,
int kappa_b)
const {
428 assert((x <= 1 && y <= 1) &&
"x and y must be 0 or 1 in angularCxy");
429 return x == 0 ? (y == 0 ?
angularCff(kappa_a, kappa_b) :
455 virtual double angularF(
const int,
const int)
const = 0;
476 virtual std::unique_ptr<TensorOperator>
clone()
const {
return nullptr; }
554 double rme3js(
int twoja,
int twojb,
int two_mb = 1,
int two_q = 0)
const;
558 int two_q = 0)
const {
574 std::optional<int> two_ma = std::nullopt,
575 std::optional<int> two_mb = std::nullopt,
576 std::optional<int> two_q = std::nullopt)
const;
602 const std::vector<double> &in_v = {},
603 const std::array<int, 4> &in_g = {1, 0, 0, 1},
605 : TensorOperator(0, pi, in_coef, in_v, rori),
612 virtual double angularF(
const int ka,
const int kb)
const override {
616 return (std::abs(ka) == std::abs(kb)) ? std::sqrt(2.0 * std::abs(ka)) : 0.0;
620 const double c_ff, c_fg, c_gf, c_gg;
623 double virtual angularCff(
int,
int)
const override {
return c_ff; }
624 double virtual angularCgg(
int,
int)
const override {
return c_gg; }
625 double virtual angularCfg(
int,
int)
const override {
return c_fg; }
626 double virtual angularCgf(
int,
int)
const override {
return c_gf; }
636 double angularCff(
int,
int)
const override final {
return 0.0; }
637 double angularCgg(
int,
int)
const override final {
return 0.0; }
638 double angularCfg(
int,
int)
const override final {
return 0.0; }
639 double angularCgf(
int,
int)
const override final {
return 0.0; }
650double Pab(
double pm,
const std::vector<double> &t,
const DiracSpinor &Fa,
657double Rab(
double pm,
const std::vector<double> &t,
const DiracSpinor &Fa,
Speacial operator: 0.
Definition TensorOperator.hpp:631
double angularCgg(int, int) const override final
Angular coefficient C_gg for the g_a*g_b term of the radial integral.
Definition TensorOperator.hpp:637
double angularCff(int, int) const override final
Angular coefficient C_ff for the f_a*f_b term of the radial integral.
Definition TensorOperator.hpp:636
double angularCfg(int, int) const override final
Angular coefficient C_fg for the f_a*g_b term of the radial integral.
Definition TensorOperator.hpp:638
double angularCgf(int, int) const override final
Angular coefficient C_gf for the g_a*f_b term of the radial integral.
Definition TensorOperator.hpp:639
Rank-0 (scalar) tensor operator; derives from TensorOperator with k=0.
Definition TensorOperator.hpp:598
ScalarOperator(Parity pi, double in_coef, const std::vector< double > &in_v={}, const std::array< int, 4 > &in_g={1, 0, 0, 1}, Realness rori=Realness::real)
General scalar operator constructor. in_g = {C_ff, C_fg, C_gf, C_gg}.
Definition TensorOperator.hpp:601
virtual double angularCgf(int, int) const override
Angular coefficient C_gf for the g_a*f_b term of the radial integral.
Definition TensorOperator.hpp:626
virtual double angularCfg(int, int) const override
Angular coefficient C_fg for the f_a*g_b term of the radial integral.
Definition TensorOperator.hpp:625
virtual double angularCgg(int, int) const override
Angular coefficient C_gg for the g_a*g_b term of the radial integral.
Definition TensorOperator.hpp:624
virtual double angularF(const int ka, const int kb) const override
Angular factor A_ab linking the radial integral to the RME.
Definition TensorOperator.hpp:612
virtual double angularCff(int, int) const override
Angular coefficient C_ff for the f_a*f_b term of the radial integral.
Definition TensorOperator.hpp:623
General tensor operator (virtual base class); all single-particle (one-body) tenosor operators derive...
Definition TensorOperator.hpp:198
double omega() const
Returns the current frequency set by the last updateFrequency() call. Zero for frequency-independent ...
Definition TensorOperator.hpp:276
double fullME(const DiracSpinor &Fa, const DiracSpinor &Fb, std::optional< int > two_ma=std::nullopt, std::optional< int > two_mb=std::nullopt, std::optional< int > two_q=std::nullopt) const
Returns "full" matrix element, for optional (ma, mb, q) [taken as int 2*]. If not specified,...
Definition TensorOperator.cpp:67
virtual double angularCgf(int, int) const
Angular coefficient C_gf for the g_a*f_b term of the radial integral.
Definition TensorOperator.hpp:401
bool freqDependantQ() const
Returns true if the operator is frequency-dependent (requires updateFrequency() calls).
Definition TensorOperator.hpp:265
virtual std::unique_ptr< TensorOperator > clone() const
Creates a polymorphic copy of the operator at its current state, or nullptr if cloning is not support...
Definition TensorOperator.hpp:476
int symm_sign(const DiracSpinor &Fa, const DiracSpinor &Fb) const
returns relative sign between <a||x||b> and <b||x||a>
Definition TensorOperator.hpp:353
bool imaginaryQ() const
returns true if operator is imaginary (has imag MEs)
Definition TensorOperator.hpp:344
virtual std::string units() const
Returns units of operator as a string (usually au, may be MHz, etc.)
Definition TensorOperator.hpp:362
int parity() const
returns parity, as integer (+1 or -1)
Definition TensorOperator.hpp:350
double h_minus_sign() const
Sign of the operator at -|omega| relative to that at +|omega|: h(-|omega|) = h_minus_sign() * h(+|ome...
Definition TensorOperator.hpp:272
double rme3js(const DiracSpinor &Fa, const DiracSpinor &Fb, int two_mb=1, int two_q=0) const
Overload of rme3js taking DiracSpinors.
Definition TensorOperator.hpp:557
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:399
double matel_factor(MatrixElementType type, int twoJa, int twoJb) const
Returns the factor to convert a reduced ME to a different form (Reduced, Stretched,...
Definition TensorOperator.cpp:84
virtual std::string name() const
Returns "name" of operator (e.g., 'E1')
Definition TensorOperator.hpp:360
double getc() const
Returns the "overall" constant c.
Definition TensorOperator.hpp:341
double reducedME(const DiracSpinor &Fa, const DiracSpinor &Fb) const
Returns the reduced matrix element <a||h||b> = A_ab * R_ab.
Definition TensorOperator.cpp:62
virtual double angularCgg(int, int) const
Angular coefficient C_gg for the g_a*g_b term of the radial integral.
Definition TensorOperator.hpp:397
bool selectrion_rule(int twoJA, int piA, int twoJB, int piB) const
Returns true if the matrix element is non-zero by angular momentum and parity selection rules (argume...
Definition TensorOperator.hpp:285
DiracSpinor reduced_lhs(const int ka, const DiracSpinor &Fb) const
As reduced_rhs but for the conjugate direction; Fb * reduced_lhs(ka, Fb) = <b||h||a>.
Definition TensorOperator.cpp:55
double angularCxy(uint8_t x, uint8_t y, int kappa_a, int kappa_b) const
Dispatches to angularCff/fg/gf/gg based on component indices x, y.
Definition TensorOperator.hpp:427
double matel_factor(MatrixElementType type, const DiracSpinor &Fa, const DiracSpinor &Fb) const
Overload of matel_factor taking DiracSpinors.
Definition TensorOperator.hpp:582
double rme3js(int twoja, int twojb, int two_mb=1, int two_q=0) const
3j-symbol factor linking the full ME to the RME.
Definition TensorOperator.cpp:40
bool isZero(int ka, int kb) const
Returns true if <a|h|b> = 0 by rank/parity selection rules.
Definition TensorOperator.cpp:18
virtual DiracSpinor radial_rhs(const int kappa_a, const DiracSpinor &Fb) const
Computes the right-hand spinor dF_b for the radial integral.
Definition TensorOperator.cpp:104
virtual void updateRank(int)
Definition TensorOperator.hpp:331
TensorOperator(int rank_k, Parity pi, double constant=1.0, const std::vector< double > &vec={}, Realness RorI=Realness::real, bool freq_dep=false, bool odd_in_omega=false)
Constructs a specific tensor operator. Called by derived classes.
Definition TensorOperator.hpp:218
virtual double radialIntegral(const DiracSpinor &Fa, const DiracSpinor &Fb) const
Radial integral R_ab, defined by RME = angularF(a,b) * radialIntegral(a,b).
Definition TensorOperator.cpp:143
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:392
int rank() const
Rank k of operator.
Definition TensorOperator.hpp:347
DiracSpinor reduced_rhs(const int ka, const DiracSpinor &Fb) const
Returns angularF(ka,kb) * radial_rhs(ka,Fb); spinor-valued RME action on Fb, used in perturbation the...
Definition TensorOperator.cpp:50
virtual void updateFrequency(const double)
Updates the operator for a new frequency omega.
Definition TensorOperator.hpp:313
const std::vector< double > & getv() const
Returns a const ref to the stored vector v.
Definition TensorOperator.hpp:338
Stores radial Dirac spinor: F_nk = (f, g)
Definition DiracSpinor.hpp:55
int twoj() const
2j (twice the total angular momentum)
Definition DiracSpinor.hpp:121
constexpr int neg1pow_2(int two_a)
Evaluates (-1)^{two_a/2} (for integer a; two_a is even)
Definition Wigner369j.hpp:239
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:249
Dirac operators: TensorOperator base class and derived implementations for single-particle (one-body)...
Definition SecondOrder.hpp:7
void Pab_rhs(double pm, const std::vector< double > &t, DiracSpinor *dF, const DiracSpinor &Fb, double a)
Pab_rhs function: dF_ab += A * t(r) * (g, pm*f) , pm=+/-1 (usually). NOTE: uses +=,...
Definition TensorOperator.cpp:223
double Vab(const std::vector< double > &t, const DiracSpinor &Fa, const DiracSpinor &Fb)
Vab function: Int[ (fa*gb ) * t(r) , dr].
Definition TensorOperator.cpp:242
double Gab(const std::vector< double > &t, const DiracSpinor &Fa, const DiracSpinor &Fb)
Gab function: Int[ (ga*gb ) * t(r) , dr].
Definition TensorOperator.cpp:261
double Rab(double pm, const std::vector< double > &t, const DiracSpinor &Fa, const DiracSpinor &Fb)
Rab function: Int[ (fa*fb + pm*ga*gb) * t(r) , dr]. pm = +/-1 (usually)
Definition TensorOperator.cpp:211
double Wab(const std::vector< double > &t, const DiracSpinor &Fa, const DiracSpinor &Fb)
Wab function: Int[ (ga*fb ) * t(r) , dr].
Definition TensorOperator.cpp:252
Realness parse_Realness(const std::string &s)
Convert string to Realness.
Definition TensorOperator.cpp:385
MatrixElementType
Type of matrix element returned.
Definition TensorOperator.hpp:82
void Rab_rhs(double pm, const std::vector< double > &t, DiracSpinor *dF, const DiracSpinor &Fb, double a)
Rab_rhs function: dF_ab += A * t(r) * (f, pm*g) , pm=+/-1 (usually). NOTE: uses +=,...
Definition TensorOperator.cpp:233
Parity
Parity of operator.
Definition TensorOperator.hpp:57
Parity parse_Parity(const std::string &s)
Convert string to Parity.
Definition TensorOperator.cpp:362
void Gab_rhs(const std::vector< double > &t, DiracSpinor *dF, const DiracSpinor &Fb, double a)
Gab_rhs function: dF += a * t(r) * (0, g_b). NOTE: uses +=, so can combine.
Definition TensorOperator.cpp:270
Realness
Specifies whether an operator's matrix elements are real or imaginary.
Definition TensorOperator.hpp:70
double Pab(double pm, const std::vector< double > &t, const DiracSpinor &Fa, const DiracSpinor &Fb)
Pab function: Int[ (fa*gb + pm*ga*fb) * t(r) , dr]. pm = +/-1 (usually)
Definition TensorOperator.cpp:197
MatrixElementType parse_MatrixElementType(const std::string &s)
Convert string to MatrixElementType.
Definition TensorOperator.cpp:408
Used to pass generic parameters to update() function.
Definition TensorOperator.hpp:239