rgamma Function

public function rgamma(x, odd, even) result(rgamma_val)

Calculates 1/Gamma(1-X); modernized version of Molscat's rgamma function; see: https://github.com/molscat/molscat/blob/36fa8f93a92f851e9d84245dd6a972e2910541c5/source_code/rbesjy.f --------------------------------------------------------------------!

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: x
real(kind=dp), intent(out) :: odd
real(kind=dp), intent(out) :: even

Return Value real(kind=dp)


Called by

proc~~rgamma~~CalledByGraph proc~rgamma rgamma proc~modified_bessel_temme_algorithm modified_bessel_temme_algorithm proc~modified_bessel_temme_algorithm->proc~rgamma proc~modified_bessel_k_ratio modified_bessel_k_ratio proc~modified_bessel_k_ratio->proc~modified_bessel_temme_algorithm proc~calculate_k_matrix calculate_k_matrix proc~calculate_k_matrix->proc~modified_bessel_k_ratio program~scattering SCATTERING program~scattering->proc~calculate_k_matrix

Contents

Source Code


Variables

Type Visibility Attributes Name Initial
real(kind=dp), public :: alfa
real(kind=dp), public, dimension(12), save :: b = [-0.283876542276024_dp, -0.076852840844786_dp, 0.001706305071096_dp, 0.001271927136655_dp, 0.000076309597586_dp, -0.000004971736704_dp, -0.000000865920800_dp, -0.000000033126120_dp, 0.000000001745136_dp, 0.000000000242310_dp, 0.000000000009161_dp, -0.000000000000170_dp]
real(kind=dp), public :: beta
integer, public :: i
real(kind=dp), public :: x2

Source Code

      function rgamma(x, odd, even) result(rgamma_val)
         !! Calculates 1/Gamma(1-X); modernized version of Molscat's
         !! rgamma function; see:
         !! https://github.com/molscat/molscat/blob/36fa8f93a92f851e9d84245dd6a972e2910541c5/source_code/rbesjy.f
         !!--------------------------------------------------------------------!
         real(dp), intent(in) :: x
         real(dp), intent(out) :: odd, even
         real(dp) :: rgamma_val, x2, alfa, beta
         integer :: i
         real(dp), dimension(12), save :: b = [ &
         -0.283876542276024_dp, -0.076852840844786_dp, &
          0.001706305071096_dp,  0.001271927136655_dp, &
          0.000076309597586_dp, -0.000004971736704_dp, &
         -0.000000865920800_dp, -0.000000033126120_dp, &
          0.000000001745136_dp,  0.000000000242310_dp, &
          0.000000000009161_dp, -0.000000000000170_dp ]

         x2 = x * x * 8.0_dp
         alfa = -0.000000000000001_dp
         beta = 0.0_dp

         do i = 12, 2, -2
         beta = -(2 * alfa + beta)
         alfa = -beta * x2 - alfa + b(i)
         end do

         even = (beta / 2.0_dp + alfa) * x2 - alfa + 0.921870293650453_dp

         alfa = -0.000000000000034_dp
         beta = 0.0_dp

         do i = 11, 1, -2
         beta = -(2 * alfa + beta)
         alfa = -beta * x2 - alfa + b(i)
         end do

         odd = 2 * (alfa + beta)
         rgamma_val = odd * x + even
      end function rgamma