[gmx-users] trjcat -cat skips frames

Berk Hess gmx3 at hotmail.com
Fri Jul 11 16:37:12 CEST 2008


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
> ==========================================================
> 
> 
> _______________________________________________
> gmx-users mailing list    gmx-users at gromacs.org
> http://www.gromacs.org/mailman/listinfo/gmx-users
> Please search the archive at http://www.gromacs.org/search before posting!
> Please don't post (un)subscribe requests to the list. Use the 
> www interface or send it to gmx-users-request at gromacs.org.
> Can't post? Read http://www.gromacs.org/mailing_lists/users.php

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-users/attachments/20080711/ce1f388e/attachment.html>


More information about the gromacs.org_gmx-users mailing list