Are you using the UC Davis FARM for molecular modeling and need to figure out how to setup GROMACS? Well hello extremely small subset of the population! This is the guide for you.

Note, this is only for a basic installation. For maximum performance refer to the GROMACS guide linked above.

Getting started

We will be working off the installation instructions on the GROMACS website but will modify a few steps to deal with the quirks of the FARM at the time of writing and the fact you will not have sudo privileges.

If you want to cut to the chase, you can run this script, which will run all the code in this guide in one go. Everything will be downloaded / complied in the directory you run the script in. You can use the command below to download the script, give it permission to run, and then run it.

wget; chmod 777; ./

With that in mind the first thing to do is select a directory where you will download everything, cd into it and get going.

Download and install a recent cmake version

At the time of writing, the FARM is running cmake 3.10.2 while GROMACS requires at least 3.13.0 to build. I will be downloading 3.19.2 as it is the most recent at the time of writing. If you are downloading a different version you will have to modify some of the commands to reflect that (this will be true for all downloaded programs).

Download and run the install with the commands below

chmod 777
echo "Running cmake installer"

Download and compile GROMACS

Download your preferred version of GROMACS from the docs, I will be using 2021-rc1 for this guide.

tar xfz gromacs-2021-rc1.tar.gz

Now enter into the newly downloaded GROMACS directory and create a build directory.

cd gromacs-2021-rc1
mkdir build
cd build

From the build directory run the newly downloaded cmake version by determinging the path to the cmake exe. It will be located in folder produced by the cmake installer. For me, the full path was /home/ethollem/software/cmake-3.19.2-Linux-x86_64/cmake-3.19.2-Linux-x86_64/bin/cmake.

Then run cmake with your version subsituted into [cmake] below.


Then make the program (this could take a while).

make check

The GROMACS guide recommends the following command

sudo make install

but since we do not have sudo privileges to run the program we can add the exe to out PATH variable. From the build directory the GROMACS exe path will be [Your absolute path to build dir]/bin/gmx. For me this looks like home/ethollem/software/gromacs-2021-rc1/build/bin/gmx.

Open / create ~/.bashrc using your preferred text editor and add the line

export PATH="$HOME/software/gromacs-2021-rc1/build/bin/gmx:$PATH"

Then log off and log back in again. Test everything is working correctly by running

gmx --help

You should be greeted wih the GROMACS help page. If you are you are now good to go.