Concatenation of xtc files

GROMACS version:
GROMACS modification: No
Dear community members I am having a hard time in understanding the concatenation of trajectory function in gromacs. I did a protein-ligand complex simulation in gromacs for 50 ns. Then i extended the simulation for 50 ns more so that I get 100 ns of total run time. To extend the simulation I used the following commands:

gmx convert-tpr md_0_50.tpr -extend 50000 -o md_0_100.tpr

gmx mrun -deffnm md_0_100 -cpi md_0_50.cpt -noappend

Now, after the new simulation got completed successfully I checked my log files for the both the simulations. I observed that my first simulation ran from 0 to 50000.000 ps time while my second simulation started from 50000.000 ps and went on till100000.00 ps.

Now I concatenated the two xtc files using the command

Command line:

gmx trjcat -f md_0_50.xtc md_0_100.part0002.xtc -o Final100ns.xtc

Reading frame 1 time 50010.000

Summary of files and start times used:

File Start time Time step


md_0_50.xtc 0.000 ps 10.000 ps

md_0_100.part0002.xtc 50000.000 ps 10.000 ps

Reading frame 0 time 0.000

Continue writing frames from md_0_50.xtc t=0 ps, frame=0

Last frame 5000 time 50000.000 → frame 4000 time 40000.000 ps

Reading frame 0 time 50000.000

lasttime 49990

Continue writing frames from md_0_100.part0002.xtc t=50000 ps, frame=5000

Reading frame 5000 time 100000.000 → frame 10000 time 100000.000 ps Last frame 5000 time 100000.000

Last frame written was 10000, time 100000.000000 ps

Now, my doubt is why the start time for second simulation is 50000 ps and not 50010.00 ps. Is the last time frame (50000.00 ps) redundant in my Finalconcatenated xtc file.

Please help me with this. Thanks in advance.

Just a small update/addition to the above question:

I tried concatenating the two trajectory files again but this time using the -settime flag.

I used the following command:

gmx trjcat -f md_0_50.xtc md_0_100.part0002.xtc -settime -o Trial.xtc

when prompted, i used the ‘l’ option for the current start of the extended xtc file )md_0_150.part0002.xtc). I am sharing the print output on the terminal:

Reading frame 1 time 50010.000

Enter the new start time (ps) for each file.

There are two special options, both disable sorting:

c (continue) - The start time is taken from the end

of the previous file. Use it when your continuation run

restarts with t=0.

l (last) - The time in this file will be changed the

same amount as in the previous. Use it when the time in the

new run continues from the end of the previous one,

since this takes possible overlap into account.

File Current start (ps) New start (ps)


md_0_50.xtc 0.000 ps 0

md_0_100.part0002.xtc 50000.000 ps l

Sorting disabled.

Summary of files and start times used:

File Start time Time step


md_0_50.xtc 0.000 ps 10.000 ps

md_0_100.part0002.xtc Change by same amount as last file

Reading frame 0 time 0.000

Continue writing frames from md_0_50.xtc t=0 ps, frame=0

Last frame 5000 time 50000.000 → frame 5000 time 50000.000 ps

Reading frame 0 time 50000.000

lasttime 50000

Reading frame 1 time 50010.000

Continue writing frames from md_0_100.part0002.xtc t=50010 ps, frame=5001

Last frame 5000 time 100000.000 → frame 10000 time 100000.000 ps

Last frame written was 10000, time 100000.000000 ps

Then to check i used gmx check -f Trial.xtc and I got the following output on the screen.

Checking file Trial.xtc

Reading frame 0 time 0.000

Atoms 49899

Precision 0.001 (nm)

Last frame 10000 time 100000.000

Item #frames Timestep (ps)

Step 10001 10

Time 10001 10

Lambda 0

Coords 10001 10

Velocities 0

Forces 0

Box 10001 10

Now which of the two methods is correct. The one mentioned in my first comment in this thread or this one. Also why does the output of gmx check shows 10001 frames i.e. one extra frame. Please help me in understanding this. Thanks in advance.

Best regards

GROMAS differs from a lot of other programs in that mdrun always writes a frame at t=0 (or t=initial time in the case of a continuation), which leads to duplicate frames. The native behavior of trjcat is to account for this and discard the duplicate frame. You shouldn’t need to do anything. You’ll get 10001 frames because it includes t=0 and then all subsequent save intervals (10000 expected frames).

Thanks Dr. Lemkul for answering my query. I understand that my second simulation starts from 50000 ps but that frame is not duplicated in the concatenated xtc file. However, I have one more doubt. This time I used the same command gmx trjcat -f md_0_50.xtc md_0_100.part0002.xtc -settime -o Trial.xtc however I manually gave the time for the new start for the second trajectory file (md_0_100.part002.xtc) as 50010.00 ps as the last time in the first xtc file is 50000.00 ps.

I am sharing the terminal output here:

gmx trjcat -f md_0_50.xtc md_0_100.part0002.xtc -settime -o Trail.xtc

Reading frame 1 time 50010.000

Enter the new start time (ps) for each file.

There are two special options, both disable sorting:

c (continue) - The start time is taken from the end of the previous file. Use it when your continuation run restarts with t=0.

l (last) - The time in this file will be changed the same amount as in the previous. Use it when the time in the new run continues from the end of the previous one, since this takes possible overlap into account.

File Current start (ps) New start (ps)


md_0_50.xtc 0.000 ps 0

md_0_100.part0002.xtc 50000.000 ps 50010.000

Summary of files and start times used:

File Start time Time step


md_0_50.xtc 0.000 ps 10.000 ps

md_0_100.part0002.xtc 50010.000 ps 10.000 ps

Reading frame 0 time 0.000

Continue writing frames from md_0_50.xtc t=0 ps, frame=0

Last frame 5000 time 50000.000 → frame 5000 time 50000.000 ps

Reading frame 0 time 50000.000

lasttime 50000

Continue writing frames from md_0_100.part0002.xtc t=50010 ps, frame=5001

Last frame 5000 time 100000.000 > frame 9010 time 90100.000 ps

Last frame written was 10001, time 100010.000000 ps

I am confused that why it shows last frame as 10001 and time as 100010 ps instead of 10000 and 100000 ps.

Now when I run the gmx check command I got the following output:

gmx check -f Trial.xtc

Checking file Trial.xtc

Reading frame 0 time 0.000

Atoms 49899

Precision 0.001 (nm)

Reading frame 10000 time 100000.000

Item #frames Timestep (ps)

Step 10002 10

Time 10002 10

Lambda 0

Coords 10002 10

Velocities 0

Forces 0

Box 10002 10

I am confused that why this shows 10002 frames instead of 10001. Could you please share your insight on this one. Thanks in advance.

Dear Experts please help me in clearing this doubt.

Thanks

Because you provided a fictitious start time for the second interval, so there was no removal of the duplicate frame, instead you’re calling t=50000 and t=50010 distinct frames, when they are actually the same. So trjcat does not detect a duplication, and just writes everything.

Thank you Dr. Lemkul for a nice explanation.
Best Regards