How to calculate Wigner symbols

QDYN can calculate Wigner 3j, 6j and 9j symbols by wrapping the wigxjpf and fastwigxj libraries, which are installed automatically alongside QDYN. There are two options for calculating Wigner symbols.

How to calculate Wigner symbols on the fly

Before any Wigner symbol can be calculated, initialise_wigner_symbols() needs to be called. Afterwards, the functions wig3j(), wig6j() and wig9j() can be used to calculated the corresponding Wigner symbols. This also works in a codeblock that is parallelised with OpenMP, since initialise_wigner_symbols() makes sure to call the initialisation routines on all available threads. The number of used threads can be controlled with the environment variable OMP_NUM_THREADS. An example of how to calculate Wigner 3j symbols in an OpenMP context is given in the following code snippet:

call initialise_wigner_symbols(j_max, 3)

! some code in between ...

!$omp parallel do default(shared),   &
do i = 1, repeats

  wigner3j_value = wig3j(j1, j2, j3, m1, m2, m3)

end do
!$omp end parallel do

If you need to evaluate a large number of Wigner symbols or if you need to reuse the same Wigner symbols several times, it is more efficient to use look-up tables, as described below.

How to load Wigner symbols from precalculated look-up tables

Loading Wigner symbols from look-up tables allows for fast evaluation of a large number of Wigner symbols or for reusing Wigner symbols in a very convenient way. To enable this functionality, wigner_symbol_table_load() need to be called once and the functions wig3j(), wig6j() and wig9j() need to called with fast=.true..

An example is given in the following snippet:

call initialise_wigner_symbols(j_max, 3)
call wigner_symbol_table_load(3, j_max, wigxj_table="table.3j")

! some code in between ...

wigner3j_value = wig3j(j1, j2, j3, m1, m2, m3, fast=.true.)

This would load the Wigner symbols from the table table.3j in the current working directory. If this table does not exist, it will automatically be generated once and can then be reused.