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}]'這樣可以避免各種麻煩,並且可以實現更高速的編譯。 –
@單調,好點。請參閱編輯。 –