计算化学公社

标题: 求助,如何用VMD计算两向量夹角的角度 [打印本页]

作者
Author:
Jus    时间: 2022-10-19 12:05
标题: 求助,如何用VMD计算两向量夹角的角度
在VMD中,选定两原子确定一个向量,想选一条坐标轴为另一个向量,然后求两向量的夹角,请问选择两原子后如何选取坐标轴作为另一向量先谢谢大家了

作者
Author:
lyj714    时间: 2022-10-19 12:27
两原子坐标x y z 做差得向量1,坐标轴方向向量就取单位向量,比如z轴就取(0,0,1)即向量2,最后向量1和2点乘就得到的夹角的cos值了,自然夹角就是arccos了
作者
Author:
Jus    时间: 2022-10-19 13:18
lyj714 发表于 2022-10-19 12:27
两原子坐标x y z 做差得向量1,坐标轴方向向量就取单位向量,比如z轴就取(0,0,1)即向量2,最后向量1和2点 ...

好的,谢谢你
作者
Author:
qiyan    时间: 2024-3-6 20:32
lyj714 发表于 2022-10-19 12:27
两原子坐标x y z 做差得向量1,坐标轴方向向量就取单位向量,比如z轴就取(0,0,1)即向量2,最后向量1和2点 ...

老师您好,我也是计算一个向量和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!"
作者
Author:
Hahaaa    时间: 2024-5-21 23:07
qiyan 发表于 2024-3-6 20:32
老师您好,我也是计算一个向量和z轴的夹角,是在求解距离,角度,二面角随时间变化以及分布的VMD脚本
ht ...

您好,我也遇到这个问题了,请问您解决这个问题了吗




欢迎光临 计算化学公社 (http://bbs.keinsci.com/) Powered by Discuz! X3.3