Re: 'cutting' colvars.traj file

From: Bjoern Olausson (
Date: Wed Apr 27 2011 - 05:53:41 CDT

On Saturday 23 April 2011 20:07:20 Branko wrote:
> Hi Yves,
> Most probably I wasn't clear enough. You are entirely right that
> "colvarsTrajFrequency" same as dcd frequency will give output as I
> expect from described script, still if frequency is set on different
> value (more frequent sampling) for posterior analysis of different type,
> not just for comparision with dcd, such script will be useful.
> Generally, as 'cutdcd' already exist I suppose that someone maybe make
> similar script for colvars.traj. Thank you very much for prompt respond
> Kind regards
> Branko
> On 4/23/2011 7:54 PM, Wang Yi wrote: Hi Branko,
> I might have misunderstood your question. But shouldn't setting
> "colvarsTrajFrequency" to your DCD frequency do the job?
> Best,
> ___________________________
> Yi (Yves) Wang
> Duke University
> ? 2011-4-23,??1:28, Branko ??:
> > Dear NAMD users,
> >
> > I recognized as potentially very useful tool that could extract data
> > from colvars.traj file (indeed 2.8b1 record each step and give good
> > output, different of some 2.7 releases), recording for example every
> > 100, or 1000th line, in order to produce file comparable with
> > trajectory frequency. If anyone already made such script I'll
> > appreciate information about this.
> >
> > Branko

Hi Branko,

I had to strip some lines from a colvar trajectory file and quickly hacked
together some lines in Python. I added some more lines to make it a bit more
user friendly. Please test and let me know if it works for you. With some
modification this can be used for any text files...

The first trajectory contains frame zero which my script considers. So the
first trajectory always has one more frame then the consecutive trajectory
files for my script. All other trajectory files from consecutive runs repeat
the last frame of the previous run which my file strips. So if your runs have
100 frames the colvar trajectories will have 101 frames. In the first
trajectory contains frame 0 to 100. This additional frame here is frame 0. The
second trajectory contains the frames 100 to 201. The additional frame here is
frame 100 which is a "carry-over" from the first trajectory.

Coding style is "Get it done" ;-)


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:20:11 CST