next up previous contents
Next: Running music (explained with Up: Basics Previous: Generating maps (pmaps, emaps)

Compiling music to get an executable

NOTE: We will assume that you are working in a Unix environment, or have access to a Unix-type shell.

NOTE: We will assume that you are using GNU make. Under some systems when a vendor-specific make is installed, you may find GNU make available as gmake or gnumake.

The instructions for Music are explicit so that anyone, either with a good deal of experience or a relatively new user, can compile and run the code.

There are several pre-packaged drivers for Music that can perform typical molecular simulation techniques. These drivers are listed in Table [*].

NOTE: All the files with code end with extension *.F90 or *.F (not *.f90 or *.f). Some compilers may behave differently depending on whether the extensions are in capital letters or small letters.

NOTE: Also look at the quick start guide[*]. For example you can use the makemd, makegc, makehmc, makepost, and makepmap scripts in src directory to get the required executables. You dont need to go through the detailed steps below

NOTE: You should know how a Makefile works. You may need to adjust the Makefile and compiler options on your machine and platform

Driver Name

Description
drivers/music_md.F90 Molecular dynamics simulation
drivers/music_post.F90 Post processing code for analyzing music results
drivers/music_gcmc.F90 Grand Canonical Monte Carlo simulation
drivers/music_hgcmc.F90 for hybrid Monte Carlo with or without gcmc

Of course, you can also create your own driver file to perform whatever type of simulation technique you would like. However, this will be discussed later in this document. For the time being, we will assume that you wish to perform an MD simulation, and will be using the driver music_md.F90. Go through the following steps and make sure you can create an executable before proceeding. If you get stuck here just means that you don't understand the Linux environment and need to read some more on Linux.

  1. Change to the top-level directory of your Music code distribution. We will assume you have placed it in $HOME/music.

    cd $HOME/music

  2. Copy the driver file from the drivers directory to the source directory src with the command,
    cp drivers/music_md.F90 src/music.F90
    Note that the driver has to be always named music.F90 while copied to src directory. This is necessary for the makemake script to work. makemake script basically looks at music.F90 file and decides which files in src directory have to be compiled in which order. It creates the Makefile for use with the make command in Linux.

  3. Change to the src directory,
    cd src

  4. Now the Makefile needs to be created. The Makefile contains the dependencies for building the code (this tells the compiler which files are necessary to build the program), the Fortran compiler command, and compiler flags. A Perl program makemake is provided to aid in this. Use the command,
    makemake *.F90 *.F
    makemake goes through the driver (music.F90) and decides which files are to be compiled and creates the appropriate Makefile. The Makefile thus created has some options which are explained with in itself. By commenting some lines out from Makefile you could change the optimization levels etc.

  5. The Music executable is built with the command,
    make

    This will create the executable music.exe in your top-level Music directory. NOTE: Remember, you need GNU Make to use the generated Makefile. They have a web site with help on the way ``make'' works and various options in Makefile.

    NOTE: by editing Makefile you can change the name of executable if you like.


next up previous contents
Next: Running music (explained with Up: Basics Previous: Generating maps (pmaps, emaps)
Last edited by Shaji Chempath on: 2008-06-26