# Restarting simulation from trajectory frames

**URL:** <https://gromacs.bioexcel.eu/t/restarting-simulation-from-trajectory-frames/9081>\
**Category:** User discussions\
**Created:** [May 7, 2024, 5:31am UTC](https://gromacs.bioexcel.eu/t/restarting-simulation-from-trajectory-frames/9081 "2024-05-07T05:31:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter.mawanga](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@peter.mawanga](https://gromacs.bioexcel.eu/u/peter.mawanga)\
**Post date:** [May 7, 2024, 5:31am UTC](https://gromacs.bioexcel.eu/t/restarting-simulation-from-trajectory-frames/9081/1 "2024-05-07T05:31:53Z")

</div>

GROMACS version: 2022.4  
GROMACS modification: No

Hello everyone,

(1) I want to analyze a trajectory for desired system states.

(2) Thereafter, my plan is to extract the desired frames using `gmx traj`, with the output in the `.trr` format. This particular format contains the coordinate as well as velocity and force information unlike the other file formats.

(3) Next, I want to restart the simulation using the extracted frame after using `gmx grompp` to create the run file.

(4) However, `gmx grompp` does not accept the `.trr` file as an input.

(5) Thus, I am not able to get the input file for the next `gmx mdrun` step.

Is there any way of fixing this issue or a comparable workaround? I would like to retain the velocity and force information for the next set of simulations.

Although a similar [question](https://gromacs.bioexcel.eu/t/reading-forces-from-trr-when-restarting-a-simulation/2674) has been discussed before, I am not sure if there have been any further updates regarding this issue. Thank you very much.

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [May 7, 2024, 5:53am UTC](https://gromacs.bioexcel.eu/t/restarting-simulation-from-trajectory-frames/9081/2 "2024-05-07T05:53:02Z")

</div>

You say that you want to extract frames to the .trr format. Does the original trajectory contain velocities?

`gmx grompp` can use a trajectory as input (using the `-t` option), but it will only use the last frame. So, if you want to use another frame you will need to extract that separately, but still to a .trr file, if you want to keep the precision. When you say that you want to “retain the velocity and force information”, you should be aware that forces are not used as input for generating the simulation starting state (the .tpr file). The forces are calculated from the coordinates.

---

<div class="post-metadata">

**Author:** ![peter.mawanga](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@peter.mawanga](https://gromacs.bioexcel.eu/u/peter.mawanga)\
**Post date:** [May 8, 2024, 2:17am UTC](https://gromacs.bioexcel.eu/t/restarting-simulation-from-trajectory-frames/9081/3 "2024-05-08T02:17:06Z")

</div>

@MagnusL Thank you very much for your assistance.

> [@MagnusL](#):
>
> You say that you want to extract frames to the .trr format. Does the original trajectory contain velocities?

I plan to extract the separate frames in the .trr format. As this is the default GROMACS trajectory output format and as per the available [information](https://manual.gromacs.org/archive/5.0.4/online/trr.html), I thought the frames would also contain the velocity and force information.

> [@MagnusL](#):
>
> When you say that you want to “retain the velocity and force information”, you should be aware that forces are not used as input for generating the simulation starting state (the .tpr file). The forces are calculated from the coordinates.

Can I only pass the .trr file using the `-t` flag to the `gmx grompp` command without using the `-c` flag? I think retaining the coordinate and velocity information should be sufficient for my case, even if the force information is not there in the .tpr file.

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [May 8, 2024, 6:54am UTC](https://gromacs.bioexcel.eu/t/restarting-simulation-from-trajectory-frames/9081/4 "2024-05-08T06:54:45Z")

</div>

.trr files can indeed store coordinates, velocities and forces. If you write the .trr file from your simulation (`gmx mdrun`) you can specify what output you want in the file. However, if you convert another file (e.g., an .xtc file) into a .trr file there will not be any velocity data. That is why I wondered if the original trajectory contained velocities (i.e. a .trr or .tng file written with velocity output).

I’m quite sure you need the `-c` option coordinate input file as well, but if also using the `-t` option, the coordinates and velocities from the last frame in the trajectory will be used instead. Coordinates and velocities are enough for a checkpoint file, so I think it should be enough in your case.

---

<div class="post-metadata">

**Author:** ![peter.mawanga](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@peter.mawanga](https://gromacs.bioexcel.eu/u/peter.mawanga)\
**Post date:** [June 5, 2024, 1:56am UTC](https://gromacs.bioexcel.eu/t/restarting-simulation-from-trajectory-frames/9081/5 "2024-06-05T01:56:04Z")

</div>

Thanks a lot for the information. The output file is indeed in the .trr format, but I plan to select certain frames from the trajectory based on parameters of interest.

Afterward, I want to use both the .gro and .trr files for a particular frame of interest to create the input .tpr file for the next simulation using `gmx grompp`.
