From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Dec 01 2004 - 10:02:22 CST

Lubos,
  In order to update your atom selection with a trajectory (when the
displayed frame changes), you need to enable the "update selection every frame"
button in the "Trajectory" tab found in the graphical representations window.

You can count the number of atoms in a selection like this:
  set sel [atomselect top "my selection text"]
  $sel num

If you want the number of residues, a cheap way of getting that is to add
"and name CA" to your selection, so you get one atom per residue, then
use $sel num to return the residue count.
  set sel [atomselect top "my selection text and name CA"]
  $sel num

  John Stone
  vmd_at_ks.uiuc.edu

On Wed, Dec 01, 2004 at 04:25:53PM +0100, Lubos Vrbka wrote:
> good afternoon to everybody,
>
> i've used vmd for long time, but i've just started using it for more
> than only display... i tried to find a solution to my problem described
> below, but i didn't have luck :(
>
> i want to do analysis of distribution of given species around the
> protein in solution,e.g. i want to know how many hexanol molecules (HEX)
> are located within 5A of protein. so i use
> resname HEX and within 5 of protein
> (i tried another forms like (resname HEX) within 5 of protein, but these
> didn't work for me). this works fine, however the result is based on the
> frame that was displayed when this selection was entered... how can i
> force vmd (can i?) to recalculate the selection for every frame?
> interactively i click on "Apply" button in Graphical Representations
> dialog...
>
> vmd (correctly) displays only that parts of HEX residues that lie within
> the limit. from this it seems to me that the selection is based on
> atoms. i display the whole residues using
> same residue as (resname HEX and within 5 of protein)
> so vmd displays all residues that at least partially fulfill the
> distance constraint. however can i get somehow number of these residues?
>
> how can i do this analysis for the whole trajectory? i.e. i need vmd to
> print out to some text file nuber of residues satisfying the distance
> limit for each frame.
>
> i guess that this must have been asked and answered before... so any
> hints or pointers to the relevant information are greatly acknowledged.
>
> best regards,
> --
> Lubos
> _@_"

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349              
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078