      program iso
*
*  computes and writes out isochrone
*  call with 2 arguments: iso <t> <m>
*  <t> = log(t/yrs), <m> = [Fe/H]
*
      implicit real*8 (a-h,l,m,o-z)
      common /isodat/ qx(500,10), jmod(500), nk
      character cajlog*5, cfeh*5, gtype*3
      character fname*21, label(10)*8
      data label /'Mzams','  M','log Te','log L','log R',
     &     ' M_V',' U-B',' B-V',' V-R',' V-I'/
      data mmin, mmax /-1.0d0, 3.0d0/
*.....initialize input
      call getarg(1,cajlog)
      call getarg(2,cfeh)
      read(cajlog,'(f5.2)') ajlog
      read(cfeh,'(f5.2)') feh
      aj = 10.0**ajlog
      z = 0.76/(3.0 + 37.425*10.0**(-feh))
      zlog = log10(z/0.02)
*.....read input data (synthetic colours; evolution grid)
      call rdubvi
      print*,'read UBVRI'
      call rdgrid(gtype)
      print*,'read GRID ',gtype
*.....open output file
      write(cajlog,'(f5.2)') ajlog
      if(ajlog.lt.10.0) cajlog(1:1) = '0'
      write(cfeh,'(f5.2)') feh
      if(feh.ge.0.0) then
         cfeh(1:1) = 'p'
      else
         cfeh(1:1) = 'm'
      end if
      fname = 'Iso'//cajlog//cfeh//gtype
      open(1,file=fname)
*.....compute isochrone
      print*,aj,zlog,mmin,mmax
      call isochr(aj,zlog,mmin,mmax)
      print*,nk,' points, written to file ',fname
*.....write out results
      write(1,100) (label(j),j=1,10)
      do k = 1, nk
         write(1,101) k, jmod(k), (qx(k,j),j=1,10)
      end do
      close(1)
 100  format(5x,'mod',2x,10a8)
 101  format(2i4,10f8.4)
      end
