      program trk
*
*  computes and writes out interpolated evolution track
*  call with 2 arguments: trk <M> <Z>
*  <M> = M/Msun, <Z> = Z
*
      implicit real*8 (a-h,l,m,o-z)
      common /trkdat/ qx(200,10), nk
      character cm*5, cz*6, gtype*3
      character fname*21, label(10)*8
      data label /'age','log Te','log L','log R', 'mass',
     &     ' M_V',' U-B',' B-V',' V-R',' V-I'/
*.....initialize input
      call getarg(1,cm)
      call getarg(2,cz)
      read(cm,'(f5.2)') mass
      read(cz,'(f6.4)') z
      mlog = log10(mass)
      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(cm,'(f5.2)') mass
      if(mass.lt.10.0) cm(1:1) = '0'
      write(cz,'(f6.4)') z
      fname = 'M'//cm//'Z'//cz(3:6)//gtype
      open(1,file=fname)
*.....interpolate track
      print*,mlog,zlog
      call track(mlog,zlog)
      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, (qx(k,j),j=1,10)
      end do
      close(1)
 100  format('mod',11x,10a8)
 101  format(i3,1p,e17.9,0p,9f8.4)
      end
