GROMACS-1-installation

4 minute read

Published:

Short tutorial/note on how to install gromacs on HPC

Introduction

GROMACS (GROningen MAchine for Chemical Simulations) is a powerful and widely used open-source software package for molecular dynamics (MD) simulations. It is designed to simulate the behavior of molecules, particularly proteins, lipids, and nucleic acids, at the atomic level.

Developed by a team of researchers at the University of Groningen in the Netherlands, GROMACS employs a variety of computational algorithms and techniques to calculate the forces acting on each atom in a molecular system and predict their motion over time. These simulations help scientists understand the structure, function, and dynamics of biological molecules, which is crucial for fields such as drug discovery, material science, and biochemistry.

Below, I tried to summarize the key points for GROMACS installation, which is how I install the CPU version (no CUDA) on Peloton. Some steps takes a while to proceed, get prepared with a cup of tea or some snacks and relax.

GROMACS Installation

Step1. load modules

Peloton has many modules that can be loaded by users. You can use the module command to check the available options. For example: module avail This command will show you all the available modules to use. If your dependencies are already compiled on the cluster, you don’t have to install them yourself.

According to the Prerequisites section in the manual,

GROMACS can be compiled on any platform with ANSI C99 and C++17 compilers, and their respective standard C/C++ libraries. Good performance on an OS and architecture requires choosing a good compiler. We recommend gcc, because it is free, widely available and frequently provides the best performance.

You can check the available gcc modules on the cluster by running: module avail gcc This will list all gcc modules in different versions. The installation section also specifies that:

We recommend to use the GCC compiler, version 9.x to 11.x. Note: there are known issues with GCC 12 and newer.

Therefore, you should load the version that is between 9.x and 11.x. The highest version of gcc on Peloton is 11.3.0, which suits the purpose of GROMACS installation: module load gcc/11.3.0

Additionally, the tutorial on the GROMACS website requires CMake version 3.18.4 or later. To check the CMake module, simply repeat the above operation. On peloton, there is a cmake/3.26.3 ready to use.

Finally, check your loaded modules using: module list This will help you see what are the available modules you have rigt now.

Other details can be found through the link

step2. install


The installation steps are pretty simple: Quick and dirty installation:

  1. Get the latest version of your C and C++ compilers.
  2. Check that you have CMake version 3.18.4 or later.
  3. Get and unpack the latest version of the GROMACS tarball.
  4. Make a separate build directory and change to it.
  5. Run cmake with the path to the source as an argument
  6. Run make, make check, and make install
  7. Source GMXRC to get access to GROMACS

According to the website, the dirty installation involves

tar xfz gromacs-2024.1.tar.gz
cd gromacs-2024.1
mkdir build
cd build
cmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON
make
make check
sudo make install
source /usr/local/gromacs/bin/GMXRC

However, there is one thing that you should be careful about: the default installation path is /usr/local/gromacs, which is not a private location on the cluster. Nobody except the admins has the authority to execute things inside that folder. Therefore, you have to specify the location under your home directory using:

-DCMAKE_INSTALL_PREFIX=/home/yourusername/somewhere/gromacs

And of course, you cannot use sudo unless you are the administrator. Below is what I did, starting from my home directory:

First, make a directory for installation, download the package from here and unzip it.

mkdir /home/yourusername/somewhere/gromacs
mkdir gmx
cd gmx
wget ftp://ftp.gromacs.org/pub/gromacs/gromacs-year.version.tar.gz
tar xfz gromacs-year.version.tar.gz

Second, move into the unzipped folder and install GROMACS, check it with source:

cd gromacs-XXXX (XXXX comes with your version name)
mkdir build
cd build
cmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -DCMAKE_INSTALL_PREFIX=/home/yourusername/somewhere/gromacs
make
make check
make install
source -DCMAKE_INSTALL_PREFIX=/home/yourusername/somewhere/gromacs/bin/GMXRC

make check is not mandatary but it is recommanded to run the regression test.

If you encounter any issues during the installation process, the best approach is to carefully examine the error message. Check if the problem is related to a dependency issue, such as incompatible versions of gcc, CMake, or other compilers. Additionally, verify that you have the necessary permissions and authority to install and execute files in the specified directories. By identifying the specific cause of the error, you can take the appropriate steps to resolve the issue and successfully complete the GROMACS installation.

With CUDA

You may also install the GROMACS with CUDA support! But you have to make sure that the cuda version is good. Some extra commands will be needed for compilation. For examole, you will need cmake with the appropriate options for CUDA support.

cmake .. -DGMX_GPU=CUDA -DCUDA_TOOLKIT_ROOT_DIR=$CUDA_HOME -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -DCMAKE_INSTALL_PREFIX=/home/yourusername/somewhere/gromacs-cuda