|
|
老师您好,我也是计算一个向量和z轴的夹角,是在求解距离,角度,二面角随时间变化以及分布的VMD脚本
http://bbs.keinsci.com/forum.php ... 14821&fromuid=32722
(出处: 计算化学公社)
这里分享的脚本进行修改的。
其中第一条向量是3-5唉米内resname为APM的 N-H向量(我这样写对吗)
第二条为z轴,请问这个z轴的这个向量怎么样写呢
#---------------------------------------------------
set outfile [open angle.dat w]
set select1 "resname APM N1 and z>3 and z<5"
set select2 "resname APM H1 and z>3 and z<5"
set select3 "protein and resid 2"
set select4 "protein and resid 3"
#---------------------------------------------------
set nf [molinfo top get numframes]
set sel1 [atomselect top "$select1"]
set sel2 [atomselect top "$select2"]
set sel3 [atomselect top "$select3"]
set sel4 [atomselect top "$select4"]
for { set i 1 } { $i <= $nf } { incr i } {
$sel1 frame $i
set V1 [measure center "$sel1"]
$sel2 frame $i
set V2 [measure center "$sel2"]
$sel3 frame $i
set V3 [measure center "$sel3"]
$sel4 frame $i
set V4 [measure center "$sel4"]
set VA [vecsub $V1 $V2]
set VB [vecsub $V3 $V4]
set COSAB [expr [vecdot $VA $VB]/([veclength $VA]*[veclength $VB])]
set ANGLE [expr acos($COSAB)*180/3.1415926]
puts $outfile "[expr $ANGLE]"
}
close $outfile
puts "All Done!" |
|