How to read specific DCD frames directly in Fortran?

From: Yinglong Miao (
Date: Sat Apr 05 2008 - 13:21:53 CDT


I have a question about reading big binary DCD files in FORTRAN. In my
simulations with NAMD, there are cycles in which I want to read two frames
at the end of the DCD output trajectory for analysis and go back to NAMD to
continue. The problem is that the size of the DCD file keeps increasing as
the simulation goes on, and so does the time needed for reading. I am
wondering whether their are ways to read the last several frames of a DCD
file directly without going through the big file from the beginning in

I have tried to open the DCD file with position put at the end of the file
(append for position) and use "backspace" to read the lines I want, but it
turned out that the backspace doesn't work for unformatted files. I also
tried reading DCD lines using "direct access", but it seemed that only 1
record can be accessed. So my question is whether the DCD file supports
"direct access" reading. Or are there any other ways you know for my
purpose? I will appreciate it if you can share your experiences with me.


Yinglong Miao
Ph.D. Candidate
Center for Cell and Virus Theory
Chemistry Department, Indiana University
800 E Kirkwood Ave Room C203A, Bloomington, IN 47405
Tel: 1-812-856-0981

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:49:21 CST