| 14 | 1/1 | 返回列表 |
| 查看: 7205 | 回復(fù): 13 | |||||
| 【獎(jiǎng)勵(lì)】 本帖被評(píng)價(jià)12次,作者xianggui7895增加金幣 10 個(gè) | |||||
| 本帖產(chǎn)生 1 個(gè) 模擬EPI ,點(diǎn)擊這里進(jìn)行查看 | |||||
[資源]
【原創(chuàng)】VMD如何顯示晶胞格子
|
|||||
VMD是一款非常強(qiáng)大的分子動(dòng)力學(xué)后處理軟件,而在使用中有個(gè)問(wèn)題經(jīng)常困擾新手,如何在周期性模型上加上晶胞格子使其看起來(lái)更“漂亮”一點(diǎn)呢?VMD默認(rèn)是不畫晶格的![]() 但作為一個(gè)強(qiáng)大的軟件,能實(shí)現(xiàn)這個(gè)功能是肯定的,現(xiàn)在就有兩種方法可以在VMD軟件中畫出晶格,試試吧: (1)VMD內(nèi)置的pbctool工具箱,可直接在vmd控制臺(tái)或者Tk控制臺(tái)(Main menu->Extensions->Tk Console)中輸入以下命令: pbc set [list a b c alpha beta gamma] pbc box -on 其中,a、b、c、alpha、beta、gamma是各個(gè)晶胞參數(shù),如下圖所示: ![]() 還可以設(shè)置box的線型、線寬和顏色,分別通過(guò)以下命令: pbc box -style lines|dashed| pbc box -width 2 pbc box -color red 更多選項(xiàng)可查閱:http://www.ks.uiuc.edu/Research/vmd/plugins/pbctools/ (2)tcl腳本:vmd_draw_unitcell。將下面內(nèi)容保存在名為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控制臺(tái)或這tk控制臺(tái)即可輸入一下命令顯示晶胞格子: draw unitcell cell [list a b c alpha beta gamma] 注意:a b c alpha beta gamma需要全部注明。 詳細(xì)說(shuō)明請(qǐng)看下面一段英文表述: # 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 ] |
好東西啊 | 科研人生 | 精華 |
金蟲 (著名寫手)






| 14 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 0856材料專碩353求調(diào)劑 +4 | NIFFFfff 2026-03-20 | 4/200 |
|
|---|---|---|---|---|
|
[考研] 085600材料與化工306 +4 | z1z2z3879 2026-03-21 | 4/200 |
|
|
[考研] 材料學(xué)碩301分求調(diào)劑 +7 | Liyouyumairs 2026-03-21 | 7/350 |
|
|
[考研] 初試 317 +7 | 半拉月丙 2026-03-20 | 7/350 |
|
|
[考研] 化學(xué)調(diào)劑 +5 | yzysaa 2026-03-21 | 5/250 |
|
|
[考研] 326求調(diào)劑 +4 | mlpqaz03 2026-03-15 | 4/200 |
|
|
[考研] 材料工程專碩 348分求調(diào)劑 +3 | 冬辭. 2026-03-17 | 5/250 |
|
|
[考研] 一志愿重慶大學(xué)085700資源與環(huán)境總分308求調(diào)劑 +7 | 墨墨漠 2026-03-20 | 7/350 |
|
|
[考研] 南昌大學(xué)材料專碩311分求調(diào)劑 +6 | 77chaselx 2026-03-20 | 6/300 |
|
|
[考研] 070300化學(xué)319求調(diào)劑 +7 | 錦鯉0909 2026-03-17 | 7/350 |
|
|
[考研] 一志愿武理材料305分求調(diào)劑 +6 | 想上岸的鯉魚 2026-03-18 | 7/350 |
|
|
[考研]
|
.6lL 2026-03-18 | 8/400 |
|
|
[考研] 330求調(diào)劑 +4 | 小材化本科 2026-03-18 | 4/200 |
|
|
[考研] 一志愿華中農(nóng)業(yè)071010,總分320求調(diào)劑 +3 | 困困困困坤坤 2026-03-20 | 3/150 |
|
|
[考研] 工科材料085601 279求調(diào)劑 +7 | 困于星晨 2026-03-17 | 9/450 |
|
|
[考研] 材料工程專碩調(diào)劑 +5 | 204818@lcx 2026-03-17 | 6/300 |
|
|
[考研] 277調(diào)劑 +5 | 自由煎餅果子 2026-03-16 | 6/300 |
|
|
[考研] 東南大學(xué)364求調(diào)劑 +5 | JasonYuiui 2026-03-15 | 5/250 |
|
|
[考研] 070300化學(xué)學(xué)碩求調(diào)劑 +6 | 太想進(jìn)步了0608 2026-03-16 | 6/300 |
|
|
[考研] 070303 總分349求調(diào)劑 +3 | LJY9966 2026-03-15 | 5/250 |
|