0
我一直使用一段时间来提取矢量的tcl脚本突然停止工作,我不确定为什么。另外,错误也没有意义。无效的命令名称“”错误
我运行的代码是:
for {set resd 501} {$resd < 502} {incr resd 1} {
set basefile1 "CCvector$resd"
set workdir [pwd]
set nf [molinfo top get numframes]
set fil [open $basefile1.dat w]
for {set frame 0} {$frame < $nf} {incr frame 1} {
animate goto $frame
display update ui
set c1 [atomselect top "name C1 and resid $resd and resname G130"]
set c3 [atomselect top "name C3 and resid $resd and resname G130"]
set c1c [$c1 get {x y z} ]
set c3c [$c3 get {x y z} ]
set c1c3x [expr [$c3 get x]-[$c1 get x]]
set c1c3y [expr [$c3 get y]-[$c1 get y]]
set c1c3z [expr [$c3 get z]-[$c1 get z]]
set st [expr $frame]
puts $fil [list $st $c1c3x $c1c3y $c1c3z ]
$c3 delete
$c1 delete
}
close $fil
我被接收原始误差是“缺少操作数在@”,然而我取代的代码的部分,以成为:
for {set frame 0} {$frame < $nf} {incr frame 1} {
animate goto $frame
display update ui
set c1 [atomselect top "name C1 and resid $resd and resname G130"]
set c3 [atomselect top "name C3 and resid $resd and resname G130"]
set c1x [$c1 get x]
set c3x [$c3 get x]
set c1c3x [expr [$c3x - $c1x]]
set c1y [$c1 get y]
set c3y [$c3 get y]
set c1c3y [expr [$c3y - $c1y]]
set c1z [$c1 get z]
set c3z [$c3 get z]
set c1c3z [expr [$c3z - $c1z]]
set st [expr $frame]
puts $fil [list $st $c1c3x $c1c3y $c1c3z ]
$c3 delete
$c1 delete
}
close $fil
而现在我正在收到“Invalid Command Name”“”错误。我哪里错了?
附加信息:我运行这个使用VMD从在加载GROMACS轨迹提取坐标
更好的办法是'set c1c3z [expr {$ c3z - $ c1z}]'这样可以避免各种麻烦,并且可以实现更高速的编译。 –
@单调,好点。请参阅编辑。 –