From: Axel Kohlmeyer (
Date: Mon Jan 10 2005 - 15:00:47 CST

On Sat, 8 Jan 2005, Marc Baaden wrote:

MB> Hi,

hi marc,

MB> I just wanted to ask what the status of an eventual display of the
MB> actual periodic pox within VMD is ? When working with periodic images
MB> it would be useful to be able to draw the boundaries.


MB> If there are some existing scripts for this, I'd also be interested.
MB> In particular I wonder whether when reading a Gromacs XTC trajectory,
MB> the box dimensions are ajusted for every frame, or fix for the whole
MB> system. Is there a built-in VMD variable to query box coordinates ?

the unitcell dimensions are read in for several file formats and
stored on a per-frame basis. so what you ask for is in priciple
doable. you can query (or set) the unit cell size via:

molinfo $molid get {a b c alpha beta gamma}

if you load your trajectory from an xtc file, they are set
to the correct values for the current frame. you can find
a script drawing the unitcell, that can poll these 'internal'
values at
i've been wanting to do this for a _very_ long time and just
finished it. ;-)

as for having the display automatically updated, you can
use a trace to vmd_frame. for example with:

# load trajectory
mol new test.gro waitfor all
mol addfile test.xtc waitfor all

# procedure to redraw the box
proc do_boxdraw {fname molid args} {
    # delete old box
    global my_vmd_boxgraph
    if {[info exists my_vmd_boxgraph]} then {
        foreach g $my_vmd_boxgraph {
            graphics $molid delete $g
    # draw new box (molid 0: white, molid 1: red, molid 2: blue)
    graphics $molid color white
    set my_vmd_boxgraph [draw unitcell style dashed width 2.5 origin auto]

trace variable vmd_frame(0) w do_boxdraw
animate goto 0

MB> Thanks in advance,
MB> Marc

hope this helps,


Dr. Axel Kohlmeyer   e-mail:
Lehrstuhl fuer Theoretische Chemie          Phone: ++49 (0)234/32-26673
Ruhr-Universitaet Bochum - NC 03/53         Fax:   ++49 (0)234/32-14045
D-44780 Bochum
If you make something idiot-proof, the universe creates a better idiot.