Returns an unused unit number so we can later open a file on that unit.
function io_file_unit()
!===========================================
!
!! Returns an unused unit number
!! so we can later open a file on that unit.
!
!===========================================
implicit none
integer :: io_file_unit, unit
logical :: file_open
unit = 9
file_open = .true.
do while (file_open)
unit = unit + 1
inquire (unit, OPENED=file_open)
end do
io_file_unit = unit
return
end function io_file_unit