# Clarification of "gmx density" output

**URL:** <https://gromacs.bioexcel.eu/t/clarification-of-gmx-density-output/243>\
**Category:** User discussions\
**Created:** [June 4, 2020, 4:44pm UTC](https://gromacs.bioexcel.eu/t/clarification-of-gmx-density-output/243 "2020-06-04T16:44:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amai](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/amai/32/107_2.png) [@amai](https://gromacs.bioexcel.eu/u/amai)\
**Post date:** [June 4, 2020, 4:44pm UTC](https://gromacs.bioexcel.eu/t/clarification-of-gmx-density-output/243/1 "2020-06-04T16:44:33Z")

</div>

Hi all,

I have a question about the output of the “gmx density”.  
If we include the options “-d X/Y/Z”, the output is the distribution of the density along that axis, respectively. It means the horizontal axis, named “coordinate” in the .xvg file, is the axis X/Y or Z.

If we don’t include, the coordinate is automatically the radius, isn’t it?

And, for our project, we need to determine the density distribution of our protein, along its symmetrical axis. Is there anyway to do it?

Thanks a lot, in advance!  
I’d greatly appreciate your guidance.

Anh T. Mai

---

<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:** [June 5, 2020, 12:17pm UTC](https://gromacs.bioexcel.eu/t/clarification-of-gmx-density-output/243/2 "2020-06-05T12:17:14Z")

</div>

`gmx density` does not take a radial density, it simply computes the density as a function of slices along the specified axis.

---

<div class="post-metadata">

**Author:** ![amai](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/amai/32/107_2.png) [@amai](https://gromacs.bioexcel.eu/u/amai)\
**Post date:** [June 8, 2020, 3:37am UTC](https://gromacs.bioexcel.eu/t/clarification-of-gmx-density-output/243/3 "2020-06-08T03:37:54Z")

</div>

Hi Dr. Lemkul,  
Thanks for your reply.

So, is the Z-axis automatically in use when the option is not specified, i.e. when the “-d X/Y/Z” is not included in the command?  
And, are the slices along the X and the Y axes are automatically picked to be the same values?

I made that guess based on our output, but not 100% sure.  
For example, we run these four commands on the same target trajectory, to compute the density of Water group (TIP3P216 model), based on the center of the Protein Group.  
(1) gmx density -f full.xtc -n index.ndx -s full.tpr -o density\_water\_?.xvg -center  
(2) gmx density -f full.xtc -n index.ndx -s full.tpr -o density\_water\_X.xvg -center -d X  
(3) gmx density -f full.xtc -n index.ndx -s full.tpr -o density\_water\_Y.xvg -center -d Y  
(4) gmx density -f full.xtc -n index.ndx -s full.tpr -o density\_water\_Z.xvg -center -d Z

And here are the output respectively,  
(First column is “Position in nm”, and the second is “Density in kgm^(-3)”.)  
(1) **Not** including -d  
“…  
-0.718345 903.513  
-0.513104 896.691  
-0.307862 894.742  
-0.102621 895.902  
0.102621 899.714  
0.307862 906.809  
0.513104 916.62  
0.718345 926.764  
…”

(2) -d X  
“…  
-0.725637 1000.32  
-0.435382 994.195  
-0.145127 985.958  
0.145127 975.246  
0.435382 964.859  
0.725637 956.03  
…”

(3) -d Y  
“…  
-0.725637 998.933  
-0.435382 996.412  
-0.145127 993.013  
0.145127 988.584  
0.435382 982.933  
0.725637 976.22  
…”

(4) -d Z  
“…  
-0.718345 903.513  
-0.513104 896.691  
-0.307862 894.742  
-0.102621 895.902  
0.102621 899.714  
0.307862 906.809  
0.513104 916.62  
0.718345 926.764  
…”

Thanks,  
Anh

---

<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:** [June 8, 2020, 2:32pm UTC](https://gromacs.bioexcel.eu/t/clarification-of-gmx-density-output/243/4 "2020-06-08T14:32:41Z")

</div>

> [@amai](#):
>
> So, is the Z-axis automatically in use when the option is not specified, i.e. when the “-d X/Y/Z” is not included in the command?

Yes, that is the default behavior, per the help information:

> [@](#):
>
> -d (Z)  
> Take the normal on the membrane in direction X, Y or Z.

So you get exactly the same outcome with `-d Z` or without it. The other calculations apply to different axes as requested.

---

<div class="post-metadata">

**Author:** ![amai](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/amai/32/107_2.png) [@amai](https://gromacs.bioexcel.eu/u/amai)\
**Post date:** [June 8, 2020, 4:08pm UTC](https://gromacs.bioexcel.eu/t/clarification-of-gmx-density-output/243/5 "2020-06-08T16:08:44Z")

</div>

Yes. Thank you, Dr. Lemkul.
