From: Thomas Evangelidis (
Date: Fri Nov 25 2011 - 13:51:07 CST

Shouldn't it be "water within 3 of..."?

Also $sel contains the _atom_ indices of all the waters you have selected,
therefore the number you print is 3x the number of waters. To get the
actual number of waters use the keyword "oxygen". There will probably be no
difference in the results in your case, but I prefer using "same residue
as" instead of "same fragment as" to select water. Therefore I would use
the following atomselection string:

(same residues as (water within 3 of protein (resid 72 376 100 373 and (not
waters)))) and oxygen

Finally you might find this plugin interesting:


On 25 November 2011 20:16, Ban Arn <> wrote:

> Dear vmd users
> I am calculating the number of water molecules present in 3A of some
> residues.
> This is the script i'm using
> set mol [molinfo top]
> set out [open result_water_cluster2.txt w]
> set sel [atomselect $mol {same fragment as (water within 2 of protein
> (resid 72 376 100 373 and (not waters)))}]
> set frames [molinfo $mol get numframes]
> for {set i 0} {$i < $frames} {incr i} {
> $sel frame $i
> $sel update
> set n [$sel num]
> puts $out "$i $n"
> }
> However the problem is the output of the number of water molecules doesn't
> match with visual inspection of trajectories.
> Kindly advice me what is going wrong in the script.
> Many Thanks
> Balaji

Thomas Evangelidis
PhD student
Biomedical Research Foundation, Academy of Athens
4 Soranou Ephessiou , 115 27 Athens, Greece