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
}
create
test # Outputs -> invalid command name "atomselect1"
$all num
in the same procedure as theatomselect
? Which would mean that we're talking real shenanigans with scope binding, which isβ¦ severely unusual because it causes surprises like this. β Donal Fellowscreate
procedure. β Arthur Pereira