      FUNCTION findmax(x,xmax)
      IMPLICIT NONE
      REAL*8 findmax, x, xmax
      IF(x .GT. xmax) THEN
         findmax = x
      ELSE
         findmax = xmax
      END IF
      END
