      subroutine DATA_INPUT(funitRes,h0oh1p,h0oh1m,delta,bigTheta,loh0,
     +                      theta0Start,theta0Step,ntheta0Pts,
     +                      k0h0Start,k0h0Step,nk0h0Pts)

c**********************************************************************
c**** Reads in data from datafiles                                 ****
c****                                                              ****
c**** Written 27/03/2018                                           ****
c**********************************************************************
c                                                     column 72 here -->
      implicit none

      character*80     fnameInp,fnameRes,dummyChar

      integer          funitInp,funitRes
      integer          ind,LEN_TO_CHAR
      integer          nk0h0Pts,ntheta0Pts

      double precision k0h0Start,k0h0Step,theta0Start,theta0Step
      double precision h0oh1p,h0oh1m,delta,bigTheta,loh0

c**********************************************************************
c**** Define the file unit numbers to be used                      ****
c**********************************************************************

      funitInp = 10

c**********************************************************************
c**** title and ask for control file name default available        ****
c**********************************************************************

      write (*,'(/18x,''Reflection from a Metamaterial bed'')')
      write (*,'(18x,''**********************************'')')
      write (*,'(/''Enter input file (default <CR>) : ''$)')
      read (*,'(a)') fnameInp
      if (fnameInp.eq.'') then
        fnameInp = 'default.inp'
      endif

c**********************************************************************
c**** Open input file and read in all relevant data                ****
c**********************************************************************

      call FOPEN(funitInp,fnameInp,'r')

      write (*,'('' Reading h0/h1+ ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) h0oh1p
      write (*,'(1x,f10.6)') h0oh1p

      write (*,'('' Reading h0/h1- ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) h0oh1m
      write (*,'(1x,f10.6)') h0oh1m

      write (*,'('' Reading Theta ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) bigTheta
      write (*,'(1x,f10.6)') bigTheta

      write (*,'('' Reading loh0 ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) loh0
      write (*,'(1x,f10.6)') loh0

      write (*,'('' Reading delta ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) delta
      write (*,'(1x,f10.6)') delta

      write (*,'('' Reading k0h0 (Start, Step, Npts) ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) k0h0Start,k0h0Step,nk0h0Pts
      write (*,'(2(1x,f9.5),1x,i4)') k0h0Start,k0h0Step,nk0h0Pts

      write (*,'('' Reading theta1 (Start, Step, Npts) ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) theta0Start,theta0Step,ntheta0Pts
      write (*,'(2(1x,f9.5),1x,i4)') theta0Start,theta0Step,ntheta0Pts

c**********************************************************************
c**** Close control file                                           ****
c**********************************************************************

      close(funitInp)

c**********************************************************************
c**** Define a file for results to go into and open it for writing ****
c**********************************************************************

      ind = LEN_TO_CHAR(fnameInp,'.')
      fnameRes = fnameInp(1:ind)//'res'
      call FOPEN(funitRes,fnameRes,'w')

      return

      end
