diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2011-10-08 20:30:28 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2011-10-08 20:30:28 +0200 |
| commit | 5df79c53745fde5d6c3340a2979b1429cd5892c1 (patch) | |
| tree | 1a81af141708b826e9c61e8a04019994fcca8298 /src/labat/splint.f | |
Initial import of htcd system 1.0
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/labat/splint.f')
| -rw-r--r-- | src/labat/splint.f | 37 |
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) | ||
| 2 | c splint calculates the cubic spline interpolation of the density | ||
| 3 | c together with subroutine spline. | ||
| 4 | c the main ideas are "stolen" from "numerical recipes", cambridge | ||
| 5 | c university press (1992). | ||
| 6 | c input r : position coordinate (array) | ||
| 7 | c input db : spin up and down density. (array) | ||
| 8 | c input db2 : second derivative of db (array) | ||
| 9 | c input spin : 1 if spin up, -1 if spin down | ||
| 10 | c input start : starting point of spline = r(start) | ||
| 11 | c input n : index, r(n) = r_max | ||
| 12 | c input ri : position of interpolation | ||
| 13 | c 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 | ||
