33#include "../base/base_uses.f90"
37 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'cg_test'
48 INTEGER,
PARAMETER :: lmax = 7
49 REAL(kind=
dp),
PARAMETER :: eps = 1.0e-10_dp
51 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:, :) :: yc
52 INTEGER :: i1, i2, i3, iw, l, ll, m, n, na, nfun, &
54 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: lof, mof
55 REAL(kind=
dp) :: dmax_complex, dmax_real, ref
56 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: wa
57 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: yr
63 WRITE (iw,
'(/,A,/)')
" Test of the Gaunt coefficients"
64 WRITE (iw,
'(T40,A,T77,I4)')
" Maximum l value tested:", lmax
76 nfun = (2*lmax + 1)**2
77 ALLOCATE (lof(nfun), mof(nfun))
78 ALLOCATE (yr(na, nfun), yc(na, nfun))
97 ref =
real_gaunt(lof(i1), mof(i1), lof(i2), mof(i2), lof(i3), mof(i3))
98 dmax_real = max(dmax_real, &
99 abs(ref - sum(wa*yr(:, i1)*yr(:, i2)*yr(:, i3))))
107 ref =
complex_gaunt(lof(i1), mof(i1), lof(i2), mof(i2), lof(i3), mof(i3))
108 ref = ref*(-1.0_dp)**(max(mof(i1), 0) + max(mof(i2), 0) + max(mof(i3), 0))
109 dmax_complex = max(dmax_complex, &
110 abs(cmplx(ref, 0.0_dp, kind=
dp) - &
111 sum(wa*yc(:, i1)*yc(:, i2)*yc(:, i3))))
114 WRITE (iw,
'(A,I2,A)')
" Test for l = ", lof(i1),
" done"
117 WRITE (iw,
'(/,T30,A,T71,ES10.3)')
" Real spherical harmonics, max deviation ", dmax_real
118 WRITE (iw,
'(T30,A,T71,ES10.3)')
" Complex spherical harmonics, max deviation ", dmax_complex
120 DEALLOCATE (wa, lof, mof, yr, yc)
123 IF (max(dmax_real, dmax_complex) > eps)
THEN
124 cpabort(
"The Gaunt coefficients disagree with the numerical integration")
Test of the Gaunt coefficients.
subroutine, public gaunt_coefficient_test()
Compare the Gaunt coefficients against a Lebedev quadrature of the triple product of spherical harmon...
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
Defines the basic variable types.
integer, parameter, public dp
Generation of the spherical Lebedev grids. All Lebedev grids were generated with a precision of at le...
subroutine, public deallocate_lebedev_grids()
...
type(oh_grid), dimension(nlg), target, public lebedev_grid
integer function, public get_number_of_lebedev_grid(l, n)
Get the number of the Lebedev grid, which has the requested angular momentum quantnum number l or siz...
subroutine, public init_lebedev_grids()
Load the coordinates and weights of the nonredundant Lebedev grid points.
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
Calculate spherical harmonics.
Interface to libwignernj for the angular momentum algebra.
real(kind=dp) function, public real_gaunt(l1, m1, l2, m2, l3, m3)
Gaunt coefficient of three real spherical harmonics, int S(l1,m1) S(l2,m2) S(l3,m3) dOmega.
real(kind=dp) function, public complex_gaunt(l1, m1, l2, m2, l3, m3)
Gaunt coefficient of three complex spherical harmonics, int Y(l1,m1) Y(l2,m2) Y(l3,...