(* Update: checked to work on 10.11 El Capitan as well *)
If you’ve worked in accelerator physics in any significant way, then you will have heard of MAD (‘Methodical Accelerator Design’) written at CERN many, many years ago, but still widely used for optics design, matching, and various tracking and nonlinear work. Quite a few working accelerators have been designed using various versions of it, including the SRS, DIAMOND, ALICE, and some parts of CLIC; I know these examples because I used MAD for them!
MAD8, the older-style code written in Fortran, has given way to MADX (it’s not considered polite to ask what happened to MAD9, but its legacy lives on in several other codes), and support for MAD8 has effectively stopped, with a few legacy versions floating around. SLAC implemented linac-style acceleration into their version 8.23acc, and a long time ago I did an optimised (and slightly debugged) version of MAD8 for Windows called 8.23dl. (By the way, you can tell which version you’re using from the code version at the top of any plot, so I know who you are if you’re using my version!). There are slight differences, but more or less you can trust what comes out of them.
MADX has taken over, but there are still reasons to use MAD8 from time to time. Most people who have used MAD8 have a love/hate relationship with it: they’ve had to get used to the code and its idiosyncrasies, but the combination of the simple XSIF file format and the relatively nice command structure means you can ‘get stuff done’. This is particularly true if you have some old input files that you don’t want to bother to convert to MADX format (yes, I hate converting files).
Whilst there are installers for MAD8 on Windows (my old friend James Jones has a really nice integrated package), and Linux is basically no problem, us poor old Mac users tend to be the poor cousins, especially with new OSes like 10.8. But fear not, here is a recipe for getting MAD8 up and running on OSX 10.8 Mountain Lion.
The procedure is as follows:
- Grab a copy of all the files from:
- The mad8 binary is hard-wired to look for library files in one location, so you will need to create the following directory path (using sudo probably):/sw2/lib/gcc4.4/lib/
Put the libgcc_s.1.dylib and libgfortran.3.dylib files into this directory
- Put the other files in a directory of your choice. I chose ~/dev/mad8/
- chmod u+x * in this directory
- If you don’t already have a file called dict, then do cp mad8.dict dict.
That’s it! You should now be able to run MAD8. I’ve included an input file for the old Daresbury SRS called srs.mff, which you can get here: srs.mff.
You can now run MAD8 using e.g.:
./mad8s < srs.mff > echo.txt
This should create a mad.ps file that you can load, and a print file that you can see your output in. Plenty of tools are available to work these files.
You may find on first running mad8s that you get a prompt to install X windows. Go ahead and do that, or get it direct from https://www.xquartz.org/
Hope that helps!