68 use precisn_gbl,
only: cfp
69 use special_functions_gbl,
only: cfp_resh
70 use dipelm_special_functions,
only: a_legendre_p, a_sp_harm, a_re_sp_harm
73 integer,
parameter :: lmax = 3
74 real(wp),
parameter :: thetas(5) = [0*
pi,
pi/4,
pi/2, 3*
pi/4,
pi]
75 real(wp),
parameter :: phis(5) = [0*
pi,
pi/4,
pi/2, 3*
pi/4,
pi]
77 real(wp),
allocatable :: Plm(:)
78 complex(wp),
allocatable :: Ylm(:)
80 integer :: itheta, iphi, l, m, lm
81 real(wp) :: Plm_ref((lmax + 1)**2), Xlm, x, fac(0:2*lmax)
82 real(cfp) :: ex, ey, ez, SH(-lmax:lmax, 0:lmax)
83 complex(wp) :: Ylm_ref
86 do l = 1, ubound(fac, 1)
90 print
'(/,a,/)',
'Testing normalized associated Legendre polynomials...'
91 print
'(2x,a,2x,a,2x,a,4x,a,22x,a)',
'theta',
'l',
'm',
'Plm',
'reference'
93 do itheta = 1,
size(thetas)
94 call a_legendre_p(lmax, thetas(itheta), plm)
95 x = cos(thetas(itheta))
97 plm_ref = [1._wp, sqrt(1-x*x)/2, x, -sqrt(1-x*x), (1-x*x)/8, x*sqrt(1-x*x)/2, (3*x*x-1)/2, -3*x*sqrt(1-x*x), &
98 3*(1-x*x), (1-x*x)**1.5/48, x*(1-x*x)/8, -(1-5*x*x)*sqrt(1-x*x)/8, (5*x*x-3)*x/2, 3*(1-5*x*x)*sqrt(1-x*x)/2, &
99 15*x*(1-x*x), -15*(1-x*x)**1.5]
103 plm_ref(lm) = plm_ref(lm) * sqrt(fac(l - m)/fac(l + m))
104 print
'(f7.3,2i3,2e25.15,1x,a)', thetas(itheta), l, m, plm(lm), plm_ref(lm), &
105 merge(
' ok',
'WRONG!', abs(plm(lm) - plm_ref(lm)) < 1e-10)
111 print
'(/,a,/)',
'Testing complex spherical harmonics...'
112 print
'(2x,a,2x,a,4x,a,2x,a,4x,a,47x,a)',
'theta',
'phi',
'l',
'm',
'Ylm',
'reference'
114 do itheta = 1,
size(thetas)
115 x = cos(thetas(itheta))
117 plm_ref = [1._wp, sqrt(1-x*x)/2, x, -sqrt(1-x*x), (1-x*x)/8, x*sqrt(1-x*x)/2, (3*x*x-1)/2, -3*x*sqrt(1-x*x), &
118 3*(1-x*x), (1-x*x)**1.5/48, x*(1-x*x)/8, -(1-5*x*x)*sqrt(1-x*x)/8, (5*x*x-3)*x/2, 3*(1-5*x*x)*sqrt(1-x*x)/2, &
119 15*x*(1-x*x), -15*(1-x*x)**1.5]
120 do iphi = 1,
size(phis)
121 call a_sp_harm(lmax, thetas(itheta), phis(iphi), ylm)
125 ylm_ref = sqrt((2*l+1)/(4*
pi)*fac(l - m)/fac(l + m)) * plm_ref(lm) * exp(
imu*m*phis(iphi))
126 print
'(2f7.3,2i3,4e25.15,1x,a)', thetas(itheta), phis(iphi), l, m, ylm(lm), ylm_ref, &
127 merge(
' ok',
'WRONG!', abs(ylm(lm) - ylm_ref) <= 1e-10)
134 print
'(/,a,/)',
'Testing real spherical harmonics...'
135 print
'(2x,a,2x,a,4x,a,2x,a,4x,a,22x,a)',
'theta',
'phi',
'l',
'm',
'Xlm',
'reference'
137 do itheta = 1,
size(thetas)
138 do iphi = 1,
size(phis)
139 ex = sin(thetas(itheta))*cos(phis(iphi))
140 ey = sin(thetas(itheta))*sin(phis(iphi))
141 ez = cos(thetas(itheta))
142 call a_re_sp_harm(lmax, thetas(itheta), phis(iphi), ylm)
143 call cfp_resh(sh, ex, ey, ez, lmax)
148 print
'(2f7.3,2i3,2e25.15,1x,a)', thetas(itheta), phis(iphi), l, m, xlm, sh(m, l), &
149 merge(
' ok',
'WRONG!', abs(xlm - sh(m, l)) <= 1e-10)
236 real(wp) :: ra = 15, rb = 100, c = 0, z = 1
237 integer :: m, s1 = +1, s2, l1, l2
238 complex(wp) :: k1, k2, romb, levn
240 print
'(/,A)',
'Testing Levin quadrature'
241 print
'(/,1x,A,2x,A,6x,A,4x,A,4x,A,4x,A,4x,A,2x,A,2x,A,2x,A,2x,A,4x,A,15x,A,15x,A,17x,A,15x,A,4x,A)', &
242 'Ra',
'Rb',
'Re k1',
'Im k1',
'Re k2',
'Im k2',
'm',
's1',
's2',
'l1',
'l2', &
243 're romberg',
'im romberg',
're levin',
'im levin',
'μs romberg',
'μs levin'
255 romb = 0;
call nested_cgreen_correct_romberg(z, ra, rb, c, 1, s1, s2, [ m ], [ l1, l2 ], [ k1, k2 ], romb)
257 levn = 0;
call nested_cgreen_correct_levin (z, ra, rb, c, 1, s1, s2, [ m ], [ l1, l2 ], [ k1, k2 ], levn)
260 print
'(2(F4.0,1x),4(F8.3,1x),I4,SP,2I4,SS,2I4,4E25.15,2I12)', &
261 ra, rb, k1, k2, m, s1, s2, l1, l2, romb, levn, int(1e6*(t1 - t0)), int(1e6*(t2 - t1))
277 romb = 0;
call nested_cgreen_correct_romberg(z, ra, rb, c, 1, s1, s2, [ m ], [ l1, l2 ], [ k1, k2 ], romb)
279 levn = 0;
call nested_cgreen_correct_levin (z, ra, rb, c, 1, s1, s2, [ m ], [ l1, l2 ], [ k1, k2 ], levn)
282 print
'(2(F4.0,1x),4(F8.3,1x),I4,SP,2I4,SS,2I4,4E25.15,2I12)', &
283 ra, rb, k1, k2, m, s1, s2, l1, l2, romb, levn, int(1e6*(t1 - t0)), int(1e6*(t2 - t1))
302 real(wp) :: Z = 1, a = 150, c = 0
303 real(wp) :: k1(2) = [ 0.011080185297_wp, 0.680747949322_wp ]
304 real(wp) :: k2(2) = [ 1.069105413537_wp, 1.438602233160_wp ]
306 integer :: ie, m, s2, ms(1), ss(2)
308 complex(wp) :: ks(2), integ
309 complex(wp) :: reference(2,3,2) = reshape([(-4.772929e-01_wp, +8.885647e+01_wp), (-8.424650e-04_wp, +5.923864e-01_wp), &
310 (+9.979744e-06_wp, +3.949186e-03_wp), (+1.307372e+00_wp, +3.240230e+02_wp), &
311 (+3.965361e-02_wp, +2.158463e+00_wp), (+4.697322e-04_wp, +1.437268e-02_wp), &
312 (-2.211202e-01_wp, +7.029786e+01_wp), (-9.899674e-06_wp, +4.686525e-01_wp), &
313 (+9.695004e-06_wp, +3.124290e-03_wp), (-1.752969e+00_wp, +1.992839e+02_wp), &
314 (+8.061387e-05_wp, +1.328557e+00_wp), (+7.894722e-05_wp, +8.855647e-03_wp)], &
317 print
'(/,A)',
'Testing one-photon exponential integrals'
318 print
'(/,2x,A,1x,A,1x,A,2x,A,12x,A,13x,A,2x,A,3x,A,4x,A)',
'm',
's2',
's1',
'k2',
'k1', &
319 're calculated',
'im calculated',
're reference',
'im reference'
326 ss = [ (-1)**(s2+1), +1 ]
327 ks = [ k1(ie), k2(ie) ]
331 print
'(SP,3I3,SS,2F14.10,SP,4E16.7)', ms(1), ss(2), ss(1), real(ks(2),wp), real(ks(1),wp), &
332 real(integ, wp), aimag(integ),
real(reference(s2,m+1,ie), wp), aimag(reference(s2,m+1,ie))
350 real(wp) :: a = 150, c = 0, z = 1
351 real(wp) :: k1(2) = [ 0.011080185297_wp, 0.680747949322_wp ]
352 real(wp) :: k2(2) = [ 1.069105413537_wp, 1.438602233160_wp ]
354 integer :: ie, ipw, s2, ms(1), ss(2), ls(2)
355 integer :: l1(8) = [ 1, 1, 3, 1, 3, 3, 3, 3 ]
356 integer :: l2(8) = [ 0, 2, 2, 2, 2, 4, 2, 4 ]
358 complex(wp) :: ks(2), integ
359 complex(wp) :: reference(2,8,2) = reshape([(-3.454030e+13_wp, +1.290212e+14_wp), (+4.518674e+14_wp, +1.770164e+14_wp), &
360 (-1.054015e+14_wp, -8.206518e+13_wp), (-3.390989e+14_wp, +3.473927e+14_wp), &
361 (-1.012103e+14_wp, -8.818320e+13_wp), (-3.209952e+14_wp, +3.673575e+14_wp), &
362 (-1.054015e+14_wp, -8.206518e+13_wp), (-3.390989e+14_wp, +3.473927e+14_wp), &
363 (-1.012103e+14_wp, -8.818320e+13_wp), (-3.209952e+14_wp, +3.673575e+14_wp), &
364 (+1.307948e+14_wp, +3.038993e+13_wp), (+1.111367e+14_wp, -4.753884e+14_wp), &
365 (-1.012103e+14_wp, -8.818320e+13_wp), (-3.209952e+14_wp, +3.673575e+14_wp), &
366 (+1.307948e+14_wp, +3.038993e+13_wp), (+1.111367e+14_wp, -4.753884e+14_wp), &
367 (-6.382646e+01_wp, +2.799838e+01_wp), (+7.071896e+01_wp, +1.844497e+02_wp), &
368 (+1.584632e+01_wp, -6.787748e+01_wp), (-1.900621e+02_wp, -5.395706e+01_wp), &
369 (+5.054597e+01_wp, +4.803432e+01_wp), (+4.962959e+01_wp, +1.911980e+02_wp), &
370 (+1.584632e+01_wp, -6.787748e+01_wp), (-1.900621e+02_wp, -5.395706e+01_wp), &
371 (+5.054597e+01_wp, +4.803432e+01_wp), (+4.962959e+01_wp, +1.911980e+02_wp), &
372 (-6.443654e+01_wp, -2.668020e+01_wp), (-1.150300e+02_wp, -1.606738e+02_wp), &
373 (+5.054597e+01_wp, +4.803432e+01_wp), (+4.962959e+01_wp, +1.911980e+02_wp), &
374 (-6.443654e+01_wp, -2.668020e+01_wp), (-1.150300e+02_wp, -1.606738e+02_wp)], &
377 print
'(/,A)',
'Testing one-photon Coulomb integrals'
378 print
'(/,1x,A,1x,A,1x,A,2x,A,12x,A,13x,A,2x,A,3x,A,4x,A)',
's2',
'l2',
'l1',
'k2',
'k1', &
379 're calculated',
'im calculated',
're reference',
'im reference'
386 ss = [ (-1)**(s2+1), +1 ]
387 ls = [ l1(ipw), l2(ipw) ]
388 ks = [ k1(ie), k2(ie) ]
392 print
'(SP,I3,SS,2I3,2F14.10,SP,4E16.7)', (-1)**(s2+1), l2(ipw), l1(ipw), k2(ie), k1(ie), &
393 real(integ, wp), aimag(integ),
real(reference(s2,ipw,ie), wp), aimag(reference(s2,ipw,ie))
413 real(wp) :: a = 50, b = 150, c = 0, z = 1
415 real(wp) :: k1(2) = [ 0.011080185297_wp, 0.680747949322_wp ]
416 real(wp) :: k2(2) = [ 1.069105413537_wp, 1.438602233160_wp ]
418 integer :: l1(8) = [ 1, 1, 3, 1, 3, 3, 3, 3 ]
419 integer :: l2(8) = [ 0, 2, 2, 2, 2, 4, 2, 4 ]
421 integer :: ie, ipw, s1, s2, sa, sb, ms(1), ls(2)
423 complex(wp) :: ks(2), integ_ai, integ_bi, integ_ab
425 print
'(/,A)',
'Testing one-photon Green integrals (numerical integration)'
426 print
'(/,4(1x,A),2x,A,12x,A,12x,A,3x,A,3x,A,3x,A)',
's2',
's1',
'l2',
'l1',
'k2',
'k1', &
427 're numerical ',
'im numerical ',
're asymptotic',
'im asymptotic'
435 ls = [ l1(ipw), l2(ipw) ]
436 ks = [ k1(ie), k2(ie) ]
445 print
'(SP,2I3,SS,2I3,2F14.10,SP,8E16.7)', sb, sa, l2(ipw), l1(ipw), k2(ie), k1(ie), &
446 real(integ_ab - integ_bi, wp), aimag(integ_ab - integ_bi), &
447 real(integ_ai - integ_bi, wp), aimag(integ_ai - integ_bi)
467 real(wp) :: a = 150, c = 0, z = 1
469 real(wp) :: k1(2) = [ 0.011080185297_wp, 0.680747949322_wp ]
470 real(wp) :: k2(2) = [ 1.069105413537_wp, 1.438602233160_wp ]
471 real(wp) :: k3(2) = [ 1.511902774652_wp, 1.917220644579_wp ]
473 integer :: l1(8) = [ 1, 1, 3, 1, 3, 3, 3, 3 ]
474 integer :: l2(8) = [ 0, 2, 2, 2, 2, 4, 2, 4 ]
475 integer :: l3(8) = [ 1, 1, 1, 3, 3, 3, 3, 3 ]
477 integer :: ie, ipw, s4, ms(2), ss(4), ls(4)
479 complex(wp) :: ks(4), integ1, integ2, integ
480 complex(wp) :: reference(2,8,2) = reshape([(-1.465883e+16_wp, -4.950701e+15_wp), (-3.842765e+16_wp, 8.620168e+16_wp), &
481 (-1.466146e+16_wp, -4.951551e+15_wp), (-3.843793e+16_wp, 8.623263e+16_wp), &
482 (-1.443664e+16_wp, -5.780723e+15_wp), (-3.378946e+16_wp, 8.865409e+16_wp), &
483 ( 1.520251e+16_wp, -2.902864e+15_wp), (-8.964058e+15_wp, -9.400575e+16_wp), &
484 ( 1.541476e+16_wp, -2.070261e+15_wp), (-1.420349e+16_wp, -9.382680e+16_wp), &
485 ( 1.542117e+16_wp, -2.071208e+15_wp), (-1.422236e+16_wp, -9.390101e+16_wp), &
486 ( 1.541476e+16_wp, -2.070261e+15_wp), (-1.420349e+16_wp, -9.382680e+16_wp), &
487 ( 1.542117e+16_wp, -2.071208e+15_wp), (-1.422236e+16_wp, -9.390101e+16_wp), &
488 (-4.322904e+03_wp, -4.890496e+03_wp), (-2.301503e+04_wp, 1.829823e+04_wp), &
489 (-4.323345e+03_wp, -4.890988e+03_wp), (-2.301886e+04_wp, 1.830140e+04_wp), &
490 ( 6.409175e+03_wp, -1.254518e+03_wp), ( 2.742317e+04_wp, 1.058896e+04_wp), &
491 ( 5.914821e+03_wp, 2.763232e+03_wp), ( 1.382079e+04_wp, -2.596191e+04_wp), &
492 (-5.378829e+03_wp, 3.705000e+03_wp), (-2.937519e+04_wp, 1.216512e+03_wp), &
493 (-5.380092e+03_wp, 3.705885e+03_wp), (-2.938678e+04_wp, 1.217206e+03_wp), &
494 (-5.378829e+03_wp, 3.705000e+03_wp), (-2.937519e+04_wp, 1.216512e+03_wp), &
495 (-5.380092e+03_wp, 3.705885e+03_wp), (-2.938678e+04_wp, 1.217206e+03_wp)], &
498 print
'(/,A)',
'Testing two-photon Coulomb integrals'
499 print
'(/,4(1x,A),2x,A,12x,A,12x,A,12x,A,3x,A,3x,A,4x,A)',
's4',
'l3',
'l2',
'l1',
'k3',
'k2',
'k1', &
500 're calculated',
'im calculated',
're reference',
'im reference'
508 ss = [ (-1)**(s4+1), +1, -1, +1 ]
509 ls = [ l1(ipw), l2(ipw), l2(ipw), l3(ipw) ]
510 ks = [ k1(ie), k2(ie), k2(ie), k3(ie) ]
514 ss = [ +1, +1, -1, (-1)**(s4+1) ]
515 ls = [ l3(ipw), l2(ipw), l2(ipw), l1(ipw) ]
516 ks = [ k3(ie), k2(ie), k2(ie), k1(ie) ]
520 integ = integ1 + integ2
522 print
'(SP,I3,SS,3I3,3F14.10,SP,4E16.7)', (-1)**(s4+1), l3(ie), l2(ipw), l1(ipw), k3(ie), k2(ie), k1(ie), &
523 real(integ, wp), aimag(integ),
real(reference(s4,ipw,ie), wp), aimag(reference(s4,ipw,ie))
541 real(wp) :: a = 150, c = 0, z = 1
543 real(wp) :: k1(2) = [ 0.011080185297_wp, 0.680747949322_wp ]
544 real(wp) :: k2(2) = [ 1.069105413537_wp, 1.438602233160_wp ]
545 real(wp) :: k3(2) = [ 1.511902774652_wp, 1.917220644579_wp ]
547 integer :: l1(8) = [ 1, 1, 3, 1, 3, 3, 3, 3 ]
548 integer :: l2(8) = [ 0, 2, 2, 2, 2, 4, 2, 4 ]
549 integer :: l3(8) = [ 1, 1, 1, 3, 3, 3, 3, 3 ]
551 integer :: ie, ipw, s4, ms(2), ls(3)
553 complex(wp) :: ks(3), integ1, integ2
554 complex(wp) :: reference(2,2,8,2) = reshape([(-8.310927e+15_wp, 7.523384e+15_wp), (-5.909915e+16_wp, 6.931934e+16_wp), &
555 ( 5.679523e+16_wp, 4.672527e+16_wp), ( 8.225897e+24_wp, 1.848188e+24_wp), &
556 (-6.506509e+15_wp, 2.066669e+16_wp), (-1.618385e+16_wp, 4.224605e+15_wp), &
557 ( 1.050096e+17_wp, 4.554189e+16_wp), (-4.312479e+24_wp, -7.240598e+24_wp), &
558 (-7.673705e+15_wp, 2.037601e+16_wp), (-1.647265e+16_wp, 3.342092e+15_wp), &
559 ( 1.078882e+17_wp, 3.987695e+16_wp), (-4.728274e+24_wp, -7.026109e+24_wp), &
560 (-4.503787e+15_wp, -2.119630e+16_wp), ( 1.619053e+16_wp, 4.287343e+15_wp), &
561 (-1.138495e+17_wp, 1.201762e+16_wp), ( 2.556995e+23_wp, 8.432496e+24_wp), &
562 (-3.344463e+15_wp, -2.151751e+16_wp), ( 1.600768e+16_wp, 5.199000e+15_wp), &
563 (-1.135684e+17_wp, 1.836697e+16_wp), ( 7.238276e+23_wp, 8.446832e+24_wp), &
564 (-8.612323e+15_wp, -1.723199e+16_wp), ( 3.535435e+16_wp, 4.008848e+16_wp), &
565 (-9.807095e+16_wp, 3.755844e+16_wp), ( 7.275593e+24_wp, 4.341652e+24_wp), &
566 (-3.344463e+15_wp, -2.151751e+16_wp), ( 1.600768e+16_wp, 5.199000e+15_wp), &
567 (-1.135684e+17_wp, 1.836697e+16_wp), ( 7.238276e+23_wp, 8.446832e+24_wp), &
568 (-8.612323e+15_wp, -1.723199e+16_wp), ( 3.535435e+16_wp, 4.008848e+16_wp), &
569 (-9.807095e+16_wp, 3.755844e+16_wp), ( 7.275593e+24_wp, 4.341652e+24_wp), &
570 (-1.247516e+03_wp, 3.118370e+03_wp), (-2.763140e+04_wp, 1.784564e+04_wp), &
571 ( 1.332880e+04_wp, 9.920923e+03_wp), ( 6.345060e+03_wp, 4.578023e+04_wp), &
572 (-3.896753e+03_wp, 9.080720e+02_wp), (-6.662204e+03_wp, 3.014237e+04_wp), &
573 ( 6.717303e+03_wp, 1.712697e+04_wp), ( 4.397613e+04_wp, -1.193480e+04_wp), &
574 ( 1.189054e+03_wp, -3.822275e+03_wp), (-2.263210e+04_wp, -2.099869e+04_wp), &
575 ( 1.136951e+04_wp, -1.445428e+04_wp), (-3.253996e+04_wp, -3.189015e+04_wp), &
576 ( 3.212357e+03_wp, -2.385969e+03_wp), ( 1.813020e+04_wp, -2.499891e+04_wp), &
577 (-1.298806e+04_wp, -1.303291e+04_wp), (-4.510261e+04_wp, -6.582287e+03_wp), &
578 ( 4.327121e+02_wp, 3.979850e+03_wp), ( 1.239242e+04_wp, 2.828936e+04_wp), &
579 (-4.667920e+03_wp, 1.779027e+04_wp), ( 1.713954e+04_wp, 4.222912e+04_wp), &
580 ( 1.147174e+03_wp, 5.355515e+03_wp), ( 1.429665e+04_wp, 1.753491e+04_wp), &
581 (-5.010378e+03_wp, 2.217364e+04_wp), ( 3.781810e+04_wp, 1.923663e+04_wp), &
582 ( 4.327121e+02_wp, 3.979850e+03_wp), ( 1.239242e+04_wp, 2.828936e+04_wp), &
583 (-4.667920e+03_wp, 1.779027e+04_wp), ( 1.713954e+04_wp, 4.222912e+04_wp), &
584 ( 1.147174e+03_wp, 5.355515e+03_wp), ( 1.429665e+04_wp, 1.753491e+04_wp), &
585 (-5.010378e+03_wp, 2.217364e+04_wp), ( 3.781810e+04_wp, 1.923663e+04_wp)], &
588 print
'(/,A)',
'Testing two-photon Green integrals'
589 print
'(/,5(1x,A),2x,A,12x,A,12x,A,12x,A,3x,A,3x,A,4x,A)',
's4',
's1',
'l3',
'l2',
'l1',
'k3',
'k2',
'k1', &
590 're calculated',
'im calculated',
're reference',
'im reference'
597 ls = [ l1(ipw), l2(ipw), l3(ipw) ]
598 ks = [ k1(ie), k2(ie), k3(ie) ]
603 print
'(SP,2I3,SS,3I3,3F14.10,SP,8E16.7)', (-1)**(s4+1), +1, l3(ipw), l2(ipw), l1(ipw), k3(ie), k2(ie), k1(ie),&
604 real(integ1, wp), aimag(integ1),
real(reference(1,s4,ipw,ie), wp), aimag(reference(1,s4,ipw,ie))
605 print
'(SP,2I3,SS,3I3,3F14.10,SP,8E16.7)', (-1)**(s4+1), -1, l3(ipw), l2(ipw), l1(ipw), k3(ie), k2(ie), k1(ie),&
606 real(integ2, wp), aimag(integ2),
real(reference(2,s4,ipw,ie), wp), aimag(reference(2,s4,ipw,ie))
621 use dipelm_special_functions,
only: threej
625 integer :: J = 0, li = 1, lj = 1, mi = 0, mj = 0, ki = 0, kj = 0, qi = 0, qj = 0, p = 0
626 real(wp) :: beta, ref, beta_ap
628 print
'(/,A)',
'Testing one-photon angular integrals'
629 print
'(/,8A4,2A12)',
'J',
'p',
'li',
'lj',
'mi',
'mj',
'qi',
'qj',
'TJij',
'reference'
638 ref = (-1)**(p + mi + qi) * (2*j + 1) * sqrt((2*li +
rone)*(2*lj +
rone)) &
639 * threej(2*li, 0, 2*lj, 0, 2*j, 0) &
640 * threej(2*1, 2*p, 2*1, -2*p, 2*j, 0) &
641 * threej(2*li, 2*mi, 2*lj, -2*mj, 2*j, -2*(mi-mj)) &
642 * threej(2*1, 2*qi, 2*1, -2*qj, 2*j, -2*(mi-mj))
643 if (abs(beta) > 1e-10 .or. abs(ref) > 1e-10)
then
644 print
'(I4,SP,I4,SS,2I4,SP,4I4,2F12.7,A8)', &
645 j, p, li, lj, mi, mj, qi, qj, beta, ref, &
646 merge(
' ok',
'WRONG!', abs(beta - ref) / (abs(beta) + abs(ref)) < 1e-5)
655 print
'(/,A)',
'Testing two-photon angular integrals'
656 print
'(/,10A4,3A12)',
'J',
'p',
'li',
'lj',
'mi',
'mj',
'ki',
'kj',
'qi',
'qj',
'TJij',
'TJij(ap)',
'reference'
666 beta =
beta_contraction_tensor(j, 2, [ p, p ], li, mi, [ ki, qi ], lj, mj, [ kj, qj ])
667 beta_ap =
beta_2p_arb_pol_sph_harm(j, 0, 2, [p,p], li, mi, [ki,qi], [p,p], lj, mj, [kj,qj])
668 ref =
beta_2p_demekhin(j, p, p, li, mi, ki, qi, lj, mj, kj, qj)
669 if (abs(beta) > 1e-10 .or. abs(beta_ap) > 1e-10 .or. abs(ref) > 1e-10)
then
670 print
'(I4,SP,I4,SS,2I4,SP,6I4,3F12.7,2A8)', &
671 j, p, li, lj, mi, mj, ki, kj, qi, qj, beta, beta_ap, ref, &
672 merge(
' ok',
'WRONG!', abs(beta - ref) / (abs(beta) + abs(ref)) < 1e-5), &
673 merge(
' ok',
'WRONG!', abs(beta_ap - ref) / (abs(beta_ap) + abs(ref)) < 1e-5)