Re: vmd-l: How to read specific DCD frames directly in Fortran?

From: Peter Freddolino (
Date: Sat Apr 05 2008 - 13:38:39 CDT

For the specific need that you're describing, you could instead use the
restart.coor and restart.coor.bak files, which contain coordinates for
the previous two frames. Since dcds have a fixed size per frame I'd
think you should be able to calculate the position you want and seek to
it (see the skip_dcdstep function in the dcd plugin of VMD's molfile
plugins for an example of the calculations to skip one frame), but I'm
not familiar enough with I/O in fortran or with the dcd format to say
how to do this.

Yinglong Miao wrote:
> Hi,
> 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 FORTRAN.
> 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.
> Thanks,
> Long
> --
> 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