ampsci
c++ program for high-precision atomic structure calculations of single-valence systems
Classes | Functions
Angular Namespace Reference

Angular provides functions and classes for calculating and storing angular factors (3,6,9-J symbols etc.) More...

Classes

class  CkTable
 Lookup table for C^k and 3j symbols (special m=1/2, q=0 case) More...
 
class  SixJTable
 Lookup table for Wigner 6J symbols. More...
 

Functions

constexpr int twoj (int jindex)
 Converts jindex to 2*j [helper function].
 
constexpr int jindex (int twoj)
 Converts 2*j to jindex {1/2, 3/2, 5/2} -> {0, 1, 2} [helper function].
 
constexpr int jindex_kappa (int ka)
 Converts kappa to jindex {-1, 1, -2} -> {0, 0, 1} [helper function].
 
constexpr int l_k (int ka)
 returns l given kappa
 
constexpr int twoj_k (int ka)
 returns 2j given kappa
 
constexpr int parity_k (int ka)
 returns parity [(-1)^l] given kappa
 
constexpr int parity_l (int l)
 returns parity [(-1)^l] given l
 
constexpr int l_tilde_k (int ka)
 "Complimentary" l := (2j-l) = l+/-1, for j=l+/-1/2
 
constexpr int kappa_twojl (int twoj, int l)
 returns kappa, given 2j and l
 
constexpr int kappa_twojpi (const int twoj, const int pi)
 returns kappa, given 2*j and parity (+/-1),
 
constexpr bool zeroQ (double x, double eps=1.0e-10)
 Checks if a double is within eps of 0.0 [eps=1.0e-10 by default].
 
constexpr int indexFromKappa (int ka)
 returns kappa_index, given kappa More...
 
constexpr int kappaFromIndex (int i)
 Returns kappa, given kappa_index.
 
constexpr int twojFromIndex (int i)
 returns 2j, given kappa_index
 
constexpr int lFromIndex (int i)
 returns l, given kappa_index
 
constexpr int states_below_n (int n)
 Returns number of possible states below given n.
 
constexpr int nk_to_index (int n, int k)
 return nk_index given {n, kappa}: nk_index(n,k) := n^2 - 2n + 1 + kappa_index More...
 
std::pair< int, int > index_to_nk (int index)
 return {n, kappa} given nk_index:
 
int nkindex_to_kappa (int index)
 Returns kappa, given nk_index.
 
int nkindex_to_twoj (int index)
 Returns 2*j, given nk_index.
 
int nkindex_to_l (int index)
 Returns l, given nk_index.
 
constexpr bool evenQ (int a)
 Returns true if a is even - for integer values.
 
constexpr bool evenQ_2 (int two_a)
 Returns true if a (an int) is even, given 2*a (true if two_a/2 is even)
 
constexpr int neg1pow (int a)
 Evaluates (-1)^{a} (for integer a)
 
constexpr int neg1pow_2 (int two_a)
 Evaluates (-1)^{two_a/2} (for integer a; two_a is even)
 
constexpr int parity (int la, int lb, int k)
 Parity rule. Returns 1 only if la+lb+k is even.
 
constexpr int triangle (int j1, int j2, int J)
 Returns 1 if triangle rule is satisfied. nb: works with j OR twoj!
 
constexpr int sumsToZero (int m1, int m2, int m3)
 Checks if three ints sum to zero, returns 1 if they do.
 
double threej_2 (int two_j1, int two_j2, int two_j3, int two_m1, int two_m2, int two_m3)
 Calculates wigner 3j symbol. Takes in 2*j (or 2*l) - intput is integer. More...
 
double special_threej_2 (int two_j1, int two_j2, int two_k)
 Special (common) 3js case: (j1 j2 k, -0.5, 0.5, 0) More...
 
double cg_2 (int two_j1, int two_m1, int two_j2, int two_m2, int two_J, int two_M)
 Clebsh-Gordon coeficient <j1 m1, j2 m2 | J M> [takes 2*j, as int].
 
bool sixj_zeroQ (int a, int b, int c, int d, int e, int f)
 Checks triangle conditions for 6j symbols (for 2*j)
 
bool sixjTriads (std::optional< int > a, std::optional< int > b, std::optional< int > c, std::optional< int > d, std::optional< int > e, std::optional< int > f)
 Checks if a 6j symbol is valid - each input is optional. More...
 
double sixj_2 (int two_j1, int two_j2, int two_j3, int two_j4, int two_j5, int two_j6)
 6j symbol {j1 j2 j3 \ j4 j5 j6} - [takes 2*j as int]
 
double ninej_2 (int two_j1, int two_j2, int two_j3, int two_j4, int two_j5, int two_j6, int two_j7, int two_j8, int two_j9)
 9j symbol {j1 j2 j3 \ j4 j5 j6 \ j7 j8 j9} [takes 2*j as int]
 
double Ck_kk (int k, int ka, int kb)
 Reduced (relativistic) angular ME: <ka||C^k||kb> [takes k and kappa].
 
double Ck_kk_mmq (int k, int ka, int kb, int twoma, int twomb, int twoq)
 Full C^k_q matrix element - rarely used.
 
bool Ck_kk_SR (int k, int ka, int kb)
 Ck selection rule only. Returns false if C^k=0, true if non-zero.
 
double tildeCk_kk (int k, int ka, int kb)
 tildeCk_kk = (-1)^{ja+1/2}*Ck_kk
 
std::pair< int, int > kminmax_Ck (int ka, int kb)
 Returns [k_min, k_kmax] for C^k (min/max non-zero k, given kappa_a, kappa_b) Accounts for parity.
 
double S_kk (int ka, int kb)
 Reduced spin angular ME: (for spin 1/2): <ka||S||kb> More...
 

Detailed Description

Angular provides functions and classes for calculating and storing angular factors (3,6,9-J symbols etc.)

Provides functions to:

The general equations are defined:

\begin{align} \frac{1}{r_{12}} &= \sum_{kq} \frac{r_<^k}{r_>^{k+1}}(-1)^q C^k_{-q}(\hat{n}_1)C^k_{q}(\hat{n}_2)\\ C^k_{q} &\equiv \sqrt{\frac{4\pi}{2k+1}} Y_{kq}(\hat{n}), \end{align}

and

\begin{align} C^k_{ab} &\equiv \langle{\kappa_a}||C^k||{\kappa_b}\rangle \equiv (-1)^{j_a+1/2} \widetilde C^k_{ab} ,\\ &= (-1)^{j_a+1/2}\sqrt{[j_a][j_b]} \begin{pmatrix} {j_a} & {j_b} & {k} \\ {-1/2} & {1/2} &{0} \end{pmatrix} \pi(l_a+l_b+k). \end{align}

Function Documentation

◆ indexFromKappa()

constexpr int Angular::indexFromKappa ( int  ka)
constexpr

returns kappa_index, given kappa

Kappa Index: For easy array access, define 1-to-1 index for each kappa: kappa: -1 1 -2 2 -3 3 -4 4 ... index: 0 1 2 3 4 5 6 7 ... kappa(i) = (-1,i+1)*(int(i/2)+1)

◆ nk_to_index()

constexpr int Angular::nk_to_index ( int  n,
int  k 
)
constexpr

return nk_index given {n, kappa}: nk_index(n,k) := n^2 - 2n + 1 + kappa_index

nk_index: For easy array access, define 1-to-1 index for each {n, kappa}: nk_index(n,k) := n^2 - 2n + 1 + kappa_index. nb: n^2 - 2n + 1 = states_below_n - number of possible states with n'<n. Note: ONLY valid for n >= 1 (i.e., cannot be used for general basis states)

◆ S_kk()

double Angular::S_kk ( int  ka,
int  kb 
)
inline

Reduced spin angular ME: (for spin 1/2): <ka||S||kb>

Reduced spin angular ME: (for spin 1/2!) <ka||S||kb> = d(la,lb) * (-1)^{ja+la+3/2} * Sqrt([ja]jb) * sjs{ja, 1, jb, 1/2, la, 1/2} Special 6j case: sjs{ja, 1, jb, 1/2, la, 1/2} = 0.5 (-1)^{ka+kb} * Sqrt(abs[{(ka-1)^2 - kb^2}/{3ka(1+2ka)}]) triangle rule for j! At least ~least 20% faster

◆ sixjTriads()

bool Angular::sixjTriads ( std::optional< int >  a,
std::optional< int >  b,
std::optional< int >  c,
std::optional< int >  d,
std::optional< int >  e,
std::optional< int >  f 
)
inline

Checks if a 6j symbol is valid - each input is optional.

i.e., sixjTriads(a,b,c,{},{},{}) will check if any 6J symbol of form {a b c \ * * *} is valid (* can be any value)

◆ special_threej_2()

double Angular::special_threej_2 ( int  two_j1,
int  two_j2,
int  two_k 
)
inline

Special (common) 3js case: (j1 j2 k, -0.5, 0.5, 0)

\[ \begin{pmatrix}j1&j2&k\\-1/2&1/2&0\end{pmatrix} \]

◆ threej_2()

double Angular::threej_2 ( int  two_j1,
int  two_j2,
int  two_j3,
int  two_m1,
int  two_m2,
int  two_m3 
)
inline

Calculates wigner 3j symbol. Takes in 2*j (or 2*l) - intput is integer.

\[ \begin{pmatrix}j1&j2&j3\\m1&m2&m3\end{pmatrix} \]