GROMACS

Contents

In this guide, we will cover how to set up and run GROMACS simulations, a versatile molecular dynamics simulator built into the Inductiva API.

We will cover:

  • Configuring GROMACS simulations with the necessary input files.

  • Example code to help you get started with simulations.

GROMACS#

GROMACS is widely used for simulating biochemical molecules like proteins, lipids, and nucleic acids, but its speed and efficiency make it suitable for a range of non-biological systems, including polymers and fluid dynamics.

A typical GROMACS simulation consists of several stages: preparing the molecular structure, energy minimization, running the simulation, and analyzing the results. You’ll need multiple input files to configure and run your simulation, and specific GROMACS commands will be used to carry out each step.

Example Code#

In the following example, we run a basic molecular dynamics simulation of water molecules in a small box:

"""GROMACS example."""
import inductiva

# Instantiate machine group
machine_group = inductiva.resources.MachineGroup("c2-standard-4")
machine_group.start()

input_dir = inductiva.utils.download_from_url(
    "https://storage.googleapis.com/inductiva-api-demo-files/"
    "gromacs-input-example.zip",
    unzip=True)

commands = [
    "gmx solvate -cs tip4p -box 2.3 -o conf.gro -p topol.top",
    ("gmx grompp -f energy_minimization.mdp -o min.tpr -pp min.top -po min.mdp "
     "-c conf.gro -p topol.top"),
    "gmx mdrun -s min.tpr -o min.trr -c min.gro -e min.edr -g min.log",
    ("gmx grompp -f positions_decorrelation.mdp -o decorr.tpr -pp decorr.top "
     "-po decorr.mdp -c min.gro"),
    ("gmx mdrun -s decorr.tpr -o decorr.trr -x  -c decorr.gro -e decorr.edr "
     "-g decorr.log"),
    ("gmx grompp -f simulation.mdp -o eql.tpr -pp eql.top -po eql.mdp "
     "-c decorr.gro"),
    ("gmx mdrun -s eql.tpr -o eql.trr -x trajectory.xtc -c eql.gro -e eql.edr "
     "-g eql.log"),
]

gromacs = inductiva.simulators.GROMACS()

task = gromacs.run(input_dir=input_dir, commands=commands, on=machine_group)

task.wait()
task.download_outputs()

machine_group.terminate()