Difference between revisions of "Compiling GROMACS on Cluster"

From Rizzo_Lab
Jump to: navigation, search
(Compile GROMACS)
(Finishing up)
Line 90: Line 90:
 
  source .bash_profile
 
  source .bash_profile
  
 +
''How do you do this in C shell?''
  
 
==Test==
 
==Test==

Revision as of 09:25, 2 June 2011

Download .tar files

In order to compile GROMACS on Cluster, you need two things:

1.) The latest version of the GROMACS source code [1].

2.) A recent FFT library [2]. The newest version of FFTW (linked here) is well tested and most recommended.

For the purpose of these instructions, I am using GROMACS v4.5.4 and FFTW v3.2.2.


Compile FFTW

FTP the two tarballs onto your account on cluster. As a general practice, I compile all software and libraries into a "local" folder, i.e.:

/home/wjallen/local/

Unzip the FFTW tarball into your 'local' folder (or wherever else you prefer), then cd into the directory:

tar -xzf fftw-3.2.2.tar.gz
cd fftw-3.2.2

Before configuring, we must first define which C and Fortran compilers to use. In a bash shell, this is done by using environment variables. To define their locations on cluster, execute the following commands on the command line:

export CC="/software1/intel/Compiler/11.1/069/bin/intel64/icc"
export F77="/software1/intel/Compiler/11.1/069/bin/intel64/ifort"

If you are using C shell instead, you might have to define the environment variables a little differently. Something like:

setenv CC = /software1/intel/Compiler/11.1/069/bin/intel64/icc
setenv F77 = /software1/intel/Compiler/11.1/069/bin/intel64/ifort

Now you are ready to configure FFTW. Decide exactly where you want to install it, then execute the following within the fftw-3.2.2 directory. I append '-double' to the directory to let me know I am compiling the double-precision version of the libraries:

./configure --prefix=/home/wjallen/local/fftw-3.2.2-double --enable-threads --with-pic

If there are no errors in the configuration, finish with:

make
make install


Compile GROMACS

Unzip the GROMACS tarball and cd into that directory as before:

tar -xzf gromacs-4.5.4.tar.gz
cd gromacs-4.5.4

Before you can configure, you have to set a few more environment variables. On top of the C and Fortran compilers, you have to define the location of the C++ compiler you wish to use:

export CXX="/software1/intel/Compiler/11.1/069/bin/intel64/icpc"

And you have to define exactly where you compiled FFTW:

export CPPFLAGS="-I/home/wjallen/local/fftw-3.2.2-double/include"
export LDFLAGS="-L/home/wjallen/local/fftw-3.2.2-double/lib"

Now we are ready to configure GROMACS. Remember, we compiled double-precision FFTW libraries because we want to compile double-precision GROMACS. In this case, we will compile a serial version (cannot run on MPI, but can thread). Execute:

./configure --prefix=home/wjallen/local/gromacs-4.5.4-double --disable-float --program-suffix=-4.5.4-double --with-fft=fftw3

If there are no errors in the configuration, finish with:

make
make install

Compile a parallel version of GROMACS

It is oftentimes more convenient to run jobs in parallel. In the GROMACS package, only the MD integrator itself (called 'mdrun', equivalent to 'sander' in AMBER) is capable of running in parallel. To enable MPI, execute the following:

make distclean
./configure --enable-mpi --prefix=home/wjallen/local/gromacs-4.5.4-double-mpi --disable-float --program-suffix=-4.5.4-double-mpi 
            --with-fft=fftw3
make mdrun
make install-mdrun

We have now compiled just 'mdrun' in parallel in new directories. Take careful notice of the change in the name of the install directory and the program suffix.


Finishing up

The last thing to do is to specify in your .bash_profile the location of the GROMACS executables. Add the following lines:

PATH=$PATH:/home/wjallen/local/gromacs-4.5.4-double/bin
PATH=$PATH:/home/wjallen/local/gromacs-4.5.4-double-mpi/bin

Finally:

source .bash_profile

How do you do this in C shell?

Test

You can test whether both versions of GROMACS were installed correctly by typing on the command line:

mdrun-4.5.4-double -h
mdrun-4.5.4-double-mpi -h