Step 2: Running your simulations in Gromacs

Since there are already many Gromacs tutorials available online, this tutorial only covers the absolute basics of Gromacs, plus special instructions (of which there are very few) for structure-based simulations.

In order to run a simulation in Gromacs, you need three files: a .mdp file, a topology file and a gro file (produced in Step 1 of our tutorial). The .mdp file tells Gromacs what settings you would like to use for the simulation (such as the temperature, the time step and the temperature coupling constant). A sample .mdp file for structure-based models is available here. The topology file gives Gromacs all of the specifics of your Hamiltonian. In our case, the .top file tells Gromacs about all the interactions that define a structure-based model. The gro file tells Gromacs more information about the atoms, including their coordinates and the size of the simulation box.

Once you have these three files, there are only 2 Gromacs commands necessary to run your simulation.

First, produce a portable xdr file (in this case, run.tpr) that describes your simulation. This file is platform independent and contains all parameters for your simulations. This allows you to produce a tpr file on any machine, and then move it to another machine and run your simulation. The xdr file is produced by grompp (part of the Gromacs distribution):
grompp -f mdpfile.mdp -c gro_file.gro -p -o run.tpr
Here are sample MDP files for the All-Atom model and the Calpha model. They will give you an idea of the basic, necessary, settings. It is up to you to tailor them to your specific needs.

Run the All-Atom simulation by calling the molecular dynamics module of Gromacs and tell it to read run.tpr:

mdrun -s run.tpr
Or, run the Calpha simulation: When running the Calpha model, a 10-12 potential is used instead of a 6-12 potential. (Why use a 10-12 for Calpha?) You MUST: 1) provide the 10-12 lookup table, 2) indicate that you want to use the tables by modifying your mdp file and 3) issue mdrun with the following flags:
mdrun -s run.tpr -table table_file.xvg -tablep table_file.xvg
A sample CA mdp file can be found here. This script will make tables for Gromacs version 4.x. WARNING: Using a table for V4 with V3 will cause serious problems.

To run a simulation in parallel, use the command:

mpirun -np NUMOFNODES mdrun_mpi -s run.tpr -noddcheck
When running with mpi, you must have built mdrun with mpi support (here, we indicate that with a _mpi suffix). The second flag, -noddcheck, is necessary with this model because our model can confuse the dynamic load balancing utility of Gromacs V4. Additionally, you need to determine which version of mpi is best for you. This flag merely tells Gromacs not to worry. Running a simulation in parallel is highly dependent on your machine's configuration. You can consult the Gromacs help page for more information on the details of parallel simulations.

Congratulations! You have now successfully simulated a structure-based model in Gromacs. Now that you have the technical details under control, let's see some good science. Good luck.

Please direct questions and comments to
Page created and maintained by Jeff Noel and Paul Whitford