Quantcast
Viewing all articles
Browse latest Browse all 33

Use proc from inside another proc on TCL

I'm trying to write a script in tcl to execute some analysis on VMD. First I'm creating an atom selection inside a procedure, then I'm trying to use it on another procedure.

The atom selection from VMD is implemented as a Tcl function. The data returned from atomselect is the name of the function to use. You can read more here.

When I create the atom selection outside a proc I can use it inside one just passing it as global. But now that I'm creating it inside one, when I try to use it it's just a string with the procedure name.

Resuming,

This works:

set all [atomselect top all]proc test {} {    global all    $all num}test # Outuputs 7111

But this don't:

proc create {} {    global all    set all [atomselect top all]}proc test {} {    global all    $all num}createtest # Outputs -> invalid command name "atomselect1"

Viewing all articles
Browse latest Browse all 33

Trending Articles