Re: Get number of timesteps from DCD via script

From: Joshua D. Moore (
Date: Wed Feb 09 2011 - 08:40:27 CST

This was not your original question.

"1) overall number of coordinate sets (timesteps)
2) write out frequency (dcdfreq)
3) first time step in dcd
4) last time step in dcd"

You asked to read the number of timesteps, first timestep, etc.

I was happy to give you a small code to read the header, but I'm not going
to spend a day to learn python to answer your question. That's your job.
You have two examples, mine, and the one from Andrew in Fortran if you'd
like to figure it out. There are many unformatted formats which read
different streams of data (binary vs unformatted, etc.) which as Axel
pointed out sometimes mean different things on different machines.

What is your dcd file name?

You can't put in this big long path. Execute the code from the directory
where the *dcd file is and retype "memb30_run400-bdvm-rna_npgt.dcd"

Andrew has shown you in Fortran from his previous email how to access the
PBCs and the coordinates, but you did not ask this question in your email.



On Wed, Feb 9, 2011 at 9:05 AM, Bjoern Olausson <>wrote:

> On Wednesday 09 February 2011 13:41:06 Joshua D. Moore wrote:
> > Just paste what I sent into a file named "read_dcd_header.f90"
> >
> > Then compile with
> >
> > f90 -o read_dcd_header.exe read_dcd_header.f90
> >
> > Then execute with
> >
> > ./read_dcd_header.exe
> >
> > When it asks you for the name of your dcd file, type in your dcd
> filename.
> Appart from the fact that it does not work for me (and indeed it was the
> first
> thing i tried when you posted the code to compare the output with my
> script),
> it is not an answer to my question.
> blub_at_repulsion $ gfortran -o read_dcd_header read_dcd_header.f90
> 14:59:46 [~/work/python-scrips]
> blub_at_repulsion $ ./read_dcd_header
> What is your dcd file name?
> /home/blub/work/bdvm/namd/membrane30_400-bdvm-rna-smd/run002/memb30_run400-
> bdvm-rna_npgt.dcd
> At line 15 of file read_dcd_header.f90 (unit = 243, file = '')
> Fortran runtime error: File '' does not exist
> 15:00:08 [~/work/python-scrips]
> blub_at_repulsion $
> I didn't ask for a program to do the stuff, because I need some of the
> values
> for my program written in python and I don't want to make calls to external
> tools.
> While I am happy with the fact that I can read the timesteps and write
> frequency I would like to be able to read the rest of the Information in
> the
> just in case I happen to make use of them and for the sake of completeness.
> So a proper header documentation would be great for folks like me, who are
> not
> familiar with Fortran/C and don't want to spend hours figuring out the
> stuff
> from catdcd/vmd/namd source code or struggle on wrong documentation.
> Cheers,
> Bjoern
> --
> 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 : Mon Dec 31 2012 - 23:19:47 CST