SUBROUTINE inipap(npapmax,npap,ipap,itau_pap)
  IMPLICIT NONE
  
!=======================================================================
!
!   Auteur:  G.Krinner GK110100
!   -------
!
!   objet:
!   ------
!
!   plein plein plein de beaux papillons en toutes les couleurs !!!! 
!
!=======================================================================
!   Arguments:
!   ----------
  
  INTEGER npapmax 
  INTEGER ipap,npap,itau_pap(npapmax)

!   Variables locales:
!   ----------
  INTEGER ios
  CHARACTER(len=255) :: cwd

!-----------------------------------------------------------------------
  ipap = 1
  npap = 0
  
  print *,""
  print *,"inipap: Enter in the papillons world..."
  open(unit=8,file="papillons", action="read", status="old", iostat=ios)
  if(ios /= 0) then
     print *, "No papillons file to open or error to open it!", ios
     return
  end if
  
  print *,'Papillons:'
  npap = 1
  read(8,*, iostat=ios) itau_pap(npap)
  do while(ios == 0)
     if(npap .gt. npapmax) then
        print *,"inipap: warning too much papillons. Use only first ",npapmax
        exit
     end if
     
     print *, "inipap: ",npap,itau_pap(npap)
     
     npap = npap + 1
     read(8,*, iostat=ios) itau_pap(npap)
  end do
  npap = npap - 1
  close(8)
  
  print *, "inipap: end with npapillons=",npap
  print *,""
  
  return
  
END SUBROUTINE inipap

