From: Norman Geist (norman.geist_at_uni-greifswald.de)
Date: Tue May 06 2014 - 01:44:43 CDT

Forgot, sorry. You can either update the atomselection with the "frame"
keyword, or use "animate goto $i" before atomselect takes place.

 

Norman Geist.

 

Von: Josh Vermaas [mailto:vermaas2_at_illinois.edu]
Gesendet: Montag, 5. Mai 2014 21:07
An: Ramin Ekhteiari; norman.geist_at_uni-greifswald.de
Cc: VMD Mailing List
Betreff: Re: vmd-l: number of water molecules within 5 angstroms of the
ligand

 

Hi Ramin,

You need to specify the frame of your atomselection/update your
atomselection:

set frames [molinfo top get numframes]

set fp [open "waters.txt" w]

set ligand "protein and resid 37"
set a [atomselect top "(water within 7 of ($ligand) and oxygen)"]

for {set i 0} {$i < $frames} {incr i} {
                puts "Frame: $i"
                #Something like this will change the frame number and update
the selection as appropriate.
                $a frame $i
                $a update
                set num [$a num]
                puts $fp "$i $num"
                $a delete
}

close $fp

Its in the docs.
-Josh

On 05/05/2014 01:05 PM, Ramin Ekhteiari wrote:

Dear Norman,
I employed this script but it did not change the frames the only it writes
the frame No.

Cheers,
Ramin.

set frames [molinfo top get numframes]

set fp [open "waters.txt" w]

set ligand "protein and resid 37"

for {set i 0} {$i < $frames} {incr i} {
                puts "Frame: $i"
                set a [atomselect top "(water within 7 of ($ligand) and
oxygen)"]
                set num [$a num]
                puts $fp "$i $num"
                $a delete
}

close $fp
Out put is :
0 11
1 11
2 11
3 11
4 11
5 11
6 11
7 11
8 11
9 11
10 11
11 11
12 11
13 11
14 11
15 11
16 11
17 11
18 11
19 11
20 11
21 11
22 11
23 11
24 11
25 11
26 11
27 11
28 11
29 11
30 11