GROMACS cluster Installation; now with cmake

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. In most recent versions it has changed the build tools from requiring a somewhat detailed configuration script to a cmake system. In this scenario, builds are done outside of the source tree. The following serves as an example installation process.

Download the source file into a sensible place (e.g., /usr/local/src/GROMACS) and extract (tar xvf gromacs-4.6.tar.gz). Make a build directory, change to that directory, load the appropriate environment modules, and build with relevant options. In this case:


mkdir build
cd build
module load fftw/3.2.2-gcc
module load cmake/2.8.5
module load gcc/4.7.0
module load openmpi-gcc/1.6.3
CC=mpicc CXX=mpiCC cmake -DGMX_X11=OFF -DGMX_MPI=ON -DGMX_DOUBLE=ON -DFFTW_INCLUDE_DIR=/usr/local/fftw/3.2.2-gcc/include/ -DFFTW_LIBRARY=/usr/local/fftw/3.2.2-gcc/lib/ -DCMAKE_INSTALL_PREFIX=/usr/local/gromacs/4.6-openmpi-gcc ../gromacs-4.6
make -j 2
make install-mdrun

Remove the build directory and recompile according to different compilers (e.g., intel, pgi). For example;


cd ..
rm -rf build
mkdir build
cd build
module load fftw/3.2.2-gcc
module load cmake/2.8.5
module load openmpi-pgi
CC=mpicc CXX=mpiCC cmake -DGMX_X11=OFF -DGMX_MPI=ON -DGMX_DOUBLE=ON -DFFTW_INCLUDE_DIR=/usr/local/fftw/3.2.2-gcc/include/ -DFFTW_LIBRARY=/usr/local/fftw/3.2.2-gcc/lib/ -DCMAKE_INSTALL_PREFIX=/usr/local/gromacs/4.6-openmpi-pgi ../gromacs-4.6
make -j 2
make install-mdrun

The specific compiler options here turn off X11, allow for parallel processing, and create a double precision build. Not also the install directory.

From here create a module file in the usual manner (ln -s .base 4.6-openmpi-gcc). The base file look like the following, with appropriate modifications according to the actual openmpi compiler used:


#%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]
set desc [join [read [ open "/usr/local/Modules/modulefiles/$name/.desc" ] ] ]
proc ModulesHelp { } {
puts stderr "\tThis module sets the environment for $name v$ver"
}
module-whatis "$desc (v$ver)"
set GROMACSDIR /usr/local/$name/$ver
# must force load of version it was compiled against
if { $loading && ![ is-loaded openmpi-gcc/1.6.3 ] } {
module load openmpi-gcc/1.6.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