GMX Trajectory not extracting force or velocities

GROMACS version: 2021.3
GROMACS modification: Yes

I have these enabled in my md file:

nstxout                = 500 
nstvout                = 500
nstfout                 = 500 

but when I use:

gmx trajectory

I could only extract the position but not the velocities and forces. How to extract forces and velocities from my trajectory files?

What does gmx check tell you about the contents of the trajectory? What was your exact gmx trajectory command?

This is what appears after: gmx check -f md.trr -rmsd

Item        #frames Timestep (ps)
Step         50001    1
Time         50001    1
Lambda       50001    1
Coords       50001    1
Velocities   50001    1
Forces       50001    1
Box          50001    1

And what was your gmx trajectory command?

Hi all,

I have in principle the same problem: I would like to extract the molecular COM velocity for a subgroup (“LIG”) of the system with the following command:
gmx trajectory -f trajectory.trr -s topol.tpr -e 100 -ov vel_tmp.xvg -seltype mol_com -select LIG
This will result in an empty velocity file (vel_tmp.xvg), which only contains the .xvg header.

If I also want to extract the position with the following command:
gmx trajectory -f trajectory.trr -s topol.tpr -e 100 -ox pos_tmp.xvg -ov vel_tmp.xvg -seltype mol_com -select LIG
I will obtain the following error message:

-------------------------------------------------------
Program:     gmx trajectory, version 2021.3
Source file: src/gromacs/analysisdata/datastorage.cpp (line 828)
Function:    gmx::AnalysisDataStorageFrame& gmx::AnalysisDataStorage::startFrame(const gmx::AnalysisDataFrameHeader&)

API error (bug):
Out of bounds frame index

For more information and tips for troubleshooting, please check the GROMACS
website at http://www.gromacs.org/Documentation/Errors
-------------------------------------------------------

In the trajectory, there are positions and velocities (no forces), both saved every 0.2 ps (i.e. every 200 timesteps) as confirmed by gmx check:

Item        #frames Timestep (ps)
Step        250001    0.2
Time        250001    0.2
Lambda      250001    0.2
Coords      250001    0.2
Velocities  250001    0.2
Forces           0
Box         250001    0.2

I also tried different types of the selection (different groups, -seltype atom) with the same results.

Do you have an idea, whether it is a misusage/not implemented feature or a bug?

Best,
Andreas

Hi,
Did you manage to get the Velocities? I am reporting also something similar with gmx trajectory. Take a look at GMX trjconv does not print forces and velocities from trajectory trr file
If you managed to fix this, I will appreciate any hint.
best,
Adolfo

it seem to be a problem with gmx trajectory with flag -ov -of and it requires someone to check It out.

Alternatively if you are not interested in -select, you can use the simple

gmx g_traj with flags -ov -of

with same flags and it works for me, as long as your trr file has save the velocities and forces (nstxout, nstvout, nstfout).

cheers,
Adolfo