From: Jérôme Hénin (jerome.henin_at_ibpc.fr)
Date: Sun Apr 24 2016 - 04:34:57 CDT

Hi Lena,

you can do that with a callback that creates and deletes the objects each
time the frame changes.

See an example in this post:
http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/20596.html

Jerome

On 24 April 2016 at 07:46, Lena Simine <lena.simine_at_rice.edu> wrote:

> Hi,
> Can't figure out how to prevent the added graphics or new representations
> from "accumulating" in a trajectory.
> I'd like to make a selection which differs in each frame and do something
> to it, like add graphics or add a representation
> for that selection in that frame alone.
> Instead I end up with *all* of my graphics/representations on *all*
> frames..
>
> Any clues how to fix this? (sorry, a total newb)
>
> I'm doing something along the lines of this:
> set n [ molinfo top get numframes ]
> for {set i 0} {$i < $n} {incr i} {
> set sel_text [lindex $data2 $i]
> set sel2 [atomselect top "serial $sel_text"]
> $sel2 frame $i
> set xyz [$sel2 get {x y z}]
> set xyz2 [split {*}$xyz]
> graphics top sphere $xyz2 radius 4
> }
>
> or with representations
>
> set n [ molinfo top get numframes ]
> for {set i 0} {$i < $n} {incr i} {
> set sel_text [lindex $data2 $i]
> mol representation beads 1 68
> mol selection $sel_text frame $i
> mol material Transparent
> mol addrep top
> }
>
> Cheers,
> Lena
>
>