How-To's‎ > ‎Simulation-Modeling‎ > ‎


This is a wonderful presentation by Chris MacDermaid: VMD_Visualization_Scripting_TopoTools

Rendering High Quality Images

  1. Render using Tachyon, and add "-res 4000 3000" to the render command options
  2. (Optional) Convert the output tga file png (or other) with the convert command line too

Making Movies

From a trajectory: The movie maker plugin in vmd allows us to make an animated GIF (VMD→Extensions→Visualization→Movie Maker). Set the working directory first, then there are several steps.

  1. Usually there are too many snaphsots. We remove most of the frames (animate delete beg 500 end 999). Furthermore, we skip 1 frame (animate  skip 1). A decent final number of frames is 250.
  2. Set working directory to /tmp, then set Name of movie to ‘mymovie', Renderer→snapshot, Movie Settings→trajectory, Format→Animated Gif
  3. Notice: the plugin dumps one image per snapshot to /tmp, then calls the Linux command convert as convert –delay 4.7 –loop 4 /tmp/me8t8.*.ppm /tmp/me8t8.gif. The delay and loop options are not desirable so I stop the conversion process and retype the command in a terminal, but without the aforementioned options. You can tell when the plugin is doing the conversion because the command is printed to the vmd> console

From a single structure: We rotate the structure 360 degrees every 2 degrees for a total of 180 frames

    set frame 0
    for {set i 0} {$i < 360} {incr i 2} {
        set filename snap.[format "%04d" $frame].rgb
        render snapshot $filename
        incr frame
        rotate y by 2

This will create a series of *.rgb files. User the Linux convert command line utility to make an animated gif.

convert *.rgb movie.gif

We can make a stereoscopic movie by entering display stereo Anaglyph. This will produce two images of the system slightly off, which can be viewed as a 3D image with the help of a pair of red/cyan glasses. By saving a set of these images we make a stereoscopic movie.

There is a tutorial in the VMD workshop for some more options.

Making 3D movies (This contains extracts from the VMD-l mailing list)

Making a stereoscopic movie that allows one to see the frames as 3D with the help of a pair of red/cyan glasses:
 - I loaded pdb file myfile.pdb, changed the representation, and save a visualization file myfile.vmd.
 - I reopened vmd and loaded the visualization file, then wrote in the tcl terminal stereo Anaglyph, which creates a suitable stereoscopic view.
 - Using Extensions -> Visualization -> Movie Maker, I made a movie in MPEG2 format by a 360 degree rotation around the Y-axis every degree, with a scheduled time of 30s.

Making a stereoscopic movie as a pair left and right streams, which can be loaded into bino3D,a free movie player that has quad-buffered output.

 - Load the trajectory and select a representation
 - read the commands below stored in a file by typing source myfile.tcl or load the file in the TK console (extensions -> TK console)

#set output directory
cd "C:\\tmp"

set nframes [molinfo 0 get numframes]
for {set i 0} {$i < $nframes} {incr i} {
  animate next
  display stereo Left
  render Tachyon [format "left.%05d.tga" $i]
  display stereo Right
  render Tachyon [format "right.%05d.tga" $i]

#ffmpeg -i left.%05d.tga left.mp4

Running a script without the GUI

At the commnand line, type:

$> vmd -dispdev none -eofexit -e scriptfile.tcl

If the script includes plugins that do require the windows display, we can still invoque the script without explicitly presenting the graphical interface using Xvfb:

$> vmd -eofexit -e scriptfile.tcl