末成年小嫩xb,嫰bbb槡bbbb槡bbbb,免费无人区码卡密,成全高清mv电影免费观看

解決個經常困擾新手的問題,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是各個晶胞參數,如下圖所示:

?

解決個經常困擾新手的問題,VMD如何顯示晶胞格子?

?

還可以設置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 FilesUniversity of IllinoisVMD)

# 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

本文轉載自xianggui7895,轉載目的在于知識分享,本文觀點不代表V-suan云平臺立場。

原創文章,作者:菜菜歐尼醬,如若轉載,請注明來源華算科技,注明出處:http://www.zzhhcy.com/index.php/2023/12/01/ad9e647007/

(0)

相關推薦

主站蜘蛛池模板: 台南县| 阿城市| 内丘县| 沙洋县| 丽水市| 云安县| 房产| 徐汇区| 武鸣县| 罗平县| 友谊县| 武城县| 正阳县| 旬邑县| 萨迦县| 仙游县| 金溪县| 高安市| 白城市| 西青区| 富川| 石泉县| 施甸县| 十堰市| 克什克腾旗| 东台市| 习水县| 佛坪县| 东兴市| 泗水县| 满洲里市| 新丰县| 东乌珠穆沁旗| 靖边县| 常熟市| 阳城县| 岚皋县| 龙江县| 百色市| 方山县| 简阳市|