| 查看: 6889 | 回复: 13 | |||||
| 【奖励】 本帖被评价12次,作者xianggui7895增加金币 10 个 | |||||
| 本帖产生 1 个 模拟EPI ,点击这里进行查看 | |||||
[资源]
【原创】VMD如何显示晶胞格子
|
|||||
VMD是一款非常强大的分子动力学后处理软件,而在使用中有个问题经常困扰新手,如何在周期性模型上加上晶胞格子使其看起来更“漂亮”一点呢?VMD默认是不画晶格的![]() 但作为一个强大的软件,能实现这个功能是肯定的,现在就有两种方法可以在VMD软件中画出晶格,试试吧: (1)VMD内置的pbctool工具箱,可直接在vmd控制台或者Tk控制台(Main menu->Extensions->Tk Console)中输入以下命令: pbc set [list a b c alpha beta gamma] pbc box -on 其中,a、b、c、alpha、beta、gamma是各个晶胞参数,如下图所示: ![]() 还可以设置box的线型、线宽和颜色,分别通过以下命令: pbc box -style lines|dashed| pbc box -width 2 pbc box -color red 更多选项可查阅:http://www.ks.uiuc.edu/Research/vmd/plugins/pbctools/ (2)tcl脚本:vmd_draw_unitcell。将下面内容保存在名为vmd_draw_unitcell.tcl的文件,放在vmd安装目录下(如:C:\Program Files\University of Illinois\VMD) # vmd extension procedure: # provide a 'draw unitcell' command # # $Id: vmd_draw_unitcell.tcl,v 1.2 2005/01/11 13:05:12 akohlmey Exp $ # Time-stamp: # # Copyright (c) 2003-2005 by # add a unitcell graphic to a molecule via a draw subcommand. # # options: # cell (vmd|auto|[list ]), default: "vmd" # "vmd" will use the internal values, # "auto" will build an orthogonal unitcell from the result of # 'measure minmax' plus 1 angstrom added in each direction. # else a list of a,b,c,alpha,beta,gamma will be assumed. # origin ([list ]|auto), default: {0.0 0.0 0.0}, "auto" with 'cell auto' # style: (lines|dashed|rod) default: line # width: default: 1.0 # resolution: default: 8 # proc vmd_draw_unitcell {molid args} { # parse arguments foreach {flag arg} $args { switch $flag { cell { set cell "$arg" } origin { set origin "$arg" } style { set style "$arg" } width { set width "$arg" } resolution { set resolution "$arg" } default { puts "unknown option: $flag"; return } } } if [info exists cell] { if {![info exists origin] && $cell == "auto"} { set origin auto } } else { set cell vmd } if ![info exists origin] { set origin {0.0 0.0 0.0} } if ![info exists style] { set style lines } if ![info exists width] { set width 1 } if ![info exists resolution] { set resolution 8 } # FIXME: add some checks on the arguments here. # handle auto keywords if {$cell == "auto" || $origin == "auto" } { set sel [atomselect $molid {all}] set minmax [measure minmax $sel] $sel delete unset sel if {$origin == "auto" } {set origin [vecsub [lindex $minmax 0] {1 1 1}]} if {$cell == "auto"} { set cell [vecadd [vecsub [lindex $minmax 1] [lindex $minmax 0]] {2 2 2}] lappend cell 90.0 90.0 90.0 } } if {$cell == "vmd" } {set cell [molinfo $molid get {a b c alpha beta gamma}]} global M_PI set sa [expr sin([lindex $cell 3]/180.0*$M_PI)] set ca [expr cos([lindex $cell 3]/180.0*$M_PI)] set cb [expr cos([lindex $cell 4]/180.0*$M_PI)] set cg [expr cos([lindex $cell 5]/180.0*$M_PI)] set sg [expr sin([lindex $cell 5]/180.0*$M_PI)] # set up cell vectors according to the VMD unitcell conventions. # the a-vector is collinear with the x-axis and # the b-vector is in the xy-plane. set a [vecscale [lindex $cell 0] {1 0 0}] set b [vecscale [lindex $cell 1] "$ca $sa 0"] set c [vecscale [lindex $cell 2] "$cb [expr ($ca - $cb*$cg)/$sg] [expr sqrt((1.0 + 2.0*$ca*$cb*$cg - $ca*$ca - $cb*$cb - $cg*$cg)/(1.0 - $cg*$cg))]"] # set up cell vertices set vert(0) $origin set vert(1) [vecadd $origin $a] set vert(2) [vecadd $origin $b] set vert(3) [vecadd $origin $a $b] set vert(4) [vecadd $origin $c] set vert(5) [vecadd $origin $a $c] set vert(6) [vecadd $origin $b $c] set vert(7) [vecadd $origin $a $b $c] unset sa ca cb cg sg set gid "" switch $style { rod { # set size and radius of spheres and cylinders set srad [expr $width * 0.003 * [veclength [vecadd $a $b $c]]] set crad [expr 0.99 * $srad] # draw spheres into the vertices ... for {set i 0} {$i < 8} {incr i} { lappend gid [graphics $molid sphere $vert($i) radius $srad resolution $resolution] } # ... and connect them with cylinders foreach {i j} {0 1 0 2 0 4 1 5 2 3 4 6 1 3 2 6 4 5 7 3 7 5 7 6} { lappend gid [graphics $molid cylinder $vert($i) $vert($j) radius $crad resolution $resolution] } } lines { set width [expr int($width + 0.5)] foreach {i j} {0 1 0 2 0 4 1 5 2 3 4 6 1 3 2 6 4 5 7 3 7 5 7 6} { lappend gid [graphics $molid line $vert($i) $vert($j) width $width style solid] } } dashed { set width [expr int($width + 0.5)] foreach {i j} {0 1 0 2 0 4 1 5 2 3 4 6 1 3 2 6 4 5 7 3 7 5 7 6} { lappend gid [graphics $molid line $vert($i) $vert($j) width $width style dashed] } } default { puts "unknown unitcell style: $style" ; return } } # return list of graphics indices so that they can be saved and deleted later. return $gid } ############################################################ # Local Variables: # mode: tcl # time-stamp-format: "%u %02d.%02m.%y %02H:%02M:%02S %s" # End: ############################################################ 用记事本打开vmd安装目录下的vmd.rc文件,在最后添加一行: source C:\\Program\ Files\ (x86)\\University\ of\ Illinois\\VMD\\vmd_draw_unitcell.tcl 然后在vmd控制台或这tk控制台即可输入一下命令显示晶胞格子: draw unitcell cell [list a b c alpha beta gamma] 注意:a b c alpha beta gamma需要全部注明。 详细说明请看下面一段英文表述: # cell (vmd|auto|[list ]), default: "vmd" # "vmd" will use the internal values, # "auto" will build an orthogonal unitcell from the result of # 'measure minmax' plus 1 angstrom added in each direction. # else a list of a,b,c,alpha,beta,gamma will be assumed. # origin ([list ]|auto), default: {0.0 0.0 0.0}, "auto" with 'cell auto' # style: (lines|dashed|rod) default: line # width: default: 1.0 # resolution: default: 8 [ Last edited by xianggui7895 on 2010-12-13 at 21:57 ] |
» 收录本帖的淘帖专辑推荐
好东西啊 | 科研人生 | 精华 |
» 猜你喜欢
请问有评职称,把科研教学业绩算分排序的高校吗
已经有6人回复
2025冷门绝学什么时候出结果
已经有6人回复
Bioresource Technology期刊,第一次返修的时候被退回好几次了
已经有7人回复
真诚求助:手里的省社科项目结项要求主持人一篇中文核心,有什么渠道能发核心吗
已经有8人回复
寻求一种能扛住强氧化性腐蚀性的容器密封件
已经有5人回复
请问哪里可以有青B申请的本子可以借鉴一下。
已经有4人回复
请问下大家为什么这个铃木偶联几乎不反应呢
已经有5人回复
天津工业大学郑柳春团队欢迎化学化工、高分子化学或有机合成方向的博士生和硕士生加入
已经有4人回复
康复大学泰山学者周祺惠团队招收博士研究生
已经有6人回复
AI论文写作工具:是科研加速器还是学术作弊器?
已经有3人回复
» 本主题相关商家推荐: (我也要在这里推广)
» 本主题相关价值贴推荐,对您同样有帮助:
如何架构一篇好的文章?
已经有6人回复
DNA合成单如何解读?请教!
已经有3人回复
CP2K 跑 MD 为什么分子跑到了周期性格子外面
已经有5人回复
如何利用castep建立Ba0.75Sr0.25TiO3的晶胞模型啊??
已经有7人回复
求助castep计算中:晶胞总能量E 与晶胞体积V 的关系图如何得到,看内容
已经有24人回复
【求助】如何快速进行晶胞和原胞之间的结构参数的转换
已经有9人回复
【求助】用VMD怎样显示3D结构的晶胞呢?
已经有6人回复
【请教】如何确定晶体的晶胞参数及空间点群?先谢过!
已经有7人回复
2楼2010-12-14 19:42:34
3楼2010-12-14 20:43:19
4楼2010-12-15 21:39:35
5楼2010-12-20 14:37:15
8楼2011-05-12 17:10:24
9楼2011-07-17 12:07:04
12楼2012-01-25 10:53:31
13楼2015-07-21 08:57:14
14楼2019-07-19 09:35:41
简单回复
leigp6楼
2011-04-11 14:54
回复
五星好评 顶

CMLY7楼
2011-05-12 09:23
回复
五星好评 hao
SZUKkboy10楼
2011-11-18 17:34
回复
五星好评 









gavinliu739011楼
2011-12-18 23:26
回复
五星好评 牛!















回复此楼

