From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Tue Apr 17 2007 - 07:25:11 CDT

On Tue, 17 Apr 2007, Philipp Schoen1 wrote:

PS> Dear Alex

dear philipp,

PS> If I do something like set bin [atomselect top {2 <= x and x < 5}] I get
PS> all the wanted atoms of the water molecules (tested by writepdb test.pdb).
PS> But, if I chekc it by list $bin I see that the labeling (the integers of
PS> the index) is not correct. E.g.
PS> ATOM 9568 H2 TIP3 9250 4.264 10.733 -48.677 1.00 0.00 WT1
PS> H
PS> ATOM 9569 OH2 TIP3 5 3.668 10.176 13.191 1.00 0.00 WT2
PS> O
PS> ATOM 9570 H1 TIP3 5 3.224 10.545 12.387 1.00 0.00 WT2
PS> H
PS> ATOM 9571 H2 TIP3 5 3.092 10.473 13.913 1.00 0.00 WT2
PS> H
PS> The correct ones are index 9569, 9570 and 9571 (also shown in the test.pdb
PS> file). Calling the list $bin command, however results in 9568, 9569 and
PS> 9570. That is, all indices are reduced by one. Is it a bug?

no, this is intentional. index in VMD selections does _not_ refer to
the atom index label of a .pdb file but it the internal index number
(and as with any self-respecting c/c++ program it starts array indices
at 0), which is guaranteed to be unique. in fact, the pdb index is only
using internally in the pdb reader to analyze CONECT records.
you need the unique labeling of atoms (the pdb atom index is not
guaranteed to be unique, it is supposed to be reset with each molecule)
to make the second step of your analysis work!

cheers,
   axel.

PS>
PS> Gruezi Wohl!
PS> Philipp
PS>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   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.