coulomb.lisp 6 KB
Newer Older
1 2
;; Coulumb functions
;; Liam Healy, Sat Mar 18 2006 - 23:23
3
;; Time-stamp: <2008-11-16 14:39:08EST coulomb.lisp>
lhealy's avatar
lhealy committed
4
;; $Id$
5 6 7 8 9 10 11

(in-package :gsl)

;;;;****************************************************************************
;;;; Normalized Hydrogenic Bound States
;;;;****************************************************************************

liam's avatar
liam committed
12
(defmfun hydrogenicR-1 (x r)
13
  "gsl_sf_hydrogenicR_1_e" ((x :double) (r :double) (ret sf-result))
14
  :documentation			; FDL
15
  "The lowest-order normalized hydrogenic bound state radial
16
   wavefunction R_1 := 2Z \sqrt{Z} \exp(-Z r).")
17

liam's avatar
liam committed
18
(defmfun hydrogenicR (n l x r)
19
  "gsl_sf_hydrogenicR_e"
20
  ((n :int) (l :int) (x :double) (r :double) (ret sf-result))
21 22
  :documentation			; FDL
  "The n-th normalized hydrogenic bound state radial wavefunction,
23 24
  R_n := {2 Z^{3/2} \over n^2}  \left({2Z \over n}\right)^l
  \sqrt{(n-l-1)! \over (n+l)!} \exp(-Z r/n) L^{2l+1}_{n-l-1}(2Z/n r).
25 26
  The normalization is chosen such that the wavefunction \psi is given by 
  \psi(n,l,r) = R_n Y_{lm}.")
27 28 29 30 31

;;;;****************************************************************************
;;;; Coulomb Wave Functions
;;;;****************************************************************************

liam's avatar
liam committed
32
(defmfun coulomb-wave-FG (eta x L-F k)
33
  "gsl_sf_coulomb_wave_FG_e"
34 35 36 37 38
  ((eta :double) (x :double) (L-F :double) (k :int)
   (F sf-result) (Fp sf-result) (G sf-result) (Gp sf-result)
   (exp-F :double) (exp-G :double))
  :return
  ((val F) (val Fp) (val G) (val Gp)
39
   (dcref exp-F) (dcref exp-G)
40
   (err F) (err Fp) (err G) (err Gp))
41 42
  :documentation			; FDL
  "The Coulomb wave functions F_L(\eta,x),
43 44 45 46 47 48 49
  G_{L-k}(\eta,x) and their derivatives F'_L(\eta,x), G'_{L-k}(\eta,x)
  with respect to x.  The parameters are restricted to L, L-k > -1/2},
  x > 0 and integer k.  Note that L itself is not restricted to being
  an integer. The results are stored in the parameters F, G for the
  function values and Fp, Gp for the derivative values.  If an
  overflow occurs, the condition 'overflow is signalled and scaling
  exponents are stored in the modifiable parameters exp-F, exp-G.")
50

liam's avatar
liam committed
51
(defmfun coulomb-wave-F-array (L-min eta x fc-array)
52
  "gsl_sf_coulomb_wave_F_array"
53
  ((L-min :double) ((1- (dim0 fc-array)) :int) (eta :double) (x :double)
54 55
   ((c-pointer fc-array) :pointer) (F-exponent :double))
  :outputs (fc-array)
56 57 58 59 60
  :return (fc-array (dcref F-exponent))
  :documentation			; FDL
  "The Coulomb wave function F_L(\eta,x) for
  L = Lmin ... Lmin + kmax, storing the results in fc-array.
  In the case of overflow the exponent is stored in the second value returned.")
61

liam's avatar
liam committed
62
(defmfun coulomb-wave-FG-array (L-min eta x fc-array gc-array)
63
  "gsl_sf_coulomb_wave_FG_array"
64
  ((L-min :double) ((1- (dim0 fc-array)) :int) (eta :double) (x :double)
65
   ((c-pointer fc-array) :pointer) ((c-pointer gc-array) :pointer)
66
   (F-exponent :double) (G-exponent :double))
67 68 69 70 71 72
  :return (fc-array gc-array (dcref F-exponent) (dcref G-exponent))
  :documentation			; FDL
  "The functions F_L(\eta,x),
  G_L(\eta,x) for L = Lmin ... Lmin + kmax storing the
  results in fc_array and gc_array.  In the case of overflow the
  exponents are stored in F_exponent and G_exponent.")
73

liam's avatar
liam committed
74
(defmfun coulomb-wave-FGp-array (L-min eta x fc-array fcp-array gc-array gcp-array)
75
  "gsl_sf_coulomb_wave_FGp_array"
76
  ((L-min :double) ((1- (dim0 fc-array)) :int) (eta :double) (x :double)
77 78
   ((c-pointer fc-array) :pointer) ((c-pointer fcp-array) :pointer)
   ((c-pointer gc-array) :pointer) ((c-pointer gcp-array) :pointer)
79 80 81
   (F-exponent :double) (G-exponent :double))
  :return
  (fc-array fcp-array gc-array gcp-array
82 83 84 85 86 87 88 89
	    (dcref F-exponent) (dcref G-exponent))
  :documentation			; FDL
  "The functions F_L(\eta,x),
  G_L(\eta,x) and their derivatives F'_L(\eta,x),
  G'_L(\eta,x) for L = Lmin ... Lmin + kmax storing the
  results in fc_array, gc_array, fcp_array and gcp_array.
  In the case of overflow the exponents are stored in F_exponent
  and G_exponent.")
90

liam's avatar
liam committed
91
(defmfun coulomb-wave-sphF-array (L-min eta x fc-array)
92
  "gsl_sf_coulomb_wave_sphF_array"
93
  ((L-min :double) ((1- (dim0 fc-array)) :int) (eta :double) (x :double)
94 95
   ((c-pointer fc-array) :pointer) (F-exponent :double))
  :outputs (fc-array)
96 97 98 99 100 101 102
  :return (fc-array (dcref F-exponent))
  :documentation			; FDL
  "The Coulomb wave function divided by the argument
   F_L(\eta, x)/x for L = Lmin ... Lmin + kmax, storing the
   results in fc_array.  In the case of overflow the exponent is
   stored in F_exponent. This function reduces to spherical Bessel
   functions in the limit \eta \to 0.")
103 104 105 106 107

;;;;****************************************************************************
;;;; Coulomb Wave Function Normalization Constant
;;;;****************************************************************************

liam's avatar
liam committed
108
(defmfun coulomb-CL (L eta)
109
  "gsl_sf_coulomb_CL_e" ((L :double) (eta :double) (ret sf-result))
110 111 112
  :documentation			; FDL
  "The Coulomb wave function normalization constant C_L(\eta)
   for L > -1.")
113

liam's avatar
liam committed
114
(defmfun coulomb-CL-array (L-min eta cl)
115
  "gsl_sf_coulomb_CL_array"
116
  ((L-min :double) ((1- (dim0 cl)) :int) (eta :double)
117
   ((c-pointer cl) :pointer))
118 119 120
  :documentation			; FDL
  "The Coulomb wave function normalization constant C_L(\eta)
   for L = Lmin ... Lmin + kmax, Lmin > -1."
121
  :outputs (cl))
122 123 124 125 126

;;;;****************************************************************************
;;;; Examples and unit test
;;;;****************************************************************************

127
(save-test coulomb
128 129 130
  (hydrogenicr-1 1.0d0 2.5d0)
  (hydrogenicr 3 1 1.0d0 2.5d0)
  (coulomb-wave-FG 0.0d0 1.0d0 2.0d0 0)
131
  (letm ((arr (vector-double-float 3)))
Liam Healy's avatar
Liam Healy committed
132 133
    (coulomb-wave-F-array 0.0d0 1.0d0 2.0d0 arr)
    (cl-array arr))
134
  (coulomb-wave-fg 1.0d0 2.0d0 2.5d0 1)
135
  (letm ((Farr (vector-double-float 3)) (Garr (vector-double-float 3)))
136
    (coulomb-wave-FG-array 1.5d0 1.0d0 1.0d0 Farr Garr)
Liam Healy's avatar
Liam Healy committed
137
    (append (coerce (cl-array Farr) 'list) (coerce (cl-array Garr) 'list)))
138
  (letm ((arr (vector-double-float 3)))
Liam Healy's avatar
Liam Healy committed
139
    (coulomb-wave-sphF-array  0.0d0 1.0d0 2.0d0 arr) (cl-array arr))
140
  (coulomb-cl 1.0d0 2.5d0)
141
  (letm ((cl (vector-double-float 3)))
Liam Healy's avatar
Liam Healy committed
142
    (coulomb-CL-array 0.0d0 1.0d0 cl) (cl-array cl)))