From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Wed Jul 28 2010 - 06:55:13 CDT

dear asmaa,

there are multiple issues with the quoted script:

On Wed, Jul 28, 2010 at 5:14 AM, Asmaa Elsheshiny <pyaaea_at_leeds.ac.uk> wrote:
> Dear community,
>
> I have some diffculties in running a script in vmd, to display the dipole vector for each frame of my protein. After running the script in dipole.tcl, i got this error message
> can not find channel named "-29.5305614471 27.6423969269 8.45355415344"
>
> My script is as follow.
>
> set molid 0
>    set frame [molinfo $molid get frame]
>    if {[info exists dipdata($frame)]} then {

>                                                                    9
>       Visualization and Analysis of Quantum Chemical and Molecular Dynamics Data with VMD

this text seems to be left over from incorrect cut-n-paste.

>        if {[info exists dipgraph]} then {
>               foreach g $dipgraph {
>                  graphics $molid delete $g
>               }
>        }
>        graphics $molid color yellow
>        lassign $dipdata($frame) cnt vec
>        #                                                               scaling res        radius
>        set dipgraph [vmd_draw_vector $molid $cnt $vec 100000.0 10                          0.08]
>    }
> }
> #estimate the dipole moment
> set sel [atomselect 0 "not name X"]
> set n [molinfo 0 get numframes]
> for {set i 0} {$i < $n} {incr i} {
>    # advance selection to the current frame and update.
>    $sel frame $n
>    $sel update
>    set dipdata($i) [list [measure dipole $sel -debye -masscenter] [gets $dip]]

this line looks very suspicious: what is the purpose of the [gets $dip]?
you didn't open a file channel and assigned it to dip. this is the probable
origin of the error message.

> }
> close $dip

and closing a file that is not open, will give an error as well.

> # connect to vmd_frame
> trace variable vmd_frame(0) w do_dipdraw
> animate goto 0
>
> I am not familiar with TCL language, so I was trying to modify the script given by axel's tutorial
> “Visualization and Analysis of Quantum Chemical and Molecular Dynamics Data with VMD”

well, even only modifying existing scripts requires some knowledge
of the script language. at least working your way through the Tcl
tutorial http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html
is therefore highly recommended.
you can avoid cut-n-paste errors from lifting scripts off the pdf,
by downloading the original script files from:
http://klein-group.icms.temple.edu/cpmd-vmd/files.html

but you may not even need to go through all those steps,
and use the dipole watcher plugin that is integrated into
VMD instead: http://www.ks.uiuc.edu/Research/vmd/plugins/dipwatch/

cheers,
    axel.
>

-- 
Dr. Axel Kohlmeyer    akohlmey_at_gmail.com
http://sites.google.com/site/akohlmey/
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.