TABLE OF CONTENTS
ABINIT/sbf8 [ Functions ]
NAME
sbf8
FUNCTION
Computes set of spherical bessel functions using accurate algorithm based on downward recursion in order and normalization sum. Power series used at small arguments.
COPYRIGHT
Copyright (C) 1998-2017 ABINIT group (DRH) This file is distributed under the terms of the GNU General Public License, see ~abinit/COPYING or http://www.gnu.org/copyleft/gpl.txt . For the initials of contributors, see ~abinit/doc/developers/contributors.txt .
INPUTS
nm=maximum angular momentum wanted + one xx=argument of sbf
OUTPUT
sb_out(nm)=values of spherical bessel functions for l=0,nm-1
PARENTS
posdoppler,psp8nl,qijb_kk,qmc_prep_ctqmc,smatrix_pawinit
CHILDREN
SOURCE
32 #if defined HAVE_CONFIG_H 33 #include "config.h" 34 #endif 35 36 #include "abi_common.h" 37 38 subroutine sbf8(nm,xx,sb_out) 39 40 use defs_basis 41 use m_profiling_abi 42 43 !This section has been created automatically by the script Abilint (TD). 44 !Do not modify the following lines by hand. 45 #undef ABI_FUNC 46 #define ABI_FUNC 'sbf8' 47 !End of the abilint section 48 49 implicit none 50 51 !Arguments---------------------------------------------------------- 52 !scalars 53 integer,intent(in) :: nm 54 real(dp),intent(in) :: xx 55 !arrays 56 real(dp),intent(out) :: sb_out(nm) 57 58 !Local variables------------------------------- 59 !scalars 60 integer :: nlim,nn 61 real(dp) :: fn,sn,xi,xn,xs 62 !arrays 63 real(dp),allocatable :: sb(:) 64 65 ! ************************************************************************* 66 67 if(xx<= 1.0e-36_dp) then 68 ! zero argument section 69 sb_out(:)=zero 70 sb_out(1)=one 71 else if(xx<1.e-3_dp) then 72 ! small argument section 73 xn=one 74 xs=half*xx**2 75 do nn=1,nm 76 sb_out(nn)=xn*(one - xs*(one - xs/(4*nn+6))/(2*nn+1)) 77 xn=xx*xn/(2*nn+1) 78 end do 79 else 80 ! recursion method 81 if(xx<one) then 82 nlim=nm+int(15.0e0_dp*xx)+1 83 else 84 nlim=nm+int(1.36e0_dp*xx)+15 85 end if 86 ABI_ALLOCATE(sb,(nlim+1)) 87 nn=nlim 88 xi=one/xx 89 sb(nn+1)=zero 90 sb(nn)=1.e-18_dp 91 sn=dble(2*nn-1)*1.e-36_dp 92 do nn=nlim-1,1,-1 93 sb(nn)=dble(2*nn+1)*xi*sb(nn+1) - sb(nn+2) 94 end do 95 do nn=1,nlim-1 96 sn=sn + dble(2*nn-1)*sb(nn)*sb(nn) 97 end do 98 fn=1.d0/sqrt(sn) 99 sb_out(:)=fn*sb(1:nm) 100 ABI_DEALLOCATE(sb) 101 end if 102 103 end subroutine sbf8