      SUBROUTINE ELFNCT( FUVAL, X, NA, NEL, FCALC, LFC,
     +                   DER, ELVAR, ELPTR, GPTR, HPTR )
      INTEGER           NA, NEL, LFC, FCALC(1), DER, 
     +                  ELVAR(1), ELPTR(1), GPTR(1), HPTR(1)
      DOUBLE PRECISION  FUVAL(1), X(1)
      INTEGER           I, IEL, IGSTRT, IHSTRT
      DOUBLE PRECISION  TEMP1, TEMP2, TEMP3
      DO 10 I = 1 , LFC
        IEL = FCALC(I)
        IGSTRT = GPTR(IEL) - 1
        IHSTRT = HPTR(IEL) - 1
        TEMP1  = DEXP(X(1) + X(3))
        TEMP2  = X(3) * X(4)
        TEMP3  = X(3) - X(5)
        IF( DER.EQ.0 ) THEN
          IF( IEL.EQ.1 ) THEN
            FUVAL( IEL ) =  X(2) * TEMP1
          ELSE IF( IEL.EQ.2 ) THEN
            FUVAL( IEL ) =  TEMP2**2.0D0
          ELSE
            FUVAL( IEL ) =  TEMP3**2.0D0
          ENDIF
        ELSE IF( DER.EQ.1 ) THEN
          IF( IEL.EQ.1 ) THEN
            FUVAL( IGSTRT + 1 ) = TEMP1 * X(2)
            FUVAL( IGSTRT + 2 ) = TEMP1 
          ELSE IF( IEL.EQ.2 ) THEN
            FUVAL( IGSTRT + 1 ) = 2.0D0 * X(4) * TEMP2
            FUVAL( IGSTRT + 2 ) = 2.0D0 * X(3) * TEMP2
          ELSE
            FUVAL( IGSTRT + 1 ) = 2.0D0 * TEMP3
          ENDIF
        ELSE
          IF( IEL.EQ.1 ) THEN
            FUVAL( IHSTRT + 1 ) = TEMP1 * X(2)
            FUVAL( IHSTRT + 2 ) = TEMP1
            FUVAL( IHSTRT + 3 ) = 0.0D0
          ELSE IF( IEL.EQ.2 ) THEN
            FUVAL( IHSTRT + 1 ) = 2.0D0 * X(4) * X(4)
            FUVAL( IHSTRT + 2 ) = 4.0D0 * TEMP2
            FUVAL( IHSTRT + 3 ) = 2.0D0 * X(3) * X(3)
          ELSE
            FUVAL( IHSTRT + 1 ) = 2.0D0
          ENDIF
        ENDIF
 10   CONTINUE
      RETURN
      END
