subroutine Splint(xa,ya,y2a,n,x,y) c c Spline interpolation adapted from Numerical Recipes. c Give a value y at x. input xa(n) is equally distributed. c re-tested on 20/6/97 by Lu. c note that x must be smaller xa(n)!!! otherwise set y = 0. implicit double precision (a-h,o-z) integer n, klo, k dimension xa(n),ya(n),y2a(n) if (x .gt. xa(n)) then y = 0.0d0 return endif klo=1 khi=n 1 if (khi-klo.gt.1) then k=(khi+klo)/2 if(xa(k).gt.x)then khi=k else klo=k endif goto 1 endif h=xa(khi)-xa(klo) if (h.eq.0.) pause 'bad xa input.' a=(xa(khi)-x)/h b=(x-xa(klo))/h y=a*ya(klo)+b*ya(khi)+ * ((a**3-a)*y2a(klo)+(b**3-b)*y2a(khi))*(h**2)/6. return end