Connect with us

MD Simulation

Method-1: Installing GROMACS on Ubuntu with CUDA GPU Support

Dr. Muniba Faiza

Published

on

Install gromacs with gpu acceleration

GROMACS [1] is one of the most popular software in bioinformatics for molecular dynamic (MD) studies of macromolecules. We have provided different tutorials regarding MD simulation using GROMACS including its installation on Ubuntu. In this article, we will install GROMACS with GPU acceleration.

For detailed instructions, read our previous article. If you want to install without GPU support, you can simply follow the steps mentioned in that article. In this tutorial, you will find some additional steps for GPU acceleration.

Getting Started

It is good practice to update your repository information and software packages before installing new programs. Open a terminal by pressing Ctrl+Alt+T and type:

$ sudo apt-get update

$ sudo apt-get upgrade

Downloading CUDA toolkit

It might be possible that you have already NVIDIA CUDA drivers installed on your system. Therefore, it’s better to first remove them and then install the latest drivers, otherwise, it will give you errors. Open a terminal and type the following commands:

$ sudo apt-get remove --purge cuda-* libcuda* nvidia*

$ sudo apt-get remove --purge cuda-drivers libcuda* cuda-runtime* cuda-8-0 cuda-demo*

$ sudo apt-get autoremove --purge nvidia* cuda-drivers libcuda* cuda-runtime* cuda-8-0 cuda-demo*

$ sudo apt-get remove --purge nvidia* cuda-drivers libcuda1-396 cuda-runtime-9-2 cuda-9.2 cuda-demo-suite-9-2 cuda

Now select the latest version of the CUDA toolkit according to your system from here. Download the local run file using the following command. The run file contains every essential component to be installed. Change to the directory where you want to download the installer.

$ cd Downloads/

$ wget https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda_11.1.1_455.32.00_linux.run

Installing CUDA toolkit

Since the CUDA toolkit is available for Ubuntu 16.04 onwards, therefore, make sure you have the compatible version of Ubuntu installed on your system. Now, copy & paste the following command to run the installer.

$ sudo sh cuda_11.1.1_455.32.00_linux.run

It will ask to create a password, enter, and confirm. It will take a few minutes to finish. After that, edit /etc/ld.so.conf file.

$ sudo gedit /etc/ld.so.conf

Now add the following path at the end of the file.

/usr/local/cuda-11.1/lib64

$ sudo ldconfig

Now install CUDA drivers. To avoid any error, don’t forget to write the last argument in the command (–override-driver-check).

$ sudo sh cuda_11.1.1_455.32.00_linux.run --silent --driver --override-driver-check

Updating NVIDIA drivers

It is necessary to update the NVIDIA drivers otherwise it will not recognize GPU during simulation even after configuration. Copy & paste the following commands.

$ sudo ubuntu-drivers autoinstall

$ sudo apt-get update

Installing prerequisites for GROMACS

  • Install openmpi from the repository using the following command:

$ sudo apt-get install libopenmpi-dev

$ sudo apt-get install openmpi-bin

$ sudo apt-get install mpi4py

If you have already installed GROMACS, then skip to the next step.

  • Get cmake before installing GROMACS. In the terminal, type:

$ sudo apt-get install -y cmake

After the installation finishes up, you can check the version of cmake by the following command:

$ cmake --version

If it displays the version, then it means everything is fine. Move on to the next step.

  • The next requirement is build-essential. To install this, type the following command in the terminal:

$ sudo apt-get install -y build-essential

  • Now, you need the FFTW3 library. Install it using the following command:

$ sudo apt-get install -y libfftw3-dev

  • Now, install Doxygen

$ sudo apt-get install -y doxygen

Downloading Regressiontests

It is better to download the regressiontests separately because most of the time it throws an error stating that “the location of the file has changed”. Copy and paste the following commands in your terminal:

$ cd Downloads/

$ wget http://gerrit.gromacs.org/download/regressiontests-2020.4.tar.gz

Now, extract the downloaded file,

$ tar xvzf regressiontests-2020.4.tar.gz

Downloading GROMACS

Download the latest release of GROMACS from here or use the following command:

$ wget ftp://ftp.gromacs.org/pub/gromacs/gromacs-2020.4.tar.gz

Installing GROMACS

First, get your pwd path using the following command:

$ pwd

Note down the displayed path, we will need it in later steps.

  • Extract the downloaded archive file. Move into the directory where you have downloaded the package. Let’s say, Downloads.

$ cd Downloads/

$ tar xvzf gromacs-2020.4.tar.gz

  • Now move inside the gromacs folder.

$ cd gromacs-2020.4/

  • Create a directory called “build-gpu” where we will keep our compiled binaries.

$ mkdir build-gpu

  • Move inside the build-gpu directory

$ cd build-gpu/

  • Now, make gromacs using cmake.

$ sudo cmake .. -DGMX_BUILD_OWN_FFTW=OFF -DREGRESSIONTEST_DOWNLOAD=OFF -DMAKE_C_COMPILER=gcc -DGMX_GPU=ON -DGMX_MPI=OFF -DREGRESSIONTEST_PATH=/your/pwd/path/here/Downloads/regressiontests-2020.4

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.

  • Now, let’s check and make.

$ make check

$ sudo make install

  • Move inside the unpacked regressiontests directory and execute the following command:

$ source /usr/local/gromacs/bin/GMXRC

After that, you can check for the successful installation of GROMACS with the following command:

$ gmx pdb2gmx --version

It will display the GPU version as well.

Enjoy the speedy simulation!

Dr. Muniba is a Bioinformatician based in New Delhi, India. She has completed her PhD in Bioinformatics from South China University of Technology, Guangzhou, China. She has cutting edge knowledge of bioinformatics tools, algorithms, and drug designing. When she is not reading she is found enjoying with the family. Know more about Muniba

Advertisement
3 Comments

3 Comments

  1. yoatzinpt

    December 29, 2020 at 1:22 am

    Having trouble retrieving anything from de GROMACS website, does anyone know if it is down for the holidays or something?

    Cheers.

  2. Yoatzin Peñaflor

    January 1, 2021 at 11:21 pm

    Hi, just wanted to say that this electronical magazine has helped me a lot. I finally managed to install GROMACS with GPU acceletarion, with little previous ubuntu experience. The most troublesome part was the installation of the CUDA toolkit, as installation with your instructions was nos successfull, but other than that, all was smooth sailing.

    A small observation, though: in the cmake compilation of GROMACS there is a small error. with the instructions “$ sudo cmake .. -DGMX_BUILD_OWN_FFTW=OFF _DREGRESSIONTEST_DOWNLOAD=OFF -DMAKE_C_COMPILER=gcc -DGMX_GPU=ON -DGMX_MPI=OFF -DREGRESSIONTEST_PATH=/your/pwd/path/here/Downloads/regressiontests-2020.4″ It should be -DREGRESSIONTEST_DOWNLOAD=OFF” with a “-” symbol instead of a “_”.

    Cheers and greetings from Mexico!

  3. [email protected]

    December 15, 2021 at 6:46 am

    I had some difficulties, but it was not hurd to fix. And I really thankful for this article. It was my last hope. And now I have this GPU support, thanks to you!

You must be logged in to post a comment Login

Leave a Reply

Bioinformatics Programming

Free_Energy_Landscape-MD: Python package to create Free Energy Landscape using PCA from GROMACS.

Dr. Muniba Faiza

Published

on

In molecular dynamics (MD) simulations, a free energy landscape (FEL) serves as a crucial tool for understanding the behavior of molecules and biomolecules over time. It is difficult to understand and plot a meaningful FEL and then extract the time frames at which the plot shows minima. In this article, we introduce a new Python package (Free_Energy_Landscape-MD) to generate an FEL based on principal component analysis (PCA) from MD simulation done by GROMACS [1].

(more…)

Continue Reading

MD Simulation

[Tutorial] Installing VIAMD on Ubuntu (Linux).

Dr. Muniba Faiza

Published

on

[Tutorial] Installing VIAMD on Ubuntu (Linux).

Visual Interactive Analysis of Molecular Dynamics (VIAMD) is a tool that allows the interactive analysis of molecular dynamics simulations [1]. In this article, we are installing it on Ubuntu (Linux).

(more…)

Continue Reading

MD Simulation

Energy minimization and equilibration of simple protein using NAMD & VMD.

Dr. Muniba Faiza

Published

on

Energy minimization and equilibration of simple protein using NAMD & VMD.

In this tutorial, we will perform energy minimization and equilibration of a simple protein using NAMD [1] & VMD [2]. We are using insulin (PDB ID: 2wfu) for this tutorial.

(more…)

Continue Reading

MD Simulation

Generating topology of molecule for AMBER forcefield for GROMACS.

Dr. Muniba Faiza

Published

on

Generating topology of molecule for AMBER forcefield for GROMACS.

In this article, we will generate the topology of a small molecule for AMBER forcefield to be used in MD simulation using GROMACS.

(more…)

Continue Reading

MD Simulation

How to visualize output plots of MD simulation (GROMACS)?

Dr. Muniba Faiza

Published

on

How to visualize output plots of MD simulation (GROMACS)?

Visualizing plots of molecular dynamics simulation is easy once you have generated them. Previously, we provided a few articles on MD output analysis (check the Further Reading section). This article explains how you can easily visualize the plots generated from GROMACS output. (more…)

Continue Reading

MD Simulation

How to solve ‘Could NOT find CUDA: Found unsuitable version “10.1”‘ error during GROMACS installation?

Dr. Muniba Faiza

Published

on

How to solve ‘Could NOT find CUDA: Found unsuitable version “10.1”‘ error during GROMACS installation?

Compiling GROMACS [1] with GPU can be trivial. Previously, we have provided a few articles on the same. In this article, we will solve an error frequently occurring during GROMACS installation.

(more…)

Continue Reading

MD Simulation

How to calculate number of steps (nsteps) for MD simulation run?

Dr. Muniba Faiza

Published

on

How to calculate number of steps (nsteps) for MD simulation run?

While doing molecular dynamics (MD) simulation, it can be difficult to calculate the number of steps or nsteps for an MD run accurately. In this article, we will learn to calculate nsteps for an MD run. (more…)

Continue Reading

MD Simulation

How to install GROMACS on Apple M1 (MacOS)?

Dr. Muniba Faiza

Published

on

Installing GROMACS on Apple M1 (MacOS)

We have provided a few articles on GROMACS installation on Ubuntu. In this article, we are going to install GROMACS [1] on Mac OS. (more…)

Continue Reading

MD Simulation

How to take snapshots of structure at specific times in GROMACS?

Published

on

How to take snapshots of structure at specific times in GROMACS?

It is important to see the behavior of protein during an MD simulation. This can be achieved by taking snapshots in the form of PDB format. In this article, we have provided a few commands that you can use to take snapshots of a complete system or protein during MD simulation. (more…)

Continue Reading

MD Simulation

GROMACS: Uses & Applications

Dr. Muniba Faiza

Published

on

GROMACS: Uses & Applications

GROMACS stands for GROningen MAchine for Chemical Simulations [1]. It is a very popular and one of the most widely used open-source bioinformatics software. It is generally used for molecular dynamics simulation of macromolecules. In this article, we will explain its uses and applications in bioinformatics studies. (more…)

Continue Reading

MD Simulation

Easy installation of GROMACS on Ubuntu 18.04 & 20.04

Dr. Muniba Faiza

Published

on

Installing GROMACS on ubuntu

We have provided several articles on GROMACS [1] installation on Ubuntu including the easy installation method for GROMACS version 5.x.x. In this article, we will provide shell scripts to install the latest (2021 series) of GROMACS on Ubuntu 18.04 and 20.04. (more…)

Continue Reading

MD Simulation

How to create an index file in GROMACS for MD simulation?

Dr. Muniba Faiza

Published

on

How to create an index file in GROMACS for MD simulation?

MD simulation is a tricky technique if you don’t understand what you are doing through various parameters and algorithms in GROMACS [1]. That may lead to several errors. In this article, we are going to create an index file for the protein groups in GROMACS to solve such errors. (more…)

Continue Reading

MD Simulation

How to generate topology of small molecules & ligands for MD Simulation?

Dr. Muniba Faiza

Published

on

generate topology of small molecules & ligands for MD simulation

Generating the topology of small molecules/ligands is an important step in molecular dynamics (MD) Simulation. We explained it in previous articles as part of MD simulation tutorials. In this article, we will explain how can you generate the topology of ligands for MD simulation of complex or small molecules only. (more…)

Continue Reading

MD Simulation

Tutorial: MD Simulation of small organic molecules using GROMACS

Dr. Muniba Faiza

Published

on

MD Simulation of small molecules

GROMACS [1] offers a vast range of functions when it comes to molecular dynamics simulation. Today, we are going to explore it for the simulation of small organic molecules. (more…)

Continue Reading

MD Simulation

Tutorial: MD simulation with mixed solvents using GROMACS

Dr. Muniba Faiza

Published

on

MD simulation with mixed solvents

In this tutorial, we are performing MD simulation in mixed solvents of methanol and water using GROMACS [1,2]. You can follow our previous articles for MD simulation of a simple protein and a protein-ligand complex. (more…)

Continue Reading

MD Simulation

Tutorial: MD simulation output analysis of a complex using GROMACS

Dr. Muniba Faiza

Published

on

MD simulation output analysis of a complex using GROMACS

We have provided several tutorials on molecular dynamics (MD) simulation (please check further reading section). They include installation of simulation software, simulation of a simple protein, and a complex. In this article, we will analyze the GROMACS [1] output of MD simulation of a complex. (more…)

Continue Reading

MD Simulation

How to submit MD simulation job on a cluster server using PBS script?

Dr. Muniba Faiza

Published

on

MD Simulation on cluster server

Molecular dynamics (MD) simulation is one of the most widely used methods in bioinformatics. It needs high computation time and therefore, performed on workstations and servers. It requires software to upload and download files to and from the server. In this article, we have explained how to submit MD simulation jobs on cluster computers using PBS scripts. (more…)

Continue Reading

MD Simulation

Installing GROMOS96 on Ubuntu

Dr. Muniba Faiza

Published

on

Installing gromos96 on Ubuntu

GROMOS96 is a well-known software package used for biomolecular simulations [1]. It can be used for the molecular dynamics simulation of protein, peptide, and protein-ligand complex as well. In this article, we will install GROMOS96 on Ubuntu. (more…)

Continue Reading

MD Simulation

MD Simulation using GROMACS: Things to remember

Dr. Muniba Faiza

Published

on

MD Simulation

Molecular dynamics (MD) simulation is considered amongst the important methods in bioinformatics. Installation of MD simulation software and execution of their commands is critical. It requires several parameters to be considered before performing simulations. A single mistake may result in impractical outputs. In this article, we will discuss such important things to remember during the MD simulation and installation and execution of its software (GROMACS) [1,2]. (more…)

Continue Reading

MD Simulation

Video Tutorial: MD Simulation using GROMACS

Dr. Muniba Faiza

Published

on

Video Tutorial: MD simulation using GROMACS

This is a video tutorial of our existing article “Molecular Dynamics (MD) Simulation using GROMACS“.

Continue Reading

LATEST ISSUE

ADVERT