# Difference between density obtained from gmx energy & gmx densityusing

GROMACS version: 2020.2
GROMACS modification: No

Hello everyone,

I am simulating the deposition of C60 Molecules onto a graphene sheet. I am interested in the density analysis.

It seems that the density can be measured either by using the gmx energy or by using the gmx density and I would like to know what is the difference between the density values obtained by: gmx energy -f npt.edr -o density.xvg and by: gmx density -s md_0_1.tpr -f md_noPBC.xtc -o density.xvg ?

I have noticed that the values of the density obtained by gmx energy is with respect to time while the values obtained by gmx density is with respect to distance. If this is the only difference, then why did I obtain different values in each curve (The values obtained using gmx energy is on the left side with average value 1300 and the values obtained from gmx density is on the right side with average value 1550)?

Thanks

http://manual.gromacs.org/documentation/current/onlinehelp/gmx-density.html

`gmx density` computes partial densities across the box, using an index file.

gmx energy computes things for the entire box.

If you look at your right hand graph, from gmx density, the average is not 1550. At the start and end it drops down to 500 from a peak of 1550 around the central 5nm.

1 Like

Thanks for the clarification.

If I used gmx density and I selected the whole system, should I obtain similar value for that obtained using the gmx energy ?

I want to evaluate the density along the z axis and this is why I am using the gmx density, the problem is that, I found the value is not the same as the value obtained from gmx energy and therefore I don’t know , which one of them is more reliable ?

Is is possible to use gmx energy to obtain the values of density with respect to distance (along the z axis) ?

Many thanks

Possibly; try it and see.

As Dallas said, the two programs do different things. The value in the `.edr` file is computed during the simulation and is simply the total density of the box. There is no ability to decompose this value into anything else via `gmx energy`.

No.

3 Likes

A simplification of what you have going on in your system. Should you expect the values obtained from “gmx energy” and “gmx density” to be the same? Are they measuring the same thing? If you made a slice the size of the entire box, then you will get the same value. So “gmx density” is actually providing exactly what you want.

1 Like

Hallo, need help here

# Why the density of water (in 534K 14bar) is fluctuating like this in the electric field （2.5 GHz 1*10^9 V/m）？

PS there is no reply my topic, so i have to ask the relevant question here, sorry.