*
* $Id$
*
* $Log$
*
*CMZ :  3.00/00 09/04/2001  15.38.41  by  Marialuigia Ambriola
*-- Author :    Marialuigia Ambriola   05/04/2001
      REAL FUNCTION XTRINTER(S,Y,X,N)
****************************************
* makes a linear interpolation
* called by GPUSTEP
****************************************
      REAL X(N),Y(N),S,XX
      INTEGER N
      XTRINTER=0.
      XX=0.
c      PRINT*,'N,S',N,S
c      PRINT*,'Y=',Y
      DO I=2,N
         IF(S.EQ.Y(I-1)) THEN
            XX=X(I-1)
            GOTO 100
         ENDIF
         IF(S.LT.Y(I).AND.S.GT.Y(I-1)) THEN
            XX=X(I-1)+(X(I)-X(I-1))*(S-Y(I-1))/(Y(I)-Y(I-1))
	    GOTO 100
         ENDIF
      ENDDO
 100  XTRINTER=XX
c      PRINT*,'EXTRACTED ENERGY',XX
      RETURN
      END
