cernlogo.gif (2082 bytes)

LHC Optics Web Help Pages

LHC Optics Web Home and Help  (in new window)

lhclogo1.gif (3876 bytes)

Help on the data files and formats    
Structured Spreadsheets Other formats for optics tables MAD output quantities
MAD input examples The Beam Aperture  Interactive 3D viewers

About the MAD input files ("sample jobs")

Much of the work on the LHC optics is based on the MAD program.  The traditional method of using MAD is to prepare an plain-text input file in the MAD language.  Broadly speaking, this is a mixture of statements used to define the structure of the accelerator and imperative commands that cause calculations to be carried out on the structure.

For the LHC, the element structure is defined in a "sequence" file derived from the official LHC layout database.   The aperture available to the  beam is defined in further aperture files, although here the relationship to the database is less direct.  The excitations of the elements for a given configuration (e.g., Injection) are defined in a "strength file".  These files are generated once and then stored in a standard place on the AFS file system at CERN (which is also accessible via the Web).

A typical calculation requires these files to be used in the correct order and combined with further MAD commands.   These can be created by hand or with the MADinputLHC package in Mathematica.  

Every single page in this Web that provides optics tables and plots for the LHC also provides the MAD input files used to generate them.  These files can be used as starter examples (or "sample jobs") for your own applications.   Note that you will need to modify the paths to the output files.  The paths to the input files will work on Unix-like operating systems with access to the CERN AFS system (unfortunately, MAD does not support system-independent file paths).   These MAD examples are clearly structured into functional blocks with comments.

In fact these MAD files were generated automatically by the MadInputLHC package in the Madtomma environment by the Mathematica notebook used to create the Web site.

Downloading and working with MAD input files on Windows

MAD input files normally have the extension ".mad" or sometimes ".madx".  In some cases (notably Windows systems with Microsoft Access installed), this extension may be associated with another program and your Web browser may be configured to try to open them with that program (typically Microsoft Access, if so files will probably have this icon:  ).  We have tried to configure the Web server so that this does not happen (files with the .mad extension should be treated as MIME type text/plain) but this is hard to guarantee.  It is worth clicking directly once to see if it works for you: if it does then you can forget about this.

The simplest way around this is not to click the link directly, but instead to right-click and select "Save Target As..." (or equivalent) to download the file to a suitable location on your own computer.  

Your own computer may well be configured to open .mad files with Access (  If so, you will need to open them with a suitable plain text editor (e.g. drag them into Windows Wordpad) rather than simply double-clicking them. 

Here is a method that experienced computer users can use to break Microsoft Access’s hold on the .mad extension: in the Windows Explorer: 

  1. 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:   


     

  2. In case you ever wish to use the original Access type of file, you may change the name of the “Open” or "Design" action.  I also 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-only) convention (rather than the CR-LF that is used by programs like Windows Notepad.  In KEDIT this is accomplished with SET  EOLOUT LF (I use this as default for all files).  
     

  3. 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.  

  4. 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. 


This Web, the MAD input files and all the data  were created automatically by the Mathematica notebook LHCOpticsWebPages.nb, based on the Madtomma packages.
This page created at <*textDate[]*>
The template for this page was last modified Sunday, 28 May 2006 15:17:17