# How to calculate density using gmx energy

**URL:** <https://gromacs.bioexcel.eu/t/how-to-calculate-density-using-gmx-energy/995>\
**Category:** User discussions\
**Created:** [October 22, 2020, 2:47am UTC](https://gromacs.bioexcel.eu/t/how-to-calculate-density-using-gmx-energy/995 "2020-10-22T02:47:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjeamin](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@jjeamin](https://gromacs.bioexcel.eu/u/jjeamin)\
**Post date:** [October 22, 2020, 2:47am UTC](https://gromacs.bioexcel.eu/t/how-to-calculate-density-using-gmx-energy/995/1 "2020-10-22T02:47:46Z")

</div>

GROMACS version: 2019.3  
GROMACS modification: No

Q: Is there not a selection for computing density using GMX energy in this version of gromacs? I know in the 2018 version it was “24”, but I do not see anything related to density in the 2019.3 version selection prompt.

---

<div class="post-metadata">

**Author:** ![jalemkul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/jalemkul/32/18_2.png) [@jalemkul](https://gromacs.bioexcel.eu/u/jalemkul)\
**Post date:** [October 22, 2020, 12:23pm UTC](https://gromacs.bioexcel.eu/t/how-to-calculate-density-using-gmx-energy/995/2 "2020-10-22T12:23:08Z")

</div>

If you’re simulating under an NVT ensemble, the density will not be saved in the `.edr` file because it is, by definition, a fixed quantity.

---

<div class="post-metadata">

**Author:** ![Dr\_DBW](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/dr_dbw/32/42_2.png) [@Dr\_DBW](https://gromacs.bioexcel.eu/u/Dr_DBW)\
**Post date:** [October 22, 2020, 9:31pm UTC](https://gromacs.bioexcel.eu/t/how-to-calculate-density-using-gmx-energy/995/3 "2020-10-22T21:31:22Z")

</div>

Also note that the selection number for a property can change based on the conditions of the simulation, e.g. em versus md, NPT versus NVT, since not all properties are appropriate for certain conditions. So if you are making a script to do analysis, to make it more general it is best to make the selection using the name/title rather than number.

---

<div class="post-metadata">

**Author:** ![jjeamin](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@jjeamin](https://gromacs.bioexcel.eu/u/jjeamin)\
**Post date:** [October 23, 2020, 12:16am UTC](https://gromacs.bioexcel.eu/t/how-to-calculate-density-using-gmx-energy/995/4 "2020-10-23T00:16:44Z")

</div>

Yes thank you @jalemkul and @Dr_DBW, I realized I was going off of the selection prompt for NVT instead of NPT.
