        SUBROUTINE SPLINT(XA,YA,Y2A,N,X,Y)
C
C CUBIC SPLINE ROUTINE FROM NUMERICAL RECIPES, THE ART OF SCIENTIFIC
C       COMPUTING.  PP 89
C
C INPUT:
C       XA, YA - TABULAR FUNCTION OF X AND Y VALUES
C       Y2A - OUTPUT OF SPLINE (GIVES 2ND DERIV. AT EACH POINT)
C       N - NUMBER OF POINTS IN XA,YA,Y2A
C       X - VALUE OF X TO COMPUTE INTERPOLATED VALUE
C OUTPUT:
C       Y - INTERPOLATED VALUE
C
	IMPLICIT NONE
        INTEGER N
        DOUBLE PRECISION XA(N),YA(N),Y2A(N),X,Y,A,B,H
        INTEGER KLO,KHI,K
C
C FIND LOCATION IN TABLE BY BISECTION
C
        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
                GO TO 1
        ENDIF
C
C KLO AND KHI NOW BRACKET INPUT X
C
        H=XA(KHI)-XA(KLO)
        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.0
        RETURN
        END
