RETURN
Biotech
October 2021

GROMACS on Qarnot Cloud

GROMACS is one of the fastest and most popular molecular dynamics software packages. It is mainly designed for molecular dynamics simulations of proteins, lipids, and nucleic acids. It is free and open-source and can run on central processing units (CPUs) and graphics processing units (GPUs).

Version

The test case uses a GROMACS version 2021.2 in the 2021 series.

If you are interested in another version, please send us an email at qlab@qarnot.com.

Prerequisites

Before launching a computation task, please ensure that you already fulfill those requirements:

Test case

This test case is based on Justin A. Lemkul, Ph.D.’s lysozyme in water tutorial simulation. A tutorial from mdtutorials is available. The the mdp files, the pdb file from the Protein Data Bank and the the script to launch the simulation can be downloaded all at once via this zip. Unzip the lysozyme-in-water.zip folder to be able to use it on Qarnot.

Copy the following code in a sh script and place it in the lysozyme-in-water folder you unzipped before. It contains GROMACS instructions to run the simulation.

run_md.sh

#!/bin/bash

#--------------- Lysozyme in water --------------------#

. /usr/local/gromacs/bin/GMXRC

#-- Get a topology file, a position retrain file, a post-processed structure file
# spce is the water model
# 15: OPLS-AA/L all-atom force field (2001 aminoacid dihedrals)
echo 15 | gmx pdb2gmx -f 1aki.pdb -o 1aki_processed.gro -water spce

#-- Create the limits of the system
gmx editconf -f 1aki_processed.gro -o 1aki_newbox.gro -d 1.0 -bt cubic

#-- Fill the vaccum with water molecules
gmx solvate -cp 1aki_newbox.gro -cs spc216.gro -o 1aki_solv.gro -p topol.top

#-- Add ions to the system
gmx grompp -f ions.mdp -c 1aki_solv.gro -p topol.top -o ions.tpr
echo 13 | gmx genion -s ions.tpr -o 1aki_solv_ions.gro -p topol.top -pname NA -nname CL -nn 8

#-- Relax the system (energy minimization)
gmx grompp -f minim.mdp -c 1aki_solv_ions.gro -p topol.top -o em.tpr
gmx mdrun -v -deffnm em

#-- NVT simulation : constant Number of particles, Volume, and Temperature. Stabilize the temperature of the system
gmx grompp -f nvt.mdp -c em.gro -r em.gro -p topol.top -o nvt.tpr
gmx mdrun -v -deffnm nvt

#-- NPT simulation: Number of particles, Pressure, and Temperature are all constant. Stabilize the pressure
gmx grompp -f npt.mdp -c nvt.gro -r nvt.gro -t nvt.cpt -p topol.top -o npt.tpr
gmx mdrun -v -deffnm npt

#-- The system is now well-equilibrated at the desired temperature and pressure. Release the position restraints and run production MD for data collection
gmx grompp -f md.mdp -c npt.gro -t npt.cpt -p topol.top -o md_0_1.tpr
gmx mdrun -v -deffnm md_0_1

The reader can visit Lysozyme in water GROMACS Tutorial for more information about this script and results interpretation.

Launching the case

Copy the following code in a Python script and save it next to the lysozyme-in-water folder. Be sure you have copied your authentication token in the script (instead of MY_SECRET_TOKEN) to be able to launch the task on Qarnot.

gromacs.py

#!/usr/bin/env python3

import qarnot

# Create a connection
conn = qarnot.connection.Connection(client_token="MY_SECRET_TOKEN")

# Create a task
task = conn.create_task('md-gromacs', 'docker-batch', 1)

# Create a resource bucket and add iput files 
input_bucket = conn.create_bucket('md-gromacs-input')
input_bucket.sync_directory('input/')

# Attach the bucket to the task
task.resources.append(input_bucket)

# Create a result bucket and attach it to the task
output_bucket = conn.create_bucket('md-gromacs-output')
task.results = output_bucket

# Set the command to run when launching the container, by overriding a constant.
# Task constants are the main way of controlling a task's behaviour
task.constants['DOCKER_REPO'] = 'qarnotlab/gromacs'
task.constants['DOCKER_TAG'] = '2021.2'
task.constants['DOCKER_CMD'] = 'sh -c "./run_md.sh 2>&1 | tee output.log"'

# Submit the task to the Api, that will launch it on the cluster
task.submit()

Make sure that all input files mentioned above (1 pdb file, 5 mdp files, 1 sh file) are in the same folder named lysozyme-in-water. Your working directory should look like this:

To launch this script, open a terminal in your working directory and execute python3 gromacs.py &. It will launch the execution of run_md.sh on Qarnot and wait in the background until the execution is over to download the results (it can take up to 1h).

Results

At any given time, you can monitor the status of your task on our platform. You should now have an output folder in your working directory on your computer and a gromacs-out bucket containing all output files. You can for instance open the md_0_1.gro file to view the final result in using a viewing program such as VMD or with an online gro files visualizer such as Groview.

The GROMACS molecular dynamics simulation has several output files in the output folder. For more information, see the Analysis part of the Lysozyme in Water - GROMACS Tutorial by Justin A. Lemkul, Ph.D.

Wrapping up

That’s it! If you have any questions, please contact qlab@qarnot.com and we will help you with pleasure!

Return

Our articles