From: Axel Kohlmeyer (axel.kohlmeyer_at_theochem.ruhr-uni-bochum.de)
Date: Wed Jul 27 2005 - 07:36:48 CDT

On Tue, 26 Jul 2005 ioana_at_pegasus.arc.nasa.gov wrote:

IC> Hi all,

dear ioana,

please re-check your scripts carefully.

residue is the internal residue number in VMD this
number is guaranteed to be unique and starts from 0.

resid is the residue number from the PBD/PSF file
and may _not_ be unique (it is taken as is).
this number will start from 1 in case of a standard
conformant PDB file. but for quite few PDB files
there are residues missing (e.g. in sloppy areas),
where the sequence is known, but the coordinates are not.

you must not feed the result of get resid to a selection
with residue and vice versa (as done below).

best regards,
        axel.

IC>
IC> I am trying to output the name/id of a simple selection througout a
IC> trajectory file.
IC> I read in the pdb file, set up the selection
IC> set nb [atomselect top "protein and same residue as within 3 of resname
IC> RC5"]
IC> ask for the resid/resname
IC>
IC> lsort -unique [$nb get resid]
IC> 325
IC> lsort -unique [$nb get resname]
IC> ASN
IC>
IC> When I want to get that from a script and write the results in a file I
IC> get a totally different answer:
IC> set frame 0
IC> animate goto $frame
IC>
IC> set residues [lsort -unique [[atomselect top "protein and same residue as
IC> within 3 of resname RC5" frame $frame ] get residue ]]
IC> puts $residues
IC> 324
IC>
IC> set rn [atomselect top "protein and resid $residues"]
IC> set inform [lsort -unique [$rn get "resid resname"]]
IC> {324 ALA}
IC>
IC> The PDB file has indeed the 1-based counter while TCL when it reads the
IC> file in renumbers the residues according to a 0-based counter. However as
IC> long as it's one or the other the results should be the same. There should
IC> be no mixing between the two, or else results that output into the result
IC> file are incorrect.
IC>
IC> However if I set up the "residues" selection as set residues [lsort
IC> -unique [[atomselect top "protein and same residue as within 3 of resname
IC> RC5" frame $frame ] get resid ]]
IC> It gives the correct number
IC> puts $residues
IC> {325 ASN}
IC>
IC> What is the difference when setting up the atomselect command and asking
IC> to
IC> get residue
IC> versus
IC> get resid
IC>
IC> Why is one 0-based and the other 1-based?
IC>
IC> THanks,
IC> Ioana
IC>
IC>

-- 
=======================================================================
Dr. Axel Kohlmeyer   e-mail: axel.kohlmeyer_at_theochem.ruhr-uni-bochum.de
Lehrstuhl fuer Theoretische Chemie          Phone: ++49 (0)234/32-26673
Ruhr-Universitaet Bochum - NC 03/53         Fax:   ++49 (0)234/32-14045
D-44780 Bochum  http://www.theochem.ruhr-uni-bochum.de/~axel.kohlmeyer/
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.