计算化学公社
标题:
求助:VMD脚本输出的原子坐标与设定的范围不一致
[打印本页]
作者Author:
chieko
时间:
2023-11-23 18:16
标题:
求助:VMD脚本输出的原子坐标与设定的范围不一致
本帖最后由 chieko 于 2023-11-23 18:16 编辑
我对一个体系中的水(SOL)用VMD做氢键分析,我只需要measure给定范围内的水(z1-z2)形成的氢键,然后把所有氢键的供体的H原子和受体氧原子的坐标输出即可。
问题在于,输出的原子的z坐标与脚本中指定的不对应。例如下面希望水在(120,130)的z范围内,但是结果中z的范围基本上只在120-125左右。——当然我的体系中120-130部分肯定是有水的。
改变z1,z2,结果中z坐标范围也会变化至(z1,z1+5左右)的范围,很奇怪。脚本本身明明也很简单。。。
请Sob老师和大家帮我看看是怎么回事,谢谢!
脚本如下,输出文件见附件。
set z1 120
set z2 130
set fps1 99000
set fps2 100000
set output "5nm_hbs_coord.txt"
set outputFile [open $output "w"]
for {set frame $fps1} {$frame <= $fps2} {incr frame} {
animate goto $frame
set selection [atomselect top "resname SOL and (z >= $z1) and (z <= $z2)"]
set hbonds [measure hbonds 3.5 40 $selection]
foreach hbond $hbonds {
set donor [lindex $hbond 0]
set hydrogen [lindex $bond 2]
set acceptor [lindex $hbond 1]
set h_coord [[atomselect top "index $hydrogen" frame $frame] get {x y z}]
set a_coord [[atomselect top "index $acceptor" frame $frame] get {x y z}]
set h_coord [lindex $h_coord 0]
set a_coord [lindex $a_coord 0]
puts $outputFile "[format "%.3f %.3f %.3f %.3f %.3f %.3f" {*}$h_coord {*}$a_coord]"
}
$selection delete
}
close $outputFile
复制代码
作者Author:
Loading0760
时间:
2023-11-24 12:07
会不会是第14行
set hydrogen [lindex $bond 2]
这里的变量应该是$hbond。
不是很懂tcl,仅提出自己猜测。
欢迎光临 计算化学公社 (http://bbs.keinsci.com/)
Powered by Discuz! X3.3