|
之前参照一个帖子利用VMD进行轨迹分析的TCL脚本 - 分子模拟 (Molecular Modeling) - 计算化学公社 (keinsci.com)内修改了一个脚本,大家帮忙看看哪里有问题,为什么还是算不出来,脚本哪里有问题呢?脚本内红字是我改动的地方
# measure center $sel1 weight mass
set sel "ringsize 5 from all"
set myfile [open znumdist.dat w]
set nbin 200
#**********************************
set nframe [molinfo top get numframes]
set size [measure minmax [atomselect top all]]
set Zmin [lindex [lindex $size 0] 2]
set Zmax [lindex [lindex $size 1] 2]
set tau [expr ($Zmax-$Zmin)/$nbin]
set var [atomselect top $sel]
#calculating the sum of Z coordinate for each selected $sel
for {set i 0} {$i < $nbin} {incr i} {
set num([expr $Zmin+($i+0.5)*$tau]) 0
}
for {set i 0} {$i < $nframe} {incr i} {
$var frame $i
$var update
foreach j [[measure center $var weight mass] list] {
set zval($j) [[atomselect top "index $j"] get z]
set k [expr floor([expr double(($zval($j)-$Zmin))/$tau])]
set num([expr $Zmin+($k+0.5)*$tau]) [expr $num([expr $Zmin+($k+0.5)*$tau])+1]
}
puts -nonewline [format " Calculating i = %d of %d ...\r" $i $nframe]
}
#calculating the mean number of $sel along Z direction and output the calculated results to znumdist.dat
foreach i [lsort -real -decreasing [array names num]] {
set Mnum($i) [expr double($num($i))/$nframe]
puts $myfile "$i\t $Mnum($i)"
}
close $myfile
|
|