24小时热门版块排行榜    

查看: 1948  |  回复: 15
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

jianchaoyv

金虫 (小有名气)

[交流] 【求助】向bay__gulf求助!! 已有4人参与

目前在做碳纳米管中水的相变,请教一下怎样写.tcl脚本来计算radial density of oxygen 和 orientation distributions of water molecules within CNTs?
虽然这个问题对你可能比较简单,但对我来说却很棘手,望赐教!
同时恭喜bay__gulf发JPCA!
也欢迎其他高手指教!
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

jianchaoyv

金虫 (小有名气)

bay__gulf确实是牛人,也很耐心!
我把你那段程序的理解写下来:
程序开始到此已理解
set theta [expr $theta/$n ]  #对每帧所有水分子偶极距求平均,另外,这个theta角是跟Z轴正半轴的夹角吧?而看到的文献中大都是算的与Z轴负半轴的夹角,感觉没什么差别,这样理解多吗?
   set costheta [expr cos ([expr $theta*3.1416/180.0])]#求cos(theta)
   set lgd [expr $lgd + [expr $costheta * $costheta]]#用于求不同帧的cos(theta)^2求和
   puts $fr #输出第几帧
   puts $outf [format " %f"  $theta] 输出该帧下水分子偶极距的平均值
   $wt delete
}
   set lgd [expr $lgd / $numFrame * 1.5 - 0.5] #对所有帧的2阶勒让德函数求平均
   puts "3*<(cosθ)^2> - 1 = $lgd" #输出P2的平均值
close $outf

对上面的解释若有错误请指正,还想请教一下算P2用来表征什么的?不知道算P2的目的。
若set theta [expr $theta/$n ]  #对每帧所有水分子偶极距求平均,理解正确的话,也就默认了每帧里的所有水分子的偶极距方向都一样了,感觉同一帧不同位置的水分子偶极距还是有可能不同的,有这种可能吗?

[ Last edited by jianchaoyv on 2010-6-26 at 10:09 ]
9楼2010-06-26 09:48:01
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 16 个回答

bay__gulf

金虫 (著名写手)

刘苏州

★ ★ ★ ★ ★ ★ ★ ★ ★ ★
jianchaoyv(金币+10):谢谢指点 2010-06-22 18:29:11
ghcacj(金币+10):谢谢 2010-06-22 19:55:31
radial density, 也就是径向分布, 很常用, vmd 也提供了一个工具可以直接计算
就是measure gofr, 参考 http://www.ks.uiuc.edu/Research/vmd/current/ug/node133.html, 以及一个gui 界面, 参考 http://www.ks.uiuc.edu/Research/vmd/plugins/gofrgui/

至于取向分布, 用户较少只能自己写了,
vmd 的强大之处不在于内置了多少工具, 更不是做多漂亮的图形
而是提供了一个原子(集团)为数据结构的编程环境, 可以按照自己的需要实现任意的功能
下面是当时用的代码, 现在看来很幼稚了但拿它入门还是不错的

# count the dipolar-z angle and Legendre 2nd order polynomial in a pore,
# make sure the psf/dcd be the top molecular

set outf [open theta.dat w]

set numFrame [molinfo top get numframes]

set lgd 0
for { set fr 1 } { $fr < $numFrame } {incr fr } {
   set wt [atomselect top "water and name OH2 and z < 7.6 and z > -7.6 " frame $fr]
   set n [$wt num]
   set theta 0

   foreach resid [$wt get resid] {

      set wto  [atomselect top "resid $resid and name OH2" frame $fr]
      set wth1 [atomselect top "resid $resid and name H1" frame $fr]
      set wth2 [atomselect top "resid $resid and name H2" frame $fr]

      set coordo  [measure center  $wto]
      set coordh1 [measure center $wth1]
      set coordh2 [measure center $wth2]

      set coordh  [vecadd $coordh1 $coordh2]
      set coordh  [vecscale 0.5 $coordh]
      set vecd    [vecsub $coordh $coordo]

      set thetai  [expr acos ([expr [lindex $vecd 2] / [veclength $vecd]])]
      set thetai  [expr $thetai * 180.0 / 3.1416]
      set theta   [expr $theta + $thetai]

      $wto  delete
      $wth1 delete
      $wth2 delete
   }

   set theta [expr $theta/$n ]
   set costheta [expr cos ([expr $theta*3.1416/180.0])]
   set lgd [expr $lgd + [expr $costheta * $costheta]]
   puts $fr
   puts $outf [format "%d %f" $fr $theta]

   $wt delete
}
   set lgd [expr $lgd / $numFrame * 1.5 - 0.5]
   puts "3*<(cosθ)^2> - 1 = $lgd"
close $outf
2楼2010-06-22 16:44:02
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

jianchaoyv

金虫 (小有名气)

能否具体讲一下两种操作方法的步骤或给一个具体例子?你给的连接看了,但还是不知道怎么去操作。麻烦你帮忙写一个.tcl脚本,谢谢!

[ Last edited by jianchaoyv on 2010-6-22 at 20:24 ]
3楼2010-06-22 19:41:03
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

jianchaoyv

金虫 (小有名气)

请问上面提供的脚本中:
  set coordh  [vecadd $coordh1 $coordh2]
      set coordh  [vecscale 0.5 $coordh]
      set vecd    [vecsub $coordh $coordo]

      set thetai  [expr acos ([expr [lindex $vecd 2] / [veclength $vecd]])]
还有最后set lgd [expr $lgd / $numFrame * 1.5 - 0.5]
这几句看不懂,能不能解释一下?谢谢!

[ Last edited by jianchaoyv on 2010-6-23 at 09:56 ]
4楼2010-06-23 09:50:22
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
普通表情 高级回复 (可上传附件)
信息提示
请填处理意见