Reading NAMD coor files in CHARMM -> Fail for 64Bit

From: Bjoern Olausson (
Date: Wed Aug 11 2010 - 06:57:27 CDT


Just in case someone is willing to fix the CHARMM part of reading NAMD coor
files. I figured out that the code is not portabele between 32/64Bit more then
to figure out the problem is beyond may lacking C skills.

Everything I found out so far is documented in the CHARMM-Forum:

It looks as if the CHARMM Devs are not very eager to fix this bug.
I don't know how much work it is to fix the variable declaration (I guess it
is some INT <-> LONG Problem) but if has the time, will and guts to mess with
this code I would appreciate it very much since I occasionately would like to
read a coor file instead of reding the coordinate set from a whole DCD.

I'll shortly summarize my findings:

The following check fails compiled for 64Bit:
  /* checking if the number of atoms is the same
  printf("checking if the number of atoms is the same\n");
  if ( n != (*ptr_natom)) {
    printf("number of atoms does not match; in psf %d, in file %d ; exiting...
\n", n, *ptr_natom);
    *ptr_ier = -1;

number of atoms does not match; in psf 68120, in file 68120 ; exiting..

Commenting out the above check, makes the following loop infinite:

  printf("read in coordinates\n");
  for (i = 0; i < n; i++) {
    printf("read in coordinates. Atom %d of %d \n", i, n);
  printf("done reading coordinates\n");

read in coordinates. Atom 10961940 of 68120
read in coordinates. Atom 10961941 of 68120

What is weird:
i,n and ptr_natom ar all declared as LONG:

#ifdef i8
#define INT long
#define INT int

I know it is some extraordinary request... fixing some code of a competitive
program ;-)


Bjoern Olausson
Martin-Luther-Universit├Ąt Halle-Wittenberg 
Fachbereich Biochemie/Biotechnologie
Kurt-Mothes-Str. 3
06120 Halle/Saale
Phone: +49-345-55-24942

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:54:24 CST