From: Arthur Pereira da Fonseca (arthurpfonseca3k_at_hotmail.com)
Date: Sat Dec 05 2020 - 15:31:30 CST

Hello, I’m still learning some tcl and I'm trying to write a script in it 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.

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

}

test # Outputs -> invalid command name "atomselect1"