Skip to content

Instantly share code, notes, and snippets.

@akarazeev
Created January 6, 2017 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akarazeev/964eac7617cf1b4573275c8368c3fa5b to your computer and use it in GitHub Desktop.
Save akarazeev/964eac7617cf1b4573275c8368c3fa5b to your computer and use it in GitHub Desktop.
Molecular Dynamic visualisation using VMD
# light controlling
# turn on lights 0 and 1
light 0 on
light 1 on
light 2 off
light 3 off
# position the stage and axes
axes location off
stage location off
# turn on menu windows
menu main on
menu graphics on
menu files on
# position menu windows
menu main move 5 600
menu files move 800 50
menu graphics move 613 139
# set initial drawing method to points
mol modstyle 0 0 points 10
# draw a box around the periodic unit cell boundaries
proc box_molecule {molid} {
# get the min and max values for each of the directions
# (I'm not sure if this is the best way ... )
set sel [atomselect top all]
set coords [lsort -real [$sel get x]]
set minx [lindex $coords 0]
set maxx [lindex [lsort -real -decreasing $coords] 0]
set coords [lsort -real [$sel get y]]
set miny [lindex $coords 0]
set maxy [lindex [lsort -real -decreasing $coords] 0]
set coords [lsort -real [$sel get z]]
set minz [lindex $coords 0]
set maxz [lindex [lsort -real -decreasing $coords] 0]
# and draw the lines
draw materials off
draw color yellow
draw line "$minx $miny $minz" "$maxx $miny $minz"
draw line "$minx $miny $minz" "$minx $maxy $minz"
draw line "$minx $miny $minz" "$minx $miny $maxz"
draw line "$maxx $miny $minz" "$maxx $maxy $minz"
draw line "$maxx $miny $minz" "$maxx $miny $maxz"
draw line "$minx $maxy $minz" "$maxx $maxy $minz"
draw line "$minx $maxy $minz" "$minx $maxy $maxz"
draw line "$minx $miny $maxz" "$maxx $miny $maxz"
draw line "$minx $miny $maxz" "$minx $maxy $maxz"
draw line "$maxx $maxy $maxz" "$maxx $maxy $minz"
draw line "$maxx $maxy $maxz" "$minx $maxy $maxz"
draw line "$maxx $maxy $maxz" "$maxx $miny $maxz"
}
# draw the box
box_molecule top
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment