Running a simulation in Gromacs
Overview of SMOG models 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). 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.
SMOG models in Gromacs Version 4
After preparing the .mdp, .gro and .top files, there are only two 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 simulation. This allows you to produce a tpr file on any machine, move it to another machine and then run your simulation. The xdr file is produced by grompp (part of the Gromacs distribution):
grompp -f mdpfile.v4.mdp -c gro_file.gro -p top_file.top -o run.tprHere are sample MDP files (Gromacs V4, only) 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 telling it to read run.tpr:
mdrun -s run.tprOr, 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.xvgA sample Calpha mdp file for use with Gromacs V4 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 -noddcheckIn order to run parallel calculations, you must have built mdrun with mpi, thread-mpi or openMP support (mpirun is only necessary when using mpi-supported code). The second flag, -noddcheck, is necessary because SMOG models 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.
SMOG models in Gromacs Version 5
Similar to version 4, you only need the .mdp, .gro and .top files in order to run a simulation. However, there are some differences in the entries in the mdp file. Also, Gromacs 5 uses the gmx interface for calling grompp and mdrun.Use grompp to produce the .tpr file.:
gmx grompp -f mdpfile.v5.mdp -c gro_file.gro -p top_file.top -o run.tprHere are sample MDP files (Gromacs V5, only) for the All-Atom model and the Calpha model.
Run the simulation with mdrun:
gmx mdrun -s run.tpr -noddcheckAs with Gromacs 4, the -noddcheck flag is only necessary when running parallel calculations.
Similar to earlier instructions, to run the Calpha model, use the command,
gmx mdrun -s run.tpr -table table_file.xvg -tablep table_file.xvg -noddcheckThe same lookup table may be used for Gromacs 4 (see above instruction), or 5.
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.
This resource is provided by the Center for Theoretical Biological Physics.
Please direct questions and comments to info@smog-server.org.
Page created and maintained by Jeff Noel and Paul Whitford