From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Thu Aug 01 2013 - 05:18:59 CDT

On Thu, Aug 1, 2013 at 10:43 AM, Norman Geist
<norman.geist_at_uni-greifswald.de> wrote:
> 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)

also, i am not sure about your interpretation of the code:
what you call "gridspacing" is actually the number of (regular) grid
points in that direction
and what you call gridsize is the space between two grid points in
that direction.

mind you the DX reader does *not* miss those gridpoints. it reads
*all* of them. in fact, those are needed for smooth surfaces.
*but* due to expecting a general grid, VMD needs to cut off the
redundant data from the computation of the volume of the data set.
otherwise you cannot match the data with the corresponding (periodic)
coordinate data.

hope that clarifies matters a bit more.

axel.

> 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

-- 
Dr. Axel Kohlmeyer  akohlmey_at_gmail.com  http://goo.gl/1wk0
International Centre for Theoretical Physics, Trieste. Italy.