我是 tcl 编程的新手,我需要为 vmd 编写一个脚本,计算两对原子之间的两个距离并将它们打印到输出文件中。我不明白为什么 measure 不能采取 atom_1 等。这是我的脚本,谢谢你的帮助
proc distance {distance_1 atom_1 atom_2 distance_2 atom_3 atom_4 output} {
set outfile [open $output w]
puts $outfile "frame, $distance_1, $distance_2"
set nf [molinfo top get numframes]
for {set i 0} {$i < $nf} {incr i} {
set d1 [measure bond {$atom_1 $atom_2} frame $i]
set d2 [measure bond {$atom_3 $atom_4} frame $i]
puts $outfile "$i , $d1 , $d2"
}
close $outfile
}