我正在尝试在 tcl 中编写一个脚本来对 VMD 执行一些分析。首先我在一个过程中创建一个原子选择,然后我试图在另一个过程中使用它。
来自 VMD 的原子选择被实现为 Tcl 函数。返回的数据atomselect
是要使用的函数的名称。你可以在这里阅读更多。
当我在 a 之外创建原子选择时,proc
我可以在其中使用它,只需将其作为global
. 但是现在我在其中创建它,当我尝试使用它时,它只是一个带有过程名称的字符串。
恢复,
这有效:
set all [atomselect top all]
proc test {} {
global all
$all num
}
test # Outuputs 7111
但这不会:
proc create {} {
global all
set all [atomselect top all]
}
proc test {} {
global all
$all num
}
create
test # Outputs -> invalid command name "atomselect1"