From: Myunggi Yi (myunggi_at_gmail.com)
Date: Tue Mar 20 2007 - 20:09:06 CDT

Dear VMD users,

I have modified a script from the image-movie tutorial (pore.tcl)
to display two molecules in a window at the same time.

The following is the script.
If I add arrows in the second molecule, I can't display any arrows.
Would you give me a hand?

proc enabletrace {} {
    global vmd_frame
    trace variable vmd_frame([molinfo top]) w drawcounter
}

proc disabletrace {} {
    global vmd_frame
    trace vdelete vmd_frame([molinfo top]) w drawcounter
}

proc enabletrace2 {} {
    global vmd_frame2
    trace variable vmd_frame(1) w drawcounter2
}

proc disabletrace2 {} {
    global vmd_frame2
    trace vdelete vmd_frame(1) w drawcounter2
}

set pore_draw_arrows 0

proc enablearrows {} {
    global pore_draw_arrows
    set pore_draw_arrows 1
}

proc disablearrows {} {
    global pore_draw_arrows
    set pore_draw_arrows 0
}

proc vmd_draw_arrow {mol start end} {
    # an arrow is made of a cylinder and a cone
    set end [vecadd $start [vecscale 1.5 [vecsub $end $start]]]
    set coneEnd [vecadd $end [vecscale 0.25 [vecsub $end $start]]]
    graphics $mol cylinder $start $end radius 0.5
    graphics $mol cone $end $coneEnd radius 1.0
}

proc drawcounter { name element op } {
    global vmd_frame
    global pore_draw_arrows

    draw delete all
    draw material Opaque

    # Draw the arrows
    if { $pore_draw_arrows } {
        for { set id 1 } { $id < 6 } { incr id } {
            set tmpSel1 [atomselect 0 "segid $id and resid 51 200 and name CA" \

         frame $vmd_frame([molinfo top])]
            foreach {coorIN coorOUT} [$tmpSel1 get "x y z"] { break }

            draw color black
            vmd_draw_arrow top $coorOUT $coorIN

            $tmpSel1 delete
        }
    }
}

proc drawcounter2 { name element op } {
    global vmd_frame2
    global pore_draw_arrows

# draw delete all
    draw material Opaque

    # Draw the arrows
    if { $pore_draw_arrows } {
        for { set id 1 } { $id < 6 } { incr id } {
            set tmpSel2 [atomselect 1 "segid $id and resid 51 200 and name CA" \

 frame $vmd_frame(1)]
            foreach {crdIN crdOUT} [$tmpSel2 get "x y z"] { break }

                draw color black
            vmd_draw_arrow 1 $crdOUT $crdIN

            $tmpSel2 delete
        }
    }
}

-- 
Best wishes,
MYUNGGI YI