ampsci
High-precision calculations for one- and two-valence atomic systems
Angular::SixJTable

ok

Lookup table for Wigner 6j symbols.

Pre-computes and caches Wigner 6j symbols \(\sixj{a/2}{b/2}{c/2}{d/2}{e/2}{f/2}\). All public functions accept arguments as \(2j\) or \(2k\) (integers), so that half-integer spins are handled exactly.

Storage exploits symmetry: the six entries of each symbol are permuted into a canonical "normal order" before lookup, so each physically distinct symbol is stored only once.

Note
  • Call fill() (or the constructor) with the maximum \(2j\) or \(k\) that will be needed; the table can be extended at any time.
  • Requesting a symbol outside the stored range returns 0 without warning.
  • Non-mutable accessors are thread-safe once the table is fully built.
Warning
Symbols are stored up to the value passed to fill(); calls with larger arguments silently return 0.

#include <SixJTable.hpp>

Public Member Functions

 SixJTable ()=default
 Constructs an empty table; extend later with fill() or get().
 
 SixJTable (int max_2j_k)
 Constructs the table, pre-filling all symbols up to max_2j_k.
 
int max_2jk () const
 Returns the maximum 2j (or k) currently stored; max(k) = 2*max(j).
 
std::size_t size () const
 Returns the number of non-zero symbols stored in the table.
 
double get_2 (int a, int b, int c, int d, int e, int f) const
 Returns 6j symbol {a/2, b/2, c/2; d/2, e/2, f/2}.
 
template<class A , class B , class C , class D , class E , class F >
double get (const A &a, const B &b, const C &c, const D &d, const E &e, const F &f) const
 "Magic" table lookup: pass integers (for k) or DiracSpinors (for j).
 
bool contains (int a, int b, int c, int d, int e, int f) const
 Returns true if the symbol is present in the table (absent symbols may be zero or simply out of range).
 
void fill (int max_2j_k)
 Extends the table to cover all symbols up to max_2j_k.
 

Constructor & Destructor Documentation

◆ SixJTable() [1/2]

Angular::SixJTable::SixJTable ( )
default

Constructs an empty table; extend later with fill() or get().

◆ SixJTable() [2/2]

Angular::SixJTable::SixJTable ( int  max_2j_k)
inline

Constructs the table, pre-filling all symbols up to max_2j_k.

Calls fill() internally. Typically max_2j_k is the maximum \(2j\) of the orbital set; all symbols with every argument \(\le 2 \times \texttt{max\_2j\_k}\) are stored.

Parameters
max_2j_kMaximum value of \(2j\) (or \(k\)) to pre-compute.

Member Function Documentation

◆ max_2jk()

int Angular::SixJTable::max_2jk ( ) const
inline

Returns the maximum 2j (or k) currently stored; max(k) = 2*max(j).

◆ size()

std::size_t Angular::SixJTable::size ( ) const
inline

Returns the number of non-zero symbols stored in the table.

◆ get_2()

double Angular::SixJTable::get_2 ( int  a,
int  b,
int  c,
int  d,
int  e,
int  f 
) const
inline

Returns 6j symbol {a/2, b/2, c/2; d/2, e/2, f/2}.

Arguments are \(2j\) or \(2k\) as integers. Returns 0 without warning if the symbol is outside the stored range.

Parameters
a,b,c,d,e,fTwice the top/bottom rows of the 6j symbol.

◆ get()

template<class A , class B , class C , class D , class E , class F >
double Angular::SixJTable::get ( const A &  a,
const B &  b,
const C &  c,
const D &  d,
const E &  e,
const F &  f 
) const
inline

"Magic" table lookup: pass integers (for k) or DiracSpinors (for j).

Converts each argument via twojk() then delegates to get_2(). Example: get(Fa, Fb, k, Fc, Fd, k) returns \(\{j_a,j_b,k;j_c,j_d,k\}\). Returns 0 without warning if the symbol is outside the stored range.

Warning
Do not pre-multiply by 2.

◆ contains()

bool Angular::SixJTable::contains ( int  a,
int  b,
int  c,
int  d,
int  e,
int  f 
) const
inline

Returns true if the symbol is present in the table (absent symbols may be zero or simply out of range).

◆ fill()

void Angular::SixJTable::fill ( int  max_2j_k)
inline

Extends the table to cover all symbols up to max_2j_k.

Called automatically by the constructor. Only needed explicitly when the required \(2j\) grows beyond the original maximum. No-op if max_2j_k does not exceed the current maximum.

Parameters
max_2j_kNew maximum value of \(2j\) (or \(k\)).

The documentation for this class was generated from the following file: