Jump to content

Talk:Mod:Hunt Research Group/VmdScriptsMovieMolExtra

From ChemWiki

A script in process

#
# movie (atom index no to center scaling at)
# to run in the VMD or Tcl consol type
# source movie.tcl
# movie 42

#
proc movie {sel} {
set frame 1
for {set i 0} {$i < 360} {incr i 18} {
set filename snap_[format "%02d" $frame].tga
render TachyonInternal $filename
incr frame
rotate x by 18
}
for {set i 0} {$i < 360} {incr i 18} {
set filename snap_[format "%02d" $frame].tga
render TachyonInternal $filename
incr frame
rotate y by 18
}
for {set i 0} {$i < 180} {incr i 18} {
set filename snap_[format "%02d" $frame].tga
render TachyonInternal $filename
incr frame
rotate y by 10
}
# select atom to center at (user changes this value in script
# this is the index number of the atom
# query for the postion of this atom
# set the center of visualisation at this atom, note this does not move the molecules!
# so we try to translate all atoms by this vector
# some problems with moveby which will not accept $xyz
set atomcent [atomselect top "index $sel"]
set xyz [$atomcent get {x y z}]
molinfo top set center $xyz
set x [$atomcent get {x}]
set x [expr -$x]
set y [$atomcent get {y}]
set y [expr -$y]
set z [$atomcent get {z}]
set z [expr -$z]
set all [atomselect top all]
$all moveby [list $x $y $z]
#
# now scale in towards the selected center
#
for {set i 0} {$i < 10} {incr i 1} {
set filename snap_[format "%02d" $frame].tga
render TachyonInternal $filename
incr frame
scale by 1.10
}
#
# wait for a small amount of time
#
for {set i 0} {$i < 5} {incr i 1} {
set filename snap_[format "%02d" $frame].tga
render TachyonInternal $filename
incr frame
}
#
# now scale back out
#
for {set i 0} {$i < 10} {incr i 1} {
set filename snap_[format "%02d" $frame].tga
render TachyonInternal $filename
incr frame
scale by 0.91
}
}