计算化学公社

 找回密码 Forget password
 注册 Register
Views: 5297|回复 Reply: 0
打印 Print 上一主题 Last thread 下一主题 Next thread

[VMD] 求助VMD如何添加周期性边界条件计算原子间距

[复制链接 Copy URL]

1

帖子

0

威望

123

eV
积分
124

Level 2 能力者

大家好,我想用VMD后处理得到周期性结构里面两个原子之间的距离变化情况,自己参考https://www.ks.uiuc.edu/Research ... st/vmd-l/27057.html 的脚本运行了一下,但是报错,missing operator at _@_ in expression "...0359296798706 + (6/2) _@_6) - (6/2)"
(parsing expression "pmodulo( -1.3447715044...")invoked from within"expr pmodulo( $x1 - $x2 + ($boxX/2)  $boxX) - ($boxX/2)"
    ("for" body line 26)
初学TCL,不知道怎么解决,麻烦大家帮忙看看:

package require pbctools
pbc set {6 6 8} -all
set outfile [open "test.dat" w]
set nf [molinfo top get numframes]
set ind24 [atomselect top "index 24"]
set ind32 [atomselect top "index 32"]         
set boxX 6
set boxY 6
set boxZ 8

for {set i 0} {$i < $nf} {incr i} {
         $ind24 frame $i
         $ind32 frame $i
         set x1 [$ind24 get {x}]
         set y1 [$ind24 get {y}]
         set z1 [$ind24 get {z}]
         set x2 [$ind32 get {x}]
         set y2 [$ind32 get {y}]
         set z2 [$ind32 get {z}]
         proc pmodulo {n m} {
         return [expr $n - $m * floor(1.0 * $n/$m)]
        }

         set Dx   [expr pmodulo( $x1 - $x2 + ($boxX/2)  $boxX) - ($boxX/2)]
         set Dy   [expr pmodulo( $y1 - $y2 + ($boxY/2) $boxY) - ($boxY/2)]
         set Dz   [expr pmodulo( $z1 - $z2 + ($boxZ/2) $boxZ) - ($boxZ/2)]
         set D    [expr sqrt( ($Dx * $Dx) + ($Dy * $Dy) + ($Dz * $Dz) )]
         puts $outfile "$i \t $D "     
}
close $outfile





本版积分规则 Credits rule

手机版 Mobile version|北京科音自然科学研究中心 Beijing Kein Research Center for Natural Sciences|京公网安备 11010502035419号|计算化学公社 — 北京科音旗下高水平计算化学交流论坛 ( 京ICP备14038949号-1 )|网站地图

GMT+8, 2026-2-23 04:09 , Processed in 0.223419 second(s), 26 queries , Gzip On.

快速回复 返回顶部 返回列表 Return to list