
      include'common-initi.f'
      include'common-mml-lattice.f'
      include'common-2Dsc-beam.f'
      include'common-2Dsc-simulation.f'
      dimension x(6)

      nsim11  = 1
      nsout   = 0
      flattice = 'lattice-sis18-without-sex'
      call initimml(nout,flattice,nsim11)



      nmax = 1000
      do n=1,nmax
         xs = alength/dfloat(nmax)*dfloat(n)
         call betanew(xs,betx,ax,qx,bety,ay,qy)
         write(*,*) xs,betx
      enddo

c---------  now write the tracking of one particle ----

      x(1) = 0.1d0
      x(2) = 0d0
      x(3) = 0d0
      x(4) = 0d0
      x(5) = 0d0
      x(6) = 0d0

      s1 = 0
      ds = alength/dfloat(nmax)
      do n=1,nmax
         s2 = s1 + ds
         call dynmap(s1,s2,x,0,0,0,0,0)
c  ----> here use betanew to compute the beta at s2
c        and then ex = betx*x(2)x(2) + 2d0*ax*x(1)*x(2) + ....
c        gook luck...
c
      enddo


      end
