Gmx density scales the axis to last frame

GROMACS version: 5.1.4 and 2020.1 among others
GROMACS modification: No

When calculating the density profile across the box axis for lipid bilayer simulations, I noticed that gmx density scales the output to the dimension of the last frame. This poses a problem eg. when one wants to Fourier transform the electron density from NPT simulation to compare with scattering experiments. Something like an average box dimension or max box dimension would make more sense for the axis scaling, and is also what I would expect based on the documentation. I created two 2-frame trajectories with the frames (numbers 2 and 31 from another trajectory) in opposite orderings to demonstrate:

gmx density -f frames31_2.trr -s …/prod.tpr -ei electrons.dat -dens electron -o electronDENSITYsys31_2.xvg -xvg none -sl 100

[antila@hot nocentered]$ tail -n 3 electronDENSITYsys31_2.xvg
6.47416 327.088
6.54056 310.069
6.60696 368.365

gmx density -f frames2_31.trr -s …/prod.tpr -ei electrons.dat -dens electron -o electronDENSITYsys2_31.xvg -xvg none -sl 100

[antila@hot nocentered]$ tail -n 3 electronDENSITYsys2_31.xvg
6.95413 327.088
7.02545 310.069
7.09678 368.365

While going down this rabbit hole I also noticed that some gromacs versions don’t handle uneven numbers of bins for gmx density and the 2020.1 crashes on random frames of the trajectory when option -center is not used. This perhaps signals some general issues with the binning for NPT simulations. I attempted to file an issue on these matters but encountered a “403 You are not authorized to access this page.” despite being logged in the system.


this sounds like there are a number of issues for us to fix.
Did you try to file the issue on redmine or GitLab? Redmine is now
read-only as we have moved everything to GitLab.
You should be able to file new issues here:

Please also provide us with the inputs to reproduce the problems.




I tried doing the bug report via redmine, I’ll file an issue with gitlab on this. Thanks for the tip!