From: Stephanie Teich-McGoldrick (stephanietm_at_gmail.com)
Date: Thu Nov 07 2013 - 17:12:41 CST

Hello Leo,

I recently made a script to update my vmd selection every frame to show the
results of some data analysis. This code is based on a code that Axel
provided:
https://sites.google.com/site/akohlmey/random-hacks/vmd-representation-update

I am including my a stripped down version of my code as an additional
example. I haven't tested this reduced version, but the general idea will
work.

*****************************************************
proc do_toggle_selupdate {args} {
    global updmol count
    puts $count
    set frame [molinfo $updmol get frame]
    puts $frame

    if {$frame == 0} {
        if {$count == 10} {
            set count 5
            put $count
            set sel2 [atomselect top {index 0 7 8 9 10
10 }]
            $sel2 set name P
            color Name P purple
        } else {
            color Name P red
            set sel2 [atomselect top {index 0 1 2 3 4
5 }]
            $sel2 set name P
            color Name P purple
        }
    } elseif {$frame == 1} {
        color Name P red
        set sel2 [atomselect top {index 90220 109236 105244
97544 116288 131712 }]
        $sel2 set name P
        color Name P purple
    }
}
set updmol 0
set count 10
trace add variable vmd_frame($updmol) write do_toggle_selupdate

*****************************************************
In order to use this code, I do the following:

1. Load my vmd structure
2. Open up the tk console : Extensions -> Tk console
3. File -> log tcl commands to console (just so I can follow what I am
doing)
3. In the console I type "source Filename" to load my script

Hope this helps.
Cheers,
Stephanie

On Thu, Nov 7, 2013 at 2:37 PM, Leonhard Henkes <
leonhard.henkes_at_tu-dortmund.de> wrote:

> Dear VMD users,
>
> I would like to ask if there is a way to run a VMD Tcl script during an
> interactive MD run in NAMD and how it should or could be implemented ? For
> demonstration and lecturing, I setup a small system with two graphene
> sheets and a C60 ball. Now I would like to to change the color/material of
> a molecule and draw some text on the VMD screen, if a trigger point is
> passed.
> However I tried to add some VMD commands (atomselect, measure etc.) to my
> NAMD config, which didn't work. I also tried to add my conditionals into
> the VMD script, which manages the synchronization and representation by an
> for the IMD, but I couldn't manage to update my script for each frame
> during the IMD run.
>
> Thanks for your help and ideas,
> Leo
>
>