! tracking example
!   Tracks off-momentum particles then analyzes motion to
!   determine the chromaticity and make diagnostics in phase space

! phase space in (x,x')

&run_setup
	echo_lattice = 0, ! 0 for no echo
	lattice = "SOLEIL_nominal_lattice2013_vchamber.lte",
	use_beamline = "RING2", ! no cavity
	p_central_mev = 2.739e+03,
        magnets = %s.mag,
        losses = %s.los,
        final = %s.fin,
        ! the second-order is needed here only for the twiss computations.
        ! the tracking is done with kick elements
        default_order = 1,! value 1 is mandatory to compute phase space diagnostics
 	parameters = %s.param,
 	rootname = ChromaTrack-x,
&end

&twiss_output
        filename = %s.twi,
	radiation_integrals=1,
&end

&run_control
        n_indices = 1,
        n_passes = 20
&end

!&alter_elements !modify the value for one or more parameters
!     name=MALIN2, !mark in the ring lattice
!    item=DX, !the name of the parameter to alter
!     value=1e-6 !new value of the parameter
!&end


!&alter_elements name=MAL, item=DY, value=1e-6 &end

&vary_element 
        name=MALIN2, item=DX, initial=1.2e-2, final=1.2e-2, 
        index_number=0, index_limit=1 &end

&closed_orbit &end

&bunched_beam n_particles_per_bunch = 1 &end

&track center_on_orbit=1 &end

&stop

! phase space in (y,y')

&run_setup
	echo_lattice = 0, ! 0 for no echo
	lattice = "SOLEIL_nominal_lattice2013_vchamber.lte",
	use_beamline = "RING2", ! no cavity
	p_central_mev = 2.739e+03,
        magnets = %s.mag,
        losses = %s.los,
        final = %s.fin,
        ! the second-order is needed here only for the twiss computations.
        ! the tracking is done with kick elements
        default_order = 1,! value 1 is mandatory to compute phase space diagnostics
 	parameters = %s.param,
 	rootname = ChromaTrack-y,
&end

&twiss_output
        filename = %s.twi,
	radiation_integrals=1,
&end

&run_control
        n_indices = 1,
        n_passes = 500
&end

!&alter_elements !modify the value for one or more parameters
!     name=MALIN2, !mark in the ring lattice
!    item=DX, !the name of the parameter to alter
!     value=1e-6 !new value of the parameter
!&end


!&alter_elements name=MAL, item=DY, value=1e-6 &end

&vary_element 
        name=MALIN2, item=DY, initial=4e-3, final=4e-3, 
        index_number=0, index_limit=1 &end

&closed_orbit &end

&bunched_beam n_particles_per_bunch = 1 &end

&track center_on_orbit=1 &end
