From: Axel Kohlmeyer (
Date: Wed Aug 15 2007 - 12:51:30 CDT

On Wed, 15 Aug 2007, Arneh Babakhani wrote:

AB> I see, ok, thanks for the clarification (I didn't know the index keyword
AB> was internal),

just for completeness, so is serial (it is index+1).

the atom index number in pdb or gro files is lost
on reading only the residue index is preserved
(cf. residue vs resid. the first is internal and unique
and the second is what was read from the file).

VMD being a c/c++ code uses c-style list indexes.


AB> appreciate the help,
AB> Arneh
AB> Peter Freddolino wrote:
AB> > Hi Arneh,
AB> > in VMD, the "index" keyword is defined internally, not by the input
AB> > file, and is always a zero-indexed list of the atoms. If you want a
AB> > 1-indexed list instead, try using the "serial" keyword instead.
AB> > Peter
AB> >
AB> > Arneh Babakhani wrote:
AB> >
AB> >> Hi
AB> >>
AB> >> I noticed that gro files (structure files from GROMACS) start with an
AB> >> atom index = 1. When you read in the gro file, vmd sets the indices
AB> >> back one, so the atom in the gro file with index=1 is now index = 0.
AB> >>
AB> >> Case in point (an excerpt from the gro file):
AB> >> Protein in water
AB> >> 99776
AB> >> 1GLN N 1 4.241 3.617 2.284 -0.6878 0.3661 -0.3811
AB> >>
AB> >>
AB> >> in the vmd tcl console:
AB> >> % set temp [atomselect top "index 0"]
AB> >> $temp get name
AB> >> N
AB> >> $temp set index 1
AB> >> atomsel object: set: data not modifiable: index
AB> >>
AB> >>
AB> >> My question is, how do you change the index values so they can match
AB> >> what's in the gro file? (This is important if you want to make
AB> >> atomselections, to define groups, to be used later with the GROMACS
AB> >> analysis scripts).
AB> >>
AB> >> Thanks,
AB> >>
AB> >> Arneh
AB> >>
AB> >
AB> >

Axel Kohlmeyer
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
If you make something idiot-proof, the universe creates a better idiot.