Installing Gromacs on Ubuntu for MD Simulation

7 mins read

In bioinformatics, GROMACS is one of the most popular Molecular Dynamics simulation software with loads of features built-in. Installing GROMACS Version 5.x.x+ can be a tedious and cumbersome process on Ubuntu, especially if you are just starting out. For beginners, installing and getting GROMACS to work is more challenging due to unfamiliarity with Linux commands and GROMACS dependencies. Also, the installation instructions for version 5+ available on the GROMACS website does not seem to work first hand.

In this quick tutorial, I will teach you how to install Gromacs on Ubuntu 14.04 LTS. It is expected to work on any version of Ubuntu. Post in comments if you face any problem.

I will also explain the meanings of different commands alongside.

To install GROMACS 5+, log into your Ubuntu system, and open a terminal by pressing Ctrl+Alt+T together.

You need a good internet connection as we will have to download various dependencies during the installation process. To install Gromacs, we need the following software installed on our system:

  1. A C & C++ Compiler which comes built-in with Ubuntu.
  2. CMake – A linux software to make binaries
  3. BuildEssential – It is a reference for all the packages needed to compile a package.
  4. FFTW Library: a library used by Gromacs to compute discrete Fourier transform
  5. DeRegressionTest Package

Getting Started

If you have freshly installed Ubuntu, don’t forget to update your repository information and software packages in your system. Press Ctrl+Alt+T and a terminal will open up. In the terminal, type:

sudo apt-get update
sudo apt-get upgrade


The first step in installing Gromacs is to get cmake, In the terminal, type:

sudo apt-get install cmake

If asked “After this operation, 16.5 MB of additional disk space will be used. Do you want to continue?”, Press y and then press Enter.
Easy Method Update: 2019

Easy Method

To make it even more easier to install Gromacs, We have created an installer for you. If the following installer doesn’t work, you can proceed with the normal method


make installer executable

chmod +x

Start Installer


Regular Installation

When download and installation finishes up, you can check the version of cmake by the following command

cmake --version

Next, we need to install build-essential with this command

sudo apt-get install build-essential

Before we go any further, it is good to know the path of our current working directory, in the terminal, type:


Note down the path it shows, it is very important and will be used during real gromacs installation.

Now that we have cmake in place and we know the working directory. It’s time to download the Regression Tests Package. It is possible to automatically download this package during installation, but most of the time it throws me an error stating that the location of the file has changed, so let us do it the hard way to avoid any problem during installation. Copy and Paste the following commands in your terminal (Right Click to paste or Ctrl+shift+V). It basically downloads the file and saves it in your downloads folder.

cd Downloads/

We have the Regression test package in our downloads folder as a compressed tar.gz archive, let us extract it with

tar xvzf regressiontests-5.1.1.tar.gz

Now we need Fourier Transform Library on our system. You can download it on or install it from repository with this following command

sudo apt-get install libfftw3-dev

Okay, Let us now download GROMACS 5.1.1 with this command, Alternatively, you can download the latest version from GROMACS website.


Now extract GROMACS archive

tar xvzf gromacs-5.1.1.tar.gz

Now move inside the Gromacs folder,

cd gromacs-5.1.1/

Create a directory called “Build” where we will keep our compiled binaries

mkdir build

move inside the build directory

cd build

It’s time to make Gromacs, Replace “pwdpath” with the path of working directory that you have noted earlier in the following command:


Note: There is no space after any = (assignment operator) and there are no quote symbols. If you get “There is no CMakeList file in specified location”, then please check for space or incorrect path.

If everything goes well, the message in your terminal will say “Generating Done. Build files written… “. If not, make sure you have replaced the pwd path in command with the path of your home directory. If you have forgotten it, just open another terminal and type pwd.

Now let’s first check and make the real thing..

make check
sudo make install

Now, It may take some time depending on your configuration. After completion, execute it:

source /usr/local/gromacs/bin/GMXRC

After the successful installation, you may check the version of your Gromacs with a command to make sure the installation finished as expected.

gmx pdb2gmx --version

Was this tutorial helpful? Don’t forget to share it. enjoy! 🙂

Tariq is founder of Bioinformatics Review and a professional Software Developer at IQL Technologies. His areas of expertise include algorithm design, phylogenetics, MicroArray, Plant Systematics, and genome data analysis. If you have questions, reach out to him via his homepage.


  1. Hello, Could you please write a example of this command sudo cmake .. -DGMX_BUILD_OWN_FFTW=OFF -DREGRESSIONTEST_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc -DREGRESSIONTEST_PATH=pwdpath/Downloads/regressiontests-5.1.1?
    Thank you in advance,

    • Thank you for asking, it will make things clearer for everyone else.
      Example is as follow(Without Quotes):

      “sudo cmake .. -DGMX_BUILD_OWN_FFTW=OFF -DREGRESSIONTEST_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc -DREGRESSIONTEST_PATH=/Tariq/home/Downloads/regressiontests-5.1.1”

  2. I followed your steps to install gromacs-5.1.4 it went well until i got to make check, the i got this error massage and cant figure out how to fix it. ( i have installed cmake version 3.5.2)

    Built target view_objlib
    Built target libgromacs
    Built target mdrun_objlib
    Built target gmx
    Scanning dependencies of target gmxtests
    CMake Error: Cannot open file for write: /home/rasikaradon/gromacs-5.1.4/build/tests/CMakeFiles/gmxtests.dir/depend.make.tmp
    CMake Error: : System Error: Permission denied
    tests/CMakeFiles/gmxtests.dir/build.make:74: recipe for target ‘tests/CMakeFiles/gmxtests.dir/depend’ failed
    make[3]: *** [tests/CMakeFiles/gmxtests.dir/depend] Error 2
    CMakeFiles/Makefile2:3226: recipe for target ‘tests/CMakeFiles/gmxtests.dir/all’ failed
    make[2]: *** [tests/CMakeFiles/gmxtests.dir/all] Error 2
    CMakeFiles/Makefile2:172: recipe for target ‘CMakeFiles/check.dir/rule’ failed
    make[1]: *** [CMakeFiles/check.dir/rule] Error 2
    Makefile:234: recipe for target ‘check’ failed
    make: *** [check] Error 2

      • i received ‘error in user input values’,and it mention ‘in option f Required option was not provided, and the default file eiwit’ does not exist or is not accessible. The following extensions were tried to complete the file name:.gro, .g96, .pdf, .brk, .ent, .esp, .tpr ‘

        How to solve this? need to reinstall all?

  3. kindly guide

    [email protected]:/mnt/c/Users/Samar/Desktop/grom/gromacs-5.1.1/build$ sudo cmake .. -DGMX_BUILD_OWN_FFTW=OFF -DREGRESSIONTEST_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc -DREGRESSIONTEST_PATH=/home/Samara/Desktop/regressiontests-5.1.1
    [sudo] password for samara:
    — No compatible CUDA toolkit found (v4.0+), disabling native GPU acceleration
    — Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
    CMake Error at tests/CMakeLists.txt:103 (message):
    REGRESSIONTEST_PATH invalid. The path needs to contain

    — Configuring incomplete, errors occurred!
    See also “/mnt/c/Users/Samar/Desktop/grom/gromacs-5.1.1/build/CMakeFiles/CMakeOutput.log”.
    See also “/mnt/c/Users/Samar/Desktop/grom/gromacs-5.1.1/build/CMakeFiles/CMakeError.log”.
    [email protected]:/mnt/c/Users/Samar/Desktop/grom/gromacs-5.1.1/build$

Leave a Reply

Previous Story

Cl-Dash: speeding up cloud computing in bioinformatics

Next Story

GenomeD3 plot : Easy visualization of genomes

Latest from Molecular dynamics

0 $0.00