Reading 32bit unformatted files in 64bit systems
Ignacio Fernández Galván
jellby@yahoo.com
Fri Dec 30 11:42:00 GMT 2011
Hi all,
I'm trying to read unformatted fortran files in an x86_64 system. The files are DCD trajectories, roughly described here: http://www.lrz.de/~heller/ego/manual/node93.html
I don't seem to get meaningful results, and I believe the problem is that the DCD files are generated in 32bit systems. I try something simple:
PROGRAM ReadDCD
IMPLICIT NONE
CHARACTER(LEN=4) :: HDR
INTEGER :: NSET,ISTRT,NSAVC,NFIXED,ZEROS5(5),ZEROS9(9)
DOUBLE PRECISION :: DELTA
OPEN(10,FILE='traj.dcd',FORM='UNFORMATTED',STATUS='OLD',ACTION='READ')
READ(10) HDR,NSET,ISTRT,NSAVC,ZEROS5(:),NFIXED,DELTA,ZEROS9(:)
CLOSE(10)
WRITE(6,*) HDR,NSET,ISTRT,NSAVC,ZEROS5(:),NFIXED,DELTA,ZEROS9(:)
END PROGRAM ReadDCD
Compile and run it and get:
CORD 1677721600 -402456576 -402456576 0 ...
which doesn't make sense, since the corresponding hex data in the "traj.dcd" file are:
43 4F 52 44 00 00 00 64 00 00 03 E8 00 00 03 E8 00 00 00 00
("CORD" plus four 4-byte numbers: 100, 1000, 1000, 0)
I tried with the -m32 flag, but it doesn't change anything. Is it possible at all to read these files? What am I doing wrong?
My system is Ubuntu Oneiric, with default gfortran (gcc 4.6.1).
Thanks
Ignacio
More information about the Fortran
mailing list