From: Alexander Balaeff (sure_at_ks.uiuc.edu)
Date: Thu May 01 1997 - 16:29:52 CDT

On Wed, 30 Apr 97, Jeff Ulrich wrote:
> Example 3 -- Updating Representations Such as Diffusing Waters
<...skipped...>
>
> trace variable vmd_frame([molinfo top]) w identify_close_waters
>
> proc identify_close_waters {args} { <...skipped...>

Thanks, Jeff, it was a useful posting. As a sort of a feedback: the overall
number of waters in the simulated system may be large whereas the number of
those visiting the vicinity of the target side chain is usually small. One
can speed up the performance of the script by first running over all the
frames of the simulations and putting all such waters into a single selection:

animate goto start

set visitors [atomselect top {waters and \
                (same residue as (within 3 of segname RET))}];

for { set i 1 } { $i < $number_frames } { set i [ expr $i + 1 ] } {
        animate next
        set vis_new [atomselect top {waters and \
                        (same residue as (within 3 of segname RET))}];
        set visitors [atomselect top {@visitors or @vis_new}];
}

Then, running your movie and re-selecting waters in the tracing procedure, you should
do a time-consuming distance-check ("within 3 of") only for the waters from "visitors"
selection. Non-"visitors" waters are going to stay drawn as lines anyways. This,
supposedly, will be faster.

> # Now update the representations to reflect new water
> # positions.
> mol representation Lines
> mol selection \
> "waters and (same residue as (not within 3 of segname RET))"

One writes instead:

mol selection \
        "@visitors and (same residue as (not within 3 of segname RET))"

> mol modrep $repID_1 $molID
> mol representation Licorice
> mol selection \
> "waters and (same residue as (within 3 of segname RET))"

One writes instead:

mol selection \
        "(@visitors) and (same residue as (within 3 of segname RET))"

> mol modrep $repID_2 $molID
> display update on

Good luck with all this stuff!

Alexander.

PS. Jeff, please correct me if I shoul use "$" instead of "@" in selections.
Sorry if I messed this up.