From: Norman Geist (
Date: Thu Aug 01 2013 - 03:43:07 CDT

Hi experts,


while I'm in the NAMD mailing list since years, now I needed to join here
too, to find some help regarding the following problem.


Unfortunately I'm sure having found a BUG in the DX file format reader in
VMD. As it seems and as I understood the corresponding code, the dx reader
computes the box size (needed to map the scalar data back to angstom) from
gridsize and gridspacing like: (pseudo code)


Box[X|Y|Z] = gridsize[X|Y|Z] * ((gridspacing[X|Y|Z]-1) > 0 ?
(gridspacing[X|Y|Z]-1) : 1)


But this doesn't make sense. The delta values for each axis already tells
the spacing between the grids. Multiplied with the number of grids per axis
is already supposed to result in the correct box dimensions. But the current
implementation always misses one times the gridspacing, so why -1??


As I'm currently writing a TCL script, that computes the "per particle"
temperature and puts them together in a configurable grid, which I wanted to
visualize via the volume slice representation, this behavior is unusable for
me. As I sometimes have quite large gridspacings here, for example to show
the temperature distribution in one axis only. Like a box having {140 40 40}
and I use spacing {10 40 40} would result in a X-distribution only. But also
when using 1A spacing, the volume slice will be 1 times spacing too small in
all upper box boundaries what makes it impossible to assign the data to the
right atoms visually. To show that this is not a problem of my dx files, let
me say that also the VMDs PME Electrostatics dx files show the same
behavior, although both files are correct due the opendx standard.


Some more examples:


Gridsize Spacing expected_Box resulting_Box

  1x 1 x 1 30x30x30 30x30x30 30x30x30

  3 x 3 x 3 10x10x10 30x30x30 20x20x20

  6 x 6 x 6 5 x 5 x 5 30x30x30 25x25x25

10x10x10 3 x 3 x 3 30x30x30 27x27x27


For now I can cheat by saving my dx files with wrong delta values, so the
resulting box size fits, but what about other dx files, also from PME?


Please find some time to fix this.


Thank you very much


Norman Geist