MAD (Methodical Accelerator Design) For Dummies

For the design and simulation of particle accelerators, MAD takes input beam parameters and models the effect of the accelerator components on the particle beam.

When I first started to work with MAD I was feeling pretty lazy and hoping for a quick start guide. There are plenty of helpful manuals and setup instructions but no MAD for dummies, so after becoming a little more capable with the program I have decided to write a short tutorial.

  1. Install MAD – see these pages for Windows and Linux installations. (this tutorial is for MAD8, the newest incarnation of MAD is the C-based MADX which can be found here along with MAD to MADX conversion instructions).
  2. Download the User’s Guide (more detailed physicist and programmer’s guides are also available).
  3. Create an accelerator model – here follows a MAD input script which takes initial beam parameters, transports the beam through a FODO lattice (a section of beam line consisting of three quadrupoles, two of which have one polarity and the third having the opposite) and outputs the beam properties at selected locations.

Input (.txt file)
ASSIGN,PRINT=out.txt Assign output file name
BEAM, ENERGY=100E-3, EXN=1E-6, EYN=1E-6, SIGE=0.01 Define beam parameters
HR:=BEAM[ENERGY]/2.99792458E-4 :=assigns a fixed value whereas = denotes a variable that can be reassigned

H0: LINE=(H0d0,H0POP1,H0d1,H0Q1,H0d2,H0Q2,H0d3,H0Q3 &
H0d4,H0POP2,H0d5)

H0d0: Drift, L=0.358
H0POP1: Monitor, L=0.00
H0d1: Drift, L=0.131
H0Q1: Quadrupole, L=0.10, K1=IH0Q1/4.4444E-3/HR
H0d2: Drift, L=0.20
H0Q2: Quadrupole, L=0.20, K1=IH0Q2/4.4444E-3/HR
H0d3: Drift, L=0.20
H0Q3: Quadrupole, L=0.10, K1=IH0Q3/4.4444E-3/HR
H0d4: Drift, L=0.149
H0POP2: Monitor, L=0.00
H0d5: Drift, L=0.155

IH0Q1:=17.2
IH0Q2:=-15.48
IH0Q3:=18.33

bx:=10
by:=10
ax:=-1
ay:=-1

USE,period=(H0)

SELECT, TWISS, HPOP1
SELECT, TWISS, HPOP2

twiss,BETX=bx,BETY=by,ALFX=ax,ALFY=ay,SAVE
plot,haxis=s, vaxis1=BETX,betY, vaxis2=Dx,Dy, table=twiss, &
Hmin=0, Hmax=2,Vmin=0,-1,vmax=40,1,SPLINE, colour=100

stop

Output

mad.ps (see http://www.ghostscript.com if you cannot read .ps files)

out.txt

1                                                  “MAD” Version: 8.51/14   Run: 05/03/12  17.53.47
Linear lattice functions.    TWISS               line: *LIN.01*                   range: #S/#E
Delta(p)/p:     0.000000     symm: F             super:   1                                             page     1
———————————————————————————————————————————-
ELEMENT SEQUENCE       I         H O R I Z O N T A L              I           V E R T I C A L
pos.  element dist I  betax  alfax   mux    x(co)  px(co) Dx    Dpx  I   betay   alfay muy    y(co)  py(co)  Dy    Dpy
no.   name    no.      [m]  I   [m]    [1]     [2pi]  [mm]   [.001] [m]   [1]  I   [m]     [1]      [2pi]  [mm]   [.001]  [m]   [1]
———————————————————————————————————————————-
begin *LIN.01*     0.00   10.00 -1.00  0.00  0.00  0.00  0.00 0.00   10.00 -1.00   0.00  0.00  0.00  0.00 0.00
2 HPOP1        0.358   10.742 -1.072   0.005  0.00  0.00  0.00 0.00  10.742 -1.072   0.005  0.00  0.00  0.00 0.00
10 HPOP2        1.438    5.052  4.003   0.031  0.00  0.00  0.00 0.00   7.669  3.635   0.019  0.00  0.00  0.00 0.00
end   *LIN.01*     1.593    3.892  3.481   0.037  0.00  0.00  0.00 0.00   6.587  3.348   0.023  0.00  0.00  0.00 0.00
———————————————————————————————————————————-
total length =          1.593000          mux          =          0.036816          muy          =          0.022660
delta(s)     =          0.000000 mm       dmux         =         -0.066560          dmuy         =         -0.030248
betax(max)   =         11.025824          betay(max)   =         19.405838
Dx(max)      =          0.000000          Dy(max)      =          0.000000
Dx(r.m.s.)   =          0.000000          Dy(r.m.s.)   =          0.000000
———————————————————————————————————————————-

About these ads

2 responses to “MAD (Methodical Accelerator Design) For Dummies

  1. Thanks. I should have included that link.

    Of course one should jump straight to MAD-X and not bother with MAD8, especially since there are many MAD-X examples floating around with ones for MAD8 being a little thin on the ground.

    Legacy code within research groups has much to answer for.

  2. the official website for mad is

    http://cern.ch/mad

    where primer’s and tutorials are available, see the documentation section

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s