 MODULE PARAM_INTEGR
    double precision dt
    integer N
 END

!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 PROGRAM main
!
!  Declarations
!
!  We work in reduced units tau = x_inf = 1

! Declarations -----------------------------------

 USE PARAM_INTEGR
 double precision x, x0, T_tot, t

! Parameters -------------------------------------
! 
 x0 = 0.001         ! in units of x_inf
 dt = 0.001 
 T_tot = 10.        ! Total integration time 
                    ! in units of tau
 N = int(T_tot/dt)

 CALL INIT_COND(x,x0)
 CALL INTEGR_EULER(x)
!
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!
! SUB-PROGRAMS
!
 CONTAINS  
     !==========================================
     function F(x)
     double precision x, F

     F = - x*log(x)

     end function
     !==========================================
     subroutine INIT_COND(x,x0)
     double precision x, x0

     x = x0

     end subroutine
     !==========================================
     subroutine INTEGR_EULER(x)
     USE PARAM_INTEGR
     double precision x, t

     do i=1, N
        t = i*dt
        x = x + dt * F(x)
        if ( mod(i,10) == 0 ) print*, t, x
     end do

     end subroutine
     !==========================================

 end main ! END OF MAIN
