summaryrefslogtreecommitdiff
path: root/src/labat/splint.f
diff options
context:
space:
mode:
Diffstat (limited to 'src/labat/splint.f')
-rw-r--r--src/labat/splint.f37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/labat/splint.f b/src/labat/splint.f
new file mode 100644
index 0000000..a25a942
--- /dev/null
+++ b/src/labat/splint.f
@@ -0,0 +1,37 @@
1 subroutine splint(r,db,db2,spin,start,n,ri,dbi)
2c splint calculates the cubic spline interpolation of the density
3c together with subroutine spline.
4c the main ideas are "stolen" from "numerical recipes", cambridge
5c university press (1992).
6c input r : position coordinate (array)
7c input db : spin up and down density. (array)
8c input db2 : second derivative of db (array)
9c input spin : 1 if spin up, -1 if spin down
10c input start : starting point of spline = r(start)
11c input n : index, r(n) = r_max
12c input ri : position of interpolation
13c output dbi : interpolated value of db
14 implicit logical (a-z)
15 integer spin,spinn,n,klo,khi,k,start
16 double precision r,db,db2,ri,dbi,h,a,b
17 dimension r(561),db(2,561),db2(2,561)
18 spinn = spin
19 if (spinn.eq.-1) spinn = 2
20 klo = start
21 khi = n
22 10 if (khi-klo.gt.1) then
23 k = (khi+klo)/2
24 if (r(k).gt.ri) then
25 khi = k
26 else
27 klo = k
28 endif
29 goto 10
30 endif
31 h = r(khi)-r(klo)
32 a = (r(khi)-ri)/h
33 b = (ri-r(klo))/h
34 dbi = a*db(spinn,klo)+b*db(spinn,khi)+((a**3-a)*
35 j db2(spinn,klo)+(b**3-b)*db2(spinn,khi))*(h**2)/6.d0
36 return
37 end