Gromacs explained

The easiest way to start using Gromacs

Gromacs.gif

Finally the time to speak about GROMACS is come. I'm still experimenting with GROMACS, so when you read something… think about it. I have not abandoned TINKER, but I have reached its limit (namely the I cannot compile it for the amount of atoms I need). Plus, I will have to move towards coarse grain models, and GROMACS is the right way to go. I think I will work with both the programs to try to get the best from both.

This wiki will never replace the official GROMACS wiki or the manual or the GROMACS mailing list (1, 2). As for the page dedicated to TINKER, I will report here my experience and how I do the things, hopefully in the right way (if not, please tell me, I'm open to discussion). My suggestion is to read this wiki with an eye on the official documentation and support and always be critical about what you read here. ;)

Obtaining GROMACS

GROMACS is a versatile package to perform molecular dynamics, i.e. simulate the Newtonian equations of motion for systems with hundreds to millions of particles.
It is primarily designed for biochemical molecules like proteins, lipids and nucleic acids that have a lot of complicated bonded interactions, but since GROMACS is extremely fast at calculating the nonbonded interactions (that usually dominate simulations) many groups are also using it for research on non-biological systems, e.g. polymers. (From GROMACS wiki)
You can download GROMACS here.
Today (December, 7th 2009) version 4.0.7 was release. Gromacs

License agreement and references

GROMACS is freeware and distributed under GNU General Public License
Selected references for GROMACS:
Berendsen, et al. (1995) Comp. Phys. Comm. 91: 43-56.
Lindahl, et al. (2001) J. Mol. Model. 7: 306-317.
van der Spoel, et al. (2005) J. Comput. Chem. 26: 1701-1718.
Hess, et al. (2008) J. Chem. Theory Comput. 4: 435-447.

Force Field parameter sets

GROMACS is shipped with many customized force field (FF) parameter sets for proteins, organic molecules, inorganic systems and so on. Here the list of the available FF (TINKER 4.2):

  • AMBER
  • CHARMM
  • COARSE GRAINING FORCE FIELS
  • GROMOS
  • OPLS

A description for the FFs is here.

Compile GROMACS (linux) in serial and parallel (mpi/openmpi)

GROMACS can be (quite) easily installed on linux, at least in a standard way:

./configure --prefix=/home/user/gmx
./make
./make install

The executables will then be created in /home/user/gmx/bin. Much compete instructions can be found here.

If you want to compile gromacs in parallel, you will need mpi or openmpi installed. Actually, the only executable you need to compile for mpi is mdrun. So, install gromacs in the usual way and then execute

./configure --prefix=/home/user/gmx --program-suffix=_mpi --enable-mpi
./make mdrun
./make install-mdrun

In this way you will find the executable mdrun_mpi for parallel use.
In order to submit openmpi parallel calculation on two nodes on my Ubuntu desktop, I needed to start lamboot and then execute mdrun_mpi as following:

mpiexec.openmpi -np 2 /home/user/gmx/bin/mdrun_mpi

If you are too scared to compile your version of GROMACS, you can try to see if a recent version is available in the repositories of your linux distribution, e.g. Ubuntu.

Submit GROMACS calculation on clusters using a queuing system

Here some examples of scripts used to submit GROMACS calculations on different clusters and different queuing systems.

  • If you are in my lab, the following two scripts works for the ISCF cluster in Namur:

1. Serial version

#!/bin/bash
#$ -l virtual_free=4G
#$ -l h_cpu=00:10:00
#$ -N gromacs

module load gromacs

grompp -c b13824_steeped.gro -o b13824.top -p b13824_mdHP.tpr
mdrun -s b13824_mdHP.tpr -deffnm b13824_equil -maxh 10

2. Parallel version

#!/bin/bash
#$ -l virtual_free=4G
#$ -l h_cpu=00:10:00
#$ -pe gromacs_smp 2
#$ -N gromacs

module load gromacs

grompp -c b13824_steeped.gro -o b13824.top -p b13824_mdHP.tpr
mdrun -s b13824_mdHP.tpr -deffnm b13824_equil -maxh 10
  • Here some working drafts for a gromacs submitting scripts for the new cluster in the lab (lucky and william):

1. Serial version

 #!/bin/bash
#PBS -l nodes=1:ppn=1,walltime=50:00:00,mem=2gb
#PBS -M your_mail_address
# Send me mail when job begins end and aborts 
#PBS -m bea
#PBS -N jobname

# grompp is executed out the script
export tpr=md

cd /scratch

# create new dir with unique name nased on jobid
export dirname=$PBS_JOBID
mkdir /scratch/$dirname

cd $PBS_O_WORKDIR

cp $tpr.tpr /scratch/$dirname
cd /scratch/$dirname

# execute mdrun
~/software/gmx4.0.7/bin/mdrun -s $tpr.tpr -deffnm aggregate-md

#move back the data (entire directory)
mv /scratch/$dirname $PBS_O_WORKDIR

Troubleshooting, aka WTF?!

pdb2gmx seems to be stuck and my cpu is used at 99%

Are you trying to create a gro file using custom .atp, .rtp and .itp files? Yeah, I got myself in this situation too and what I noticed was that I had an empty line at the end of my .atp file. It seems pdb2gmx does not handle this very well.

Tip and Tricks, aka How can I do this and that?

Cleanup Gromacs working dir: better safe than sorry

Gromacs writes a huge number of files in the working dir: log files, restarting files and backup files… a lot of backup files. Usually I "amuse" myself with

rm -f *# md* ener* traj*

in particular when I'm setting up the system and not everything is working like a charm. And then, of course, sometimes a typo slips in:

rm -rf * # md* ener* traj*

did you notice the devil space between * and #? eh…
So, here a small bash script, I called cg, to avoid the problem:

#!/bin/bash
# This script is used to safately clean up the unwanted files
# stored in a directory. If ' * ' is detected in the list
# of files to remove, the script will die without remove
# any file. This is convenient when working with gromacs
# directories and files.
# Author: Andrea Minoia
# Mail: minoiaa@gmail.com / http://chembytes.wikidot.com

#counts only files that can be actually removed in the current dir with rm -f
ref=`find . -maxdepth 1 -type f -print | wc -l`
echo "Number of files you ask to delete: $#/$ref"
echo ""
if [ "$#" -ge "$ref" ]
then
echo '===8o| you were about to delete all the files'
exit
fi

rm -f $@

The script works exactly as rm -f but it counts the number of files you are asking to delete and compare it with the number of files present in the directory. If you are going to delete all the files, an error is prompt and no file will be cancelled. Better Safe than sorry ;)

gro file: format and unit cell

The gro file contains the atomic coordinates and the size (and shape) of the unit cell. The file is fix format, so if you need to write a gro file using your home made script, here the right format: Read more...

Modelling Carbon Nanotubes

Online there are many documents about GROMACS and Carbon Nanotube (CNTs) (1, 2, 3, ...). Even after lots of reading I didn't find what I was looking for: a clear and simple guide to model single- or multi-wall carbon nanotubes (SWNT, MWNT), either periodic and non-periodic.
It takes me a while to find this procedure that does the things as I wanted. I needed a program to build a periodic CNT and create the topology for GROMACS using x2top. Read more...

Organize your files with mdrun

As told previously, gromacs writes a lot of files, in particular mdrun. You can assign to all those file the same name using the mdrun option -deffnm.

Polymer chains: the Polyamide 6 test case

coming soon …

Comments

Add a New Comment
or Sign in as Wikidot user
(will not be published)
- +
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License