[gmx-users] RE: trjcat -cat skips frames
Mike Wykes
mikewykes at gmail.com
Thu Jul 15 14:05:15 CEST 2010
Dear all,
I experienced the same skipping of frames when concatenating several
trajectories together using trjcat as reported in a thread from 2008
(see below). Apparently the problem has not been resolved. I am using
Gromacs 4.0.7 and each original trajectory was about 200ns long with
frames saved every 2ps.
This is what I tried to to:
trjcat -f sampling.part0002.xtc sampling.part0003.xtc
sampling.part0004.xtc sampling.part0005.xtc -o sampling-whole.xtc -dt
100
This results in a trajectory with missing frames. I spotted this by
using g_traj to save the box size vs time in an xvg file, then plotted
the line number (i.e. frame number) vs time and saw that it was not a
perfectly straight line.
Splitting up the trjcat procedure into many steps works, giving a
perfectly straight line of frame number vs time.
trjcat -f sampling.part0002.xtc -o part2dt100.xtc -dt 100
trjcat -f sampling.part0003.xtc -o part3dt100.xtc -dt 100
trjcat -f sampling.part0004.xtc -o part4dt100.xtc -dt 100
trjcat -f sampling.part0005.xtc -o part5dt100.xtc -dt 100
trjcat -f part2dt100.xtc part3dt100.xtc -o parts2-3dt100.xtc
trjcat -f part4dt100.xtc part5dt100.xtc -o parts4-5dt100.xtc
trjcat -f parts2-3dt100.xtc parts4-5dt100.xtc -o allt100.xtc
So watch out when you are concatenating several long trajectories
together using trjcat!
Regards,
Mike
[gmx-users] trjcat -cat skips frames
Berk Hess gmx3 at hotmail.com
Fri Jul 11 16:37:12 CEST 2008
* Previous message: [gmx-users] trjcat -cat skips frames
* Next message: [gmx-users] error in grompp
* Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
Do you really want to plainly cat the trajectories?
In that case the unix cat command would also do the trick.
trjcat -cat does not remove double frames, but does seem to remove
frames with time before the last written frame.
I found and fixed a bug in trjcat (fix is only in the CVS head tree)
where trjcat would skip frames with -b when some files were not used.
I pasted the fix below.
You can try to see if it also solves your problem.
Berk.
In gmx_trjcat.c replace the if (i >0) { ... } with the code below.
/* set the next time from the last frame in previous file */
if (i > 0) {
if (frame_out >= 0) {
if(cont_type[i]==TIME_CONTINUE) {
begin =frout.time;
begin += 0.5*timestep;
settime[i]=frout.time;
cont_type[i]=TIME_EXPLICIT;
}
else if(cont_type[i]==TIME_LAST) {
begin=frout.time;
begin += 0.5*timestep;
}
/* Or, if the time in the next part should be changed by the
* same amount, start at half a timestep from the last time
* so we dont repeat frames.
*/
/* I don't understand the comment above, but for all the cases
* I tried the code seems to work properly. B. Hess 2008-4-2.
*/
}
/* Or, if time is set explicitly, we check for overlap/gap */
if(cont_type[i]==TIME_EXPLICIT)
if( ( i < nfile_in ) &&
( frout.time < settime[i]-1.5*timestep ) )
fprintf(stderr, "WARNING: Frames around t=%f %s have a different "
"spacing than the rest,\n"
"might be a gap or overlap that couldn't be corrected "
"automatically.\n",convert_time(frout.time),time_unit());
}
> Date: Fri, 11 Jul 2008 15:57:54 +0200
> From: michel.cuendet at isb-sib.ch
> To: gmx-users at gromacs.org
> Subject: [gmx-users] trjcat -cat skips frames
>
>
> Hi all,
>
> I have 162 small independent trajectories (from time 100 to time 300ps,
> 2ps interval) in directories named 1/ ... 162/. I want to merge them
> into one big trajectory for analysis purposes:
>
> trjcat -cat -o traj_tot.xtc -f */traj.xtc
>
> trjcat seems to start skipping some frames after about the 100th
> trajectory. It does not start reading at time 100 anymore. Total number
> of frames is 15432 instead of the 162*101 = 16632 that it should be.
> Output looks like below.
>
> Concatenating the trajectories in two batches of about 80 trajectories
> each and then combining the two resulting files together works.
>
> Cheers,
> Michel
>
> ===================================================================
>
> Reading frame 0 time 100.000
>
> Continue writing frames from 100/traj.xtc t=100 ps, frame=0
> Last frame 100 time 300.000 -> frame 100 time 300.000 ps
> Reading frame 0 time 100.000
> lasttime 300
>
> Continue writing frames from 101/traj.xtc t=100 ps, frame=101
> Last frame 100 time 300.000 -> frame 200 time 298.000 ps
> Reading frame 0 time 100.000
> lasttime 300
>
>
> [ ... normal output until... ]
>
>
> Continue writing frames from 44/traj.xtc t=100 ps, frame=10100
> Last frame 100 time 300.000 -> frame 10200 time 300.000 ps
> Reading frame 0 time 100.000
> lasttime 300
>
> Continue writing frames from 45/traj.xtc t=100 ps, frame=10201
> Last frame 100 time 300.000 -> frame 10300 time 298.000 ps
> Reading frame 0 time 100.000
> lasttime 300
> Reading frame 1 time 102.000
> Continue writing frames from 46/traj.xtc t=102 ps, frame=10302
> Last frame 100 time 300.000 -> frame 10400 time 298.000 ps
> Reading frame 0 time 100.000
> lasttime 300
> Reading frame 1 time 102.000
> Continue writing frames from 47/traj.xtc t=102 ps, frame=10402
> Last frame 100 time 300.000 -> frame 10500 time 298.000 ps
> Reading frame 0 time 100.000
> lasttime 300
> Reading frame 2 time 104.000
> Continue writing frames from 48/traj.xtc t=104 ps, frame=10502
> Last frame 100 time 300.000 -> frame 10600 time 300.000 ps
> Reading frame 0 time 100.000
> lasttime 300
> Reading frame 2 time 104.000
> Continue writing frames from 49/traj.xtc t=104 ps, frame=10601
> Last frame 100 time 300.000 -> frame 10690 time 282.000 ps
> Reading frame 0 time 100.000
> lasttime 300
> Reading frame 3 time 106.000
> Continue writing frames from 4/traj.xtc t=106 ps, frame=10700
> Last frame 100 time 300.000 -> frame 10790 time 286.000 ps
> Reading frame 0 time 100.000
> lasttime 300
> Reading frame 3 time 106.000
> Continue writing frames from 50/traj.xtc t=106 ps, frame=10798
> Last frame 100 time 300.000 -> frame 10890 time 290.000 ps
> Reading frame 0 time 100.000
> lasttime 300
>
> [ ... more drifting the first frame read until ... ]
>
> Reading frame 30 time 160.000
> Continue writing frames from 99/traj.xtc t=160 ps, frame=15290
> Last frame 100 time 300.000 -> frame 15360 time 300.000 ps
> Reading frame 0 time 100.000
> lasttime 300
> Reading frame 30 time 160.000
> Continue writing frames from 9/traj.xtc t=160 ps, frame=15361
> Last frame 100 time 300.000 -> frame 15430 time 298.000 ps
>
> Last frame written was 15431, time 300.000000 ps
>
> ===================================================================
>
>
> ==========================================================
> Michel Cuendet, Ph.D
> Molecular Modeling Group
> Swiss Institute of Bioinformatics
> CH-1015 Lausanne, Switzerland
> http://ludwig-sun1.unil.ch/~mcuendet
> ==========================================================
More information about the gromacs.org_gmx-users
mailing list