From: Axel Kohlmeyer (
Date: Mon Jun 15 2009 - 10:18:34 CDT

On Sun, 2009-06-14 at 23:32 -0700, Rob wrote:


> Hi,
> I have created a plugin for reading two types of output files from ABINIT:
> the formatted/ascii GEO files, and the unformatted/binary DEN files.
> I might put some more work in it later to extend it to other ABINIT in/output files.
> Tell me what you think of it, if you are an ABINIT user and want to
> try it out. Source code is here:

i don't have ABINIT installed (well, not yet. i want to try out the GPU
accelerated wavelet code from bigdft at some point in the near future),
but there are a few minor issues with your code, which we just fixed in
other plugins for the upcoming release as well.

- please don't use c++ style comments in c code. this breaks
  with some compilers that are not yet fully compliant with the
  latest standards (try compiling with gcc -std=c89)

- if you use strtok(), you cannot flag your code as re-entrant.
  strtok() uses a global static storage. if there is an easy way
  to avoid it, i'd encourage you to do so. unfortunately, this is
  not always the case (since strtok is convenient, we may be forced
  to provide a portable and thread-safe work-alike for molfile).

- with gcc-4 and later you should use "gcc -shared" instead of
  "ld -shared" otherwise you're missing some startup code in the
  plugin that will cause problems on some platforms.

> All you have to do is:
> $ gcc -O2 -Wall -I. -I$VMDBASEDIR/plugins/include -c abinitplugin.c
> $ ld -shared -o abinitplugin.o
> Then
> copy $VMDBASEDIR/plugins/$ARCH/molfile
> The DEN files contain both structure and volumetric data and therefore
> I read both of them; so after reading the DEN file you have the structure
> plus the density together.
> I have tested it on my own Linux systems (Fedora 10 & 11), on which I also
> run the ABINIT code. I'm not sure how machine-independent my code is
> for reading the binary DEN files.Let me know if you encounter problems.

which compiler do you use for ABINIT?

as far as i can tell, your code does not seem to be compatible
with big-endian files and 64-bit record-length markers.

if you compile ABINIT with gfortran, you should be able to emulate
this via setting the GFORTRAN_CONVERT_UNIT environment variable
or using the -fconvert compile option and using the
-frecord-marker=<length> option, respectively.

> Rob.

Axel Kohlmeyer
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
If you make something idiot-proof, the universe creates a better idiot.