Example of using nonlinear edge model in CSBEND.

M. Borland (APS), Siwei Wang (HLS)

=== Files

hlslattice.lte
        Lattice file.
        Notes:
        * Use 20 kicks on quads, 60 on dipoles to ensure good modeling
        * Set edge1_effects=2, edge2_effects=2, edge_order=2 to use best edge model
twiss.ele
        Command file to use lattice file directly, showing closed orbit from edge effects
deltaFP.ele
        Command file to compute tunes vs momentum from tracking

=== Sequence

elegant twiss.ele
! Show (small) closed orbit from extended fringe fields
sddsplot -col=s,x twiss0.clo

elegant deltaFP.ele
! If you have access to many cores, e.g., 12, use
mpiexec -np 12 Pelegant deltaFP.ele 

! Fit (nux, nuy) vs delta to find chromaticities
sddsmpfit deltaFP.dtf deltaFP.fit -independent=delta -dependent=nux,nuy -terms=4 
sddsplot -layout=1,2 -join=x \
         -column=delta,nux deltaFP.dtf -graph=sym \
         -column=delta,nuxFit deltaFP.fit -graph=line,type=1 \
         -end \
         -column=delta,nuy deltaFP.dtf -graph=sym \
         -column=delta,nuyFit deltaFP.fit -graph=line,type=1 

! Show results from twiss calculation
sddsprintout -param=nux -param=dnux/dp,end -param=nuy -param=dnuy/dp twiss.twi 

! Show results from tracking
sddsprintout -param=nuxIntercept -param=nuxSlope,end -param=nuyIntercept -param=nuySlope,end deltaFP.fit 
