c=======================================================================

      subroutine useratm(nz,z,p,t,wh,wo) 2,5
      dimension z(*),p(*),t(*),wh(*),wo(*)             
      parameter (mxly=50)

      open(unit=13,status='old',form='formatted',file='atms.dat')

      read(13,*) nz

      if(nz.gt.mxly) then
        write(*,'(2a,i3)') 'error in USERATM: ',
     &       'too many levels in ATMS.DAT ---  current limit is ',nz
        stop
      endif

      do 10 i=nz,1,-1
        read(13,*) z(i),p(i),t(i),wh(i),wo(i)
 10   continue
      close(unit=13)

c     atmosphere should be entered from top to bottom, if not then reverse

      if(        call reverse(nz,z)
        call reverse(nz,p)
        call reverse(nz,t)
        call reverse(nz,wh)
        call reverse(nz,wo)
      endif

      return
      end