From: Jérôme Hénin (jerome.henin_at_uhp-nancy.fr)
Date: Thu Sep 01 2005 - 02:05:32 CDT

Hi Daniel,

How about this:

set s [atomselect top "within 5 of segname Foo"]
set nf [molinfo top get numframes]

for {set f 0} {$f < $nf} {incr f} {
    $s frame $f
    $s update
    set n [$s num]
    puts "Frame $f - $n atoms in selection"
}

You could also write the results directly to a file.
Jerome

> Hey you vmd scripting wizards, forgive me if this has been asked (and
> answered) before. I looked through the archive and saw your script for
> counting hydrogen bonds ("hbonds time series"), but I have something even
> easier (I think) that I'd like to do: count atoms/residues/etc that qualify
> for a given selection. For example, if I ask for say "resname SOD within 7
> of nucleic" the script would return a number. This could then be started in
> tandem with "selection_update". When you "play" the trajectory, you'd then
> get a selection time series.
>
> Thanks in advance for your help.
>
> Daniel
>
> Daniel Barsky, Ph.D.
> University of California/
> Lawrence Livermore National Lab
> 7000 East Avenue, L-448
> Livermore, CA 94550
>
> Phone: 925-422-1540 Fax: 925-424-6605
> Secretary: 925-424-2422 (8 to 5 Pacific Time)
> Email: barsky_at_LLNL.GOV
> WWW: http://compbio.llnl.gov/barsky

-- 
Jérôme Hénin
Equipe de Dynamique des Assemblages Membranaires
Université Henri Poincaré / CNRS
Tel : (33) 3 83 68 43 95        Fax : (33) 3 83 68 43 71
http://www.edam.uhp-nancy.fr/