[gmx-users] Re: Measuring hydrogen bonding in a specific region

Justin Lemkul jalemkul at vt.edu
Tue Jul 17 23:07:35 CEST 2012

On 7/17/12 4:57 PM, Andrew DeYoung wrote:
> Hi Justin,
> I am just curious, do you have experience writing such a shell script to
> iterate over the index files (one per frame)?  I am just curious, because I
> have been trying this, and I have found it very difficult to do using bash.
> Do you use a different shell language?
> Also, I wonder if anyone has ever posted such a shell script on this list.
> When I look through the archives, I don't see one, but I could be wrong.

Assume we have 100 groups of arbitrary size and a fixed group (index group 0) in 
the index file to which we wish to calculate hydrogen bonds.  Then assume we 
have 100 separate files (from trjconv -sep or whatever else) numbered 
sequentially, i.e. conf1.gro, conf2.gro...conf100.gro.  A simple bash script 
that runs through the index groups corresponding to each of these coordinate 
files would be something like:


for i in {1..100}
     echo 0 $i | g_hbond -s topol.tpr -f conf$i.gro -n index.ndx



Justin A. Lemkul, Ph.D.
Research Scientist
Department of Biochemistry
Virginia Tech
Blacksburg, VA
jalemkul[at]vt.edu | (540) 231-9080


More information about the gromacs.org_gmx-users mailing list