Latest update: 19-Feb-03 (a small bug fix to the version of 21-Jun-2002) , new version of MAD8 available, fixes some bugs, instructions below improved, including more set-up information on Windows 95, 98 (as well as NT, 2000, XP). You are recommended to upgrade to the new version.
January 2002: you can run MAD entirely within KEDIT and benefit from automatic syntax colouring for the MAD language.
This is a procedure for installing your own copy of (the latest 8.51/15 or later ... ) MAD Version 8 for Windows. This version of MAD8 should be identical to the Linux and Unix versions with the same version number currently available at CERN.
It does not explain how to create input files for MAD nor the physics involved.
MAD8 runs on 32-bit Windows systems (e.g. Windows NT, Windows 2000, Windows 98, ….).
MAD8 should be installed on your hard disk for autonomy and performance reasons. It uses very little disk space. The ZIP file is easily downloaded even over a slow connection or can easily fit on a diskette.
Under Windows there are a number of possible ways to run a program like MAD. The choice between them is partly a matter of taste and convenience. However the "minimum" procedure described first is certainly not the most convenient: most users will prefer to set up file associations as described further down.
Download the zip file and open it (with WinZip or a similar utility).
Extract the contents of the ZIP file to your PC’s folder "Program
Files" folder. Normally the following link will open it:
C:\Program
Files\
If you already have a mad8 folder there (from a previous version), you
should delete it.
This
should create a folder C:\Program Files\mad8 looking like something
this:
Then, to run MAD, you can create a shortcut to the mad8.bat file in any convenient place (Desktop, SendTo … ) and drag MAD input files onto it. However it is much better to set up proper file associations (see below).
That’s the necessary minimum you need. This recipe should work for all 32-bit Windows systems (i.e., Windows 95 and later).
You may like to start the MAD8 program directly, by double-clicking, say, the mad8.exe file’s icon in order to get a text-based terminal session in Unix style.
You
must first set an environment variable giving the location of the
MAD8 "dictionary file". In
Windows NT, 2000, XP (we haven't checked for XP), ... you can do this from
the System icon in the Windows Control Panel.
Create a USER environment variable called DICT and give it the value
C:\Program
Files\mad8\mad8.dic
(The dialogue
boxes shown above are for Windows 2000. They are slightly different on NT.)
For Windows 95, Windows 98, Windows ME (probably), you
can set this variable by adding the line
SET DICT=C:\Progra~1\mad8\mad8.dic
to your C:\autoexec.bat file. Reboot your PC for it to take effect (you can check by typing SET at an MS-DOS command prompt).
Once you
have decided on your shortcut to start terminal sessions you can right-click it to change
the start-up directory to, say your "My Documents" folder:
You can further
customise the behaviour of terminal windows by clicking on the Window menu/Properties
(top left hand corner of the terminal window). You can then choose to have the
settings applied to all future windows started from the same shortcut. This is highly
desirable since the default window is rather small. Here are my settings:
This gives a nice big window with a scroll bar and the QuickEdit feature (right-click to copy or paste information in the terminal window; if something is selected it may beep when you try to type - hit "Esc").
Unix people should feel at home, except that they would nee a separated shortcut for starting up MAD8 in every folder where they might go to work. To get real Unix behaviour, put the MAD8 program folder on your PATH environment variable and start it as a command in a generic command-prompt window ...
The following procedure assumes that Microsoft Access has already been installed on your computer. If that is not the case, the procedure is simpler (but is not detailed here). You will have to create a new filetype with the .mad extension.
At least on Windows 2000, I have managed to break Microsoft Access’s hold on the .mad extension: in the Windows Explorer as follows.
First set up the DICT environment variable as described under "Terminal sessions" above.
Go to Tools/Folder
Options/FileTypes, find the MAD extension in the list, click Advanced,
create a new action by browsing to the mad8dl.bat file to get:
I also changed the name of the “Open” action for clarity,
in case I ever use the original Access type of file (probably a rare occurrence) and
created a KEDIT action that is my default for MAD files:
You can replace KEDIT with any other editor for plain text
files that you use. If you exchange files with Unix systems, it is better
to set your editor to use the Unix line-end (LF-on ly) convention (rather than
the CR-LF that is used by programs like Windows notepad). In KEDIT this is
accomplished with SET
You can also change the description of the file type from "Microsoft Access Module Shortcut" to "MAD input" and check the "Always show extension" box.
For easy visual
identification of MAD files,
change the icon of .mad files to the MAD8 icon in the MAD8 program folder. All of this seems to work fine in practice. With this setup, double-clicking a MAD
file opens it in KEDIT, or you can run MAD on a file by
right-clicking and then selecting MAD8 from the menu.
It should look something like this:
Expert - and very confident - users can accomplish all the
above steps more quickly by downloading this registry file.
Only execute this file if you understand exactly what it does - we take no
responsibility!!
It is also convenient to run MAD8 from within the KEDIT editor and see the output immediately. The ZIP file contains some additional files to facilitate this. Do the following:
Note that, to avoid saving the current file (which need not even have a name yet), a copy of its contents is saved in a temporary input file. Unless you take steps to save them under different names, this temporary input and the corresponding output file will be overwritten each time you run MAD.
With the language definition feature, the MAD syntax is recognised and
coloured helpfully. Here are some screen images:
It is possible to
use the Mathematica Front End to capture MAD’s terminal output and send the input;
this is rather like an enhanced terminal window.
However I often
run this version of MAD inside Mathematica functions.
I will explain this in more detail elsewhere but meanwhile here is an example in PDF format.
As usual, the MAD graphics are created in a postscript file with the hard-wired file name mad.metafile.ps so unfortunately you cannot tell which input file it is associated with. This file is overwritten each time MAD runs.
It is possible to view these with the Ghostview program ( that is also available for installation in the Windows 2000 Control Panel at CERN). However it is much more convenient to install Acrobat. Then the PS will automatically be converted to compact PDF files and you can work with them in Acrobat.
It seems that the Windows MAD will accept input files with either the Unix or DOS type format (line-end characters). Personally, I edit MAD files with KEDIT, and have it set to save them in Unix format anyway. Then I can use the same files on all systems with no changes.
The following has not been tested: Just delete the program installation directory mentioned above. If you made file associations, you can follow the reverse of the procedure to create them above. Or open the registry editor and search for "MAD8". You should find something like
Delete the KEDIT, MAD8 etc keys and rename the MS Access key as just plain "Open" to put it back how it was. You should probably also put back the Access icon.
You can also delete the key corresponding to the DICT environment
variable.
That should do the trick but this is all at your own risk.
Compared with the original SLAC/Daresbury version I have adjusted
contents of mad8.bat as follows:
echo
off
setlocal
rem Batch file for launching MAD8, John Jowett, CERN
22/8/2001.
rem This is a wrapper for the MAD8 executable which is
necessary only because
rem MAD8 does not accept input file names as
command-line arguments.
rem This could be changed in the Windows version but I
decided to change the
rem source code as little as possible to simplify
maintenance.
rem If you start the executable directly, with the
DICT environment variable set to
rem the path to the mad8.dic file, you will get a
terminal session where
rem you can just type commands. You can also input a file by typing
rem mad8 < filename
rem at a command prompt.
rem Derived from earlier version written at SLAC by
Mark Woodley.
rem Go to folder containing input file. where the MAD
input file lives ... we'll execute
rem from there
pushd %~dp1
@echo off
set fname=%1
rem set up a (local) environment variable with dict
file location
set
DICT=C:\Progra~1\mad8\mad8.dic
rem Check that worked by uncommenting next two lines:
rem set
rem more < %dict%
rem run MAD8, syntax here seems to be critical
C:\Progra~1\mad8\mad8.exe<%fname%
rem pause to look at terminal output
pause
endlocal
popd
@echo
on
MAD8 has been compiled using Compaq Visual Fortran Version 6.1. Both MAD8 and MAD8DL can be built as two different
projects in the same workspace (although almost every routine in the source code is
different between the two versions). There
are only two source files that have to modified by hand to compile under Windows.
Some transparencies shown at the CERN SL AP group meeting 23/8/2001. They include a performance comparison of MAD8 on different computers and operating systems.
Last modified: 19-Feb-03