Compiling Gromacs 5.0.4 on CentOS 6

Compiling Gromacs has never been easier using the cmake. There are a few assumptions.

  1. Use MKL and Intel Compilers
  2. Use OpenMPI  as the MPI-of-choice. The necessary PATH and LD_LIBRARY_PATH have been placed in .bashrc
  3. We will use SINGLE precision for speed used MDRUN and MPI Flags

Here is my configuration file using Intel Compilers

# tar xfz gromacs-5.0.4.tar.gz
# cd gromacs-5.0.4
# mkdir build
# cd build
# /usr/local/cmake-3.1.3/bin/cmake 
-DCMAKE_INSTALL_PREFIX=/usr/local/gromacs-5.0.4 \
-DGMX_MPI=on \
-DMKL_LIBRARIES="/usr/local/intel/mkl/lib/intel64" \
-DMKL_INCLUDE_DIR="/usr/local/intel/mkl/include" \
# make
# make check
# sudo make install
# source /usr/local/gromacs/bin/GMXRC

Installation Flags

–   -DCMAKE_C_COMPILER=xxx equal to the name of the C99 compiler you
    wish to use (or the environment variable CC)
–   -DCMAKE_CXX_COMPILER=xxx equal to the name of the C++98 compiler you
    wish to use (or the environment variable CXX)
–   -DGMX_MPI=on to build using an MPI wrapper compiler
–   -DGMX_GPU=on to build using nvcc to run with an NVIDIA GPU
–   -DGMX_SIMD=xxx to specify the level of SIMD support of the node on
    which mdrun will run
–   -DGMX_BUILD_MDRUN_ONLY=on to build only the mdrun binary, e.g. for
    compute cluster back-end nodes
–   -DGMX_DOUBLE=on to run GROMACS in double precision (slower, and not
    normally useful)
–   -DCMAKE_PREFIX_PATH=xxx to add a non-standard location for CMake to
    search for libraries
–   -DCMAKE_INSTALL_PREFIX=xxx to install GROMACS to a non-standard
    location (default /usr/local/gromacs)
–   -DBUILD_SHARED_LIBS=off to turn off the building of shared libraries
–   -DGMX_FFT_LIBRARY=xxx to select whether to use fftw, mkl or fftpack
    libraries for FFT support
–   -DCMAKE_BUILD_TYPE=Debug to build GROMACS in debug mode