Installing GROMACS on a 64-bit AMD Opteron Cluster running CentOS 5 Linux

The GROningen MAchine for Chemical Simulations (GROMACS) is a molecular dynamics simulation package that is very fast and has support for different force fields. It is notable for being used for protein folding at Folding@Home.

To install, download the source code from the GROMACS website to a suitable directory, extract, and configure with the appropriate environment variables. Note that a different environment module file is created for each installation as it depends on the version on openmpi that it was compiled against. It can be tested with the command mdrun_d_mpi


# cd /usr/local/src/GROMACS
# wget ftp://ftp.gromacs.org/pub/gromacs/gromacs-4.5.3.tar.gz
# tar xvf gromacs-4.5.3.tar.gz
# cd gromacs-4.5.3
# more ../config-openmpi-pgi

The configure file looks like the following. It loads the most recent version of openmpi-pgi and fftw-pgi. Note the multiple steps of make, make clean, make install and a new configuration. GROMACS is not trivial to install; the script is very handy!

#!/bin/bash
. /etc/profile.d/modules.sh
module purge
module load openmpi-pgi
module load fftw/2.1.5-pgi
CC=pgcc F77=pgf95 CXX=pgcpp ./configure --prefix=/usr/local/$(basename $(pwd) | sed 's#-#/#')-openmpi-pgi --with-fft=fftw2
make
make install
make clean
CC=pgcc F77=pgf95 CXX=pgcpp ./configure --prefix=/usr/local/$(basename $(pwd) | sed 's#-#/#')-openmpi-pgi --with-fft=fftw2 --enable-double --program-suffix=_d
make
make install
make clean
CC=pgcc F77=pgf95 CXX=pgcpp ./configure --prefix=/usr/local/$(basename $(pwd) | sed 's#-#/#')-openmpi-pgi --with-fft=fftw2 --enable-mpi --program-suffix=_mpi
make
make install-mdrun
make clean
CC=pgcc F77=pgf95 CXX=pgcpp ./configure --prefix=/usr/local/$(basename $(pwd) | sed 's#-#/#')-openmpi-pgi --with-fft=fftw2 --enable-mpi --program-suffix=_d_mpi --enable-double
make
make install-mdrun

Now run the compile and make.


# ../config-openmpi-pgi

Create a new environment module file.

#%Module1.0#####################################################################
##
## $name modulefile
##
set ver [lrange [split [ module-info name ] / ] 1 1 ]
set name [lrange [split [ module-info name ] / ] 0 0 ]
set loading [module-info mode load]
proc ModulesHelp { } {
  puts stderr "\tThis module sets the envinronment for $name v$ver"
}
module-whatis   "Set environment variables to use $name version $ver"
set GROMACSDIR /usr/local/$name/$ver
# must force load of version it was compiled against
if { $loading && [ is-loaded openmpi-pgi ] } {
        module unload openmpi-pgi
}
if { $loading && ![ is-loaded openmpi-pgi ] } {
        module load openmpi-pgi/1.4.3
}

setenv          GROMACSDIR	$GROMACSDIR
prepend-path    PATH            $GROMACSDIR/bin
prepend-path    GMXBIN          $GROMACSDIR/bin
prepend-path    LD_LIBRARY_PATH $GROMACSDIR/lib
prepend-path    GMXLDLIB        $GROMACSDIR/lib
prepend-path    GMXMAN          $GROMACSDIR/man
prepend-path    MANPATH         $GROMACSDIR/man
prepend-path    GMXDATA         $GROMACSDIR/share

Comments

Nota bene: As of v4.5.4 upgrade your FFTW to version 3.x (e.g., module load fftw/3.2.2-pgi) and for each configuration include --enable-static. Use GCC rather than PGI (there's a bug that is not fixed for autoconf. You won't need the CC= etc. Just go straight to ./configure e.g.,

#!/bin/bash
. /etc/profile.d/modules.sh
module purge
module load openmpi-gcc
module load fftw/3.2.2-gcc
./configure --prefix=/usr/local/$(basename $(pwd) | sed 's#-#/#')-openmpi-gcc --with-fft=fftw3 --enable-static
make
make install
make clean
./configure --prefix=/usr/local/$(basename $(pwd) | sed 's#-#/#')-openmpi-gcc --with-fft=fftw3 --enable-double --enable-static --program-suffix=_d 
make
make install
make clean
./configure --prefix=/usr/local/$(basename $(pwd) | sed 's#-#/#')-openmpi-gcc --with-fft=fftw3 --enable-mpi --enable-static --program-suffix=_mpi
make
make install-mdrun
make clean
./configure --prefix=/usr/local/$(basename $(pwd) | sed 's#-#/#')-openmpi-gcc --with-fft=fftw3 --enable-mpi --enable-static --program-suffix=_d_mpi --enable-double
make
make install-mdrun