anchor.diff:  
     end do
   
  -  OPEN(UNIT=10, FILE='run_finished.txt', ACTION="write", STATUS="unknown", &
  -      FORM="formatted", POSITION = "append")
  +  open(unit=10, file='run_finished.txt', action="write", status="unknown", &
  +      form="formatted", position = "append")
     write(10,1112) n
   1112 format( "run finished at time step ", 1i10.10)
  -  CLOSE(UNIT=10)
  +  close(unit=10)
   
     print *, 'Execution ended normally'
   
     stop 0
   
  -END PROGRAM MIM
  +end program MIM
   
   
   ! ------------------------- Beginning of the subroutines ----------------------
  
positive.code:   do n=1,nTimeSteps
  
      ! Time varying winds
      if (UseSinusoidWind .eqv. .TRUE.) then
        wind_x = base_wind_x*(wind_alpha +  &
            wind_beta*sin(((2d0*pi*n*dt)/wind_period) - wind_t_offset))
        wind_y = base_wind_y*(wind_alpha +  &
            wind_beta*sin(((2d0*pi*n*dt)/wind_period) - wind_t_offset))
      else if (UseStochWind .eqv. .TRUE.) then
        if (mod(n-1,n_stoch_wind).eq.0) then
          ! Gives a pseudorandom number in range 0 <= x < 1
          call random_number(stoch_wind_mag)
  
negative.code:   implicit none
  
    ! ----- variables for portable seed setting -----
    integer :: i_seed
    integer, dimension(:), allocatable :: a_seed
    integer, dimension(1:8) :: dt_seed
    ! ----- end of variables for seed setting -----
  
    ! ----- Set up random seed portably -----
    call random_seed(size=i_seed)
    allocate(a_seed(1:i_seed))
    call random_seed(get=a_seed)
    call date_and_time(values=dt_seed)
    a_seed(i_seed)=dt_seed(8); a_seed(1)=dt_seed(8)*dt_seed(7)*dt_seed(6)
    call random_seed(put=a_seed)
    return
  