Basic doubt regarding frames in the trajectory

GROMACS version: 5.1.4
GROMACS modification: No

Respected community members,

I have one basic doubt regarding the frames in trajectory. I have done a 100 ns simulation and while doing analysis such as rmsd, distance estimation, and end frame extraction I am getting confused with the output printed on the terminal. While performing distance analysis using gmx distance command, the output says:

Reading file md_0_100.tpr, VERSION 5.1.4 (single precision)

Last frame 10000 time 100.000

Analyzed 10001 frames, last time 100000.000

While extracting the last frame using gmx trjconv command the output says:

Reading frame 0 time 0.000

Precision of md_0_100_center.xtc is 0.001 (nm)

Reading frame 10000 time 100000.000

Dumping frame at t= 100000 ps

Last frame 10000 time 100000.000

Lastly, while doing an RMSD analysis using gmx rms, the output says

Last frame 10000 time 100.000

In the first analysis (gmx distance) why it says “Analyzed 10001 frames, last time 100000.000” when actually the last frame is supposed to be 10000. If there are 10001 frames then why gmx trjconv says “Reading frame 0 time 0.000”. Why it does not say Reading frame 1 time 0.000? Why some programs say last frame is 10000 while some say 10001?

According to my understanding mdrun writes a frame at t=0. Is it that the number of frames is 10001 but the modules like gmx distance, trjconv, and rms etc automatically ignore that t=0 frame (that makes 10000 into 10001) and read the total frames as 10000 while going through all the 10001 frames.

Dear members, please help me in clearing this basic doubt. I will be highly grateful. Thanks in advance.

Frames in this context are indexed from 0, so the first frame has index = 0. You are correct that this is at t = 0.0. Including that frame in the total number of frames you get 10001 frames, the last of which has index = 10000.

This is called zero-based indexing and is pretty common in computer code.

Thanks Dr. Johansson for answering my basic question. So just to cross-check whether I understand this properly, 1st frame will have a index of 0 at the time = 0.00. Then 2nd frame will have a index of 1 at t = 1…so on…

Best regards