dcylbs.f 2.37 KB
Newer Older
1 2 3 4 5 6
!--------------------------------------------------------------------------------
! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
! This file is part of FLEUR and available as free software under the conditions
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
      MODULE m_dcylbs
!********************************************************************
!     calculates the derivative of the cylindrical bessel functions
!     for the given argument x amd m=-mmax,mmax
!     for l=0,lmax and argument x
!     note that the cylindrical bessel functions fj(m), m=-mmax,mmax are
!     needed (call cylbes to generate those)
!                                            Y.Mokrousov
!********************************************************************
      CONTAINS
      SUBROUTINE dcylbs(
     >                  mmax,x,fJ,
     <                  dfJ)

      IMPLICIT NONE
!     ..
!     .. Arguments ..
      INTEGER, INTENT  (IN) :: mmax
      REAL,    INTENT  (IN) :: x
      REAL,    INTENT  (IN) ::  fJ(-mmax:mmax)
      REAL,    INTENT (OUT) :: dfJ(-mmax:mmax)
!
!     .. Parameters ..
      REAL,    PARAMETER :: xlim = 1.0e-04, zero = 0.0
!     ..
!     .. Local Scalars ..
      INTEGER m
      REAL a,b
     

      dfJ(0) = -fJ(1)

      IF (x .EQ. zero) THEN
         dfJ(1) = 0.5
         dfJ(-1) = -0.5        
         DO m = 2,mmax
           dfJ(m) = zero
           dfJ(-m) = zero
         END DO
      ELSE 
c---> possible calculation of the derivatives of cylindrical Bessel 
c---> functions using first two terms of series representation of
c---> them for small x, error is ~xlim**2          (Y.Mokrousov)
c         IF (x .LT. xlim) THEN
c           a = 0.5
c           b = 0.75
c           dfJ(1) = a - b*((x/2.)**2)
c           dfJ(-1) = -dfJ(1) 
c           DO m = 2,mmax
c              a = (1./(m-1))*a
c              b = b*(2+m)/((m+1)**2)
c              dfJ(m) = a*((x/2.)**(m-1)) - b*((x/2.)**(m+1))
c              dfJ(-m) = ((-1)**m)*dfJ(m)
c           END DO
c         ELSE
c------------------------------------------------------------------

         DO m = 1,mmax
            dfJ(m) = fJ(m-1) - m*fJ(m)/x
            dfJ(-m) = ((-1)**m)*dfJ(m)
         ENDDO

c     ENDIF

      END IF

      RETURN

      END SUBROUTINE dcylbs

      END MODULE m_dcylbs