From: Bryan Roessler (roessler_at_uab.edu)
Date: Thu Feb 02 2012 - 13:20:38 CST

Jeela,

set outDataFile [open filename.csv a]
set num_steps [molinfo top get numframes]
 for {set frame 0} {$frame < $num_steps} {incr frame} {
animate goto $frame
 display update ui
set sel1 [atomselect top "your sel"]
        set index1 [list [$sel1 get index]]
                set val1 [llength $index1]
puts $outDataFile "$frame, $val1"
}
         unset
         close outDataFile

It's untested, but something like that should work.

On Wed, Jan 25, 2012 at 8:39 AM, jeela keel <jeela22_at_gmail.com> wrote:

> Hello VMD users,
>
> Is possible to count how many of same atomselect is in a list or how many
> times atomselect is selected? Using VMD , selected molecules that are close
> to different parts of protein and selected some molecules more than once
> and want to know how many times the same atomselect is been selected or how
> many of them are in the list per each frame.
>
> for example in frame 1 there are 4 of atomselect2345 (same molecule) and 5
> of atomselect8509 and so on.
>
> I have used the command llength and num before that counts how many atoms
> are in a list, but this time I need to count how many times each specific
> atomselect is selected in the same frame. then move to next frame where
> there are different atomselect that again change with next frame.
>
> I am trying to write a script to do the above but I am wondering if there
> is a command that can be useful to use in the script . Did anybody wrote
> something similar to what am trying to do or have any suggestion. Thank you
> for your help and suggestions.
>
> jeela
>