From: Axel Kohlmeyer (axel.kohlmeyer_at_theochem.ruhr-uni-bochum.de)
Date: Wed Mar 23 2005 - 01:33:31 CST

On Tue, 22 Mar 2005 18:30:46 +0000 Keith Refson wrote:

> Aha, I can immediately see that this is a completely different file format
> from the one I have. For beginners, mine is formatted and begins:
>
> COMMENT
> (E12.5)
> 1.00000 1.00000 1.00000 90.00000 90.00000 90.00000
> 17 17 17
> 1 0 17 0 17 0 17
> -1.80629
> -1.77782
> -1.54669
> -0.70950
> 0.62344

>
> Perhaps I was mistaken in thinking I was successful with this format
> previously. Could a former version have supported xplor, which I can
> also generate?
>
> Otherwise, perhaps you could recommend a suitable text of binary format
> I should use, since I have to write the converter anyway.
>

keith,

this looks quite similar to the gaussian cube format (which has additionally
coordinates in it and currently needs at least one (dummy) atom to be
read into VMD properly).

here's a format spec:
C WRITE A FORMATTED 'DENSITY-STYLE' CUBEFILE VERY SIMILAR
C TO THOSE CREATED BY THE GAUSSIAN PROGRAM OR THE CUBEGEN UTILITY.
C THE FORMAT IS AS FOLLOWS (LAST CHECKED AGAINST GAUSSIAN 98):
C
C LINE FORMAT CONTENTS
C ===============================================================
C 1 A TITLE
C 2 A DESCRIPTION OF PROPERTY STORED IN CUBEFILE
C 3 I5,3F12.6 #ATOMS, X-,Y-,Z-COORDINATES OF ORIGIN
C 4-6 I5,3F12.6 #GRIDPOINTS, INCREMENT VECTOR
C #ATOMS LINES OF ATOM COORDINATES:
C ... I5,4F12.6 ATOM NUMBER, CHARGE, X-,Y-,Z-COORDINATE
C REST: 6E13.5 CUBE DATA
C NOTE: ALL coordinates are in atomic units.
C

i'll attach a small utility i wrote recently to 'optimize' cubefiles.
feel free to extract the writer for your purposes.

alternatively, the OpenDX (http://www.opendx.org/) .dx format may be
interesting. this is an extremely flexible format and VMD only supports
a subset of it. here's the spec from the plugin:

/*
 * DX potential maps
 *
 * Format of the file is:
 * # Comments
 * .
 * .
 * .
 * object 1 class gridpositions counts xn yn zn
 * origin xorg yorg zorg
 * delta xdel 0 0
 * delta 0 ydel 0
 * delta 0 0 zdel
 * object 2 class gridconnections counts xn yn zn
 * object 3 class array type double rank 0 items [ xn*yn*zn ] data follows
 * f1 f2 f3
 * f4 f5 f6
 * .
 * .
 * .
 * object "Dataset name" class field
 
 * Where xn, yn, and zn are the number of data points along each axis;
 * xorg, yorg, and zorg is the origin of the grid, in angstroms;
 * xdel, ydel, and zdel are the scaling factors to convert grid units to
 * angstroms.
 * Grid data follows, with three values per line, ordered z fast, y medium,
 * and x slow.
 *
 * Note: this plugin was written to read the OpenDX files created by the
 * APBS program, and may not support all of the features in the file format.
 *
 */

hope this helps a little,

axel.

> Keith Refson
>
>
> Justin Gullingsrud wrote:
> > Hi,
> >
> > Could you try again with VMD 1.8.3 and let us know if you get the same
> > problem? Failing that, here is some information from the source code
> > which may be helpful:
> >
> > /*
> > * "unformatted" binary potential map, as used by Grasp and DelPhi
> > *
> > * Format (fortran):
> > * character*20 uplbl
> > * character*10 nxtlbl,character*60 toplbl
> > * real*4 phi(n,n,n)
> > * character*16 botlbl
> > * real*4 scale,oldmid(3)
> > *
> > * Where n is the length in grid units of each edge of the grid.
> > *
> > * More information can be found at:
> > * <http://honiglab.cpmc.columbia.edu/grasp/grasp_contents.html#A.2>
> > * <http://trantor.bioc.columbia.edu/delphi/doc/file_format.html>
> > */
> >
> > Cheers,
> > Justin
> >
> >
> > On Tue, 22 Mar 2005 15:57:02 +0000, Keith Refson <kr_at_isise.rl.ac.uk> wrote:
> >
> >>I'm attempting to write a utility to import some charge-density data into V
MD.
> >>The data is on a regular grid, and I'm attempting to convert it to .grd fil
e
> >>format. I had a working version with an earlier version of vmd, but with 1
.8.2
> >>I get a file format error reported on attempting to read it into vmd.
> >>
> >> Unable to open file with plugin of type grd
> >> Improperly formatted file header: uplbl.
> >>
> >>Can someone help me out with some documentation of the format required
> >>and hopefully an example .grd file I can use as a template?
> >>
> >>Thanks
> >>
> >>Keith Refson
> >>--
> >>Dr Keith Refson,
> >>Building R3
> >>Rutherford Appleton Laboratory
> >>Chilton
> >>Didcot kr AT isise
> >>Oxfordshire OX11 0QX DOT nd DOT rl DOT ac DOT uk
> >>
> >
> >
> >
>
>
> --
> Dr Keith Refson,
> Building R3
> Rutherford Appleton Laboratory
> Chilton
> Didcot kr AT isise
> Oxfordshire OX11 0QX DOT nd DOT rl DOT ac DOT uk
>

--
=======================================================================
Axel Kohlmeyer      e-mail:  axel.kohlmeyer_at_theochem.ruhr-uni-bochum.de
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                   http://www.theochem.ruhr-uni-bochum.de
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.