# Post analysis of RDF/CN for specific z range

**URL:** <https://gromacs.bioexcel.eu/t/post-analysis-of-rdf-cn-for-specific-z-range/10391>\
**Category:** User discussions\
**Tags:** analysis-tools\
**Created:** [October 22, 2024, 7:07am UTC](https://gromacs.bioexcel.eu/t/post-analysis-of-rdf-cn-for-specific-z-range/10391 "2024-10-22T07:07:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Athis](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@Athis](https://gromacs.bioexcel.eu/u/Athis)\
**Post date:** [October 22, 2024, 7:07am UTC](https://gromacs.bioexcel.eu/t/post-analysis-of-rdf-cn-for-specific-z-range/10391/1 "2024-10-22T07:07:08Z")

</div>

GROMACS version: 2023.2  
GROMACS modification: Yes/No  
Here post your question

Hello everyone,

I am a new GROMACS user. I have the system with a surface at the bottom of the box, and add water (Ow and Hw), and Zn atoms above the surface (total z length = 10 nm). Here, I would like to calculate the RDF/CN between Zn and Ow in the z \< 4.5 nm range region. I have tried to use gmx select to generate new ndx:

gmx select -f XXX.xtc -s XXX.tpr -select ‘name ZN OW and z\<4.5’ -on ZN\_OW\_Lower45A.ndx

Then,  
gmx rdf -f XXX.xtc -s XXX.tpr -o RDF.xvg -cn CN.xvg -n ZN\_OW\_Lower45A -b 4000 -e 8000

The program shows:

Available static index groups:  
Group 0 “name\_ZN\_OW\_and\_z\<4.5\_f0\_t0.000” (2431 atoms)  
Group 1 “name\_ZN\_OW\_and\_z\<4.5\_f1\_t1.000” (2432 atoms)  
Group 2 “name\_ZN\_OW\_and\_z\<4.5\_f2\_t2.000” (2476 atoms)  
.  
.  
.  
Group 3613 “name\_ZN\_OW\_and\_z\<4.5\_f3613\_t3613.000” (2505 atoms)  
Group 3614 “name\_ZN\_OW\_and\_z\<4.5\_f3614\_t3614.000” (2493 atoms)  
Group 3615 “name\_ZN\_OW\_and\_z\<4.5\_f3615\_t3615.000” (2269 atoms)  
Specify a selection for option ‘ref’

Could you suggest how to use gmx select, or is there a way to do this?

Thank you,  
Athis

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [October 22, 2024, 8:08am UTC](https://gromacs.bioexcel.eu/t/post-analysis-of-rdf-cn-for-specific-z-range/10391/2 "2024-10-22T08:08:01Z")

</div>

If I understand you correctly, I don’t think you need `gmx select` for this. I think you can just do `gmx rdf -f XXX.xtc -s XXX.tpr -o RDF.xvg -cn CN.xvg -n index -b 4000 -e 8000 -rmax 4.5` (with index being the name of a suitable index file, if you need any at all).

---

<div class="post-metadata">

**Author:** ![Athis](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@Athis](https://gromacs.bioexcel.eu/u/Athis)\
**Post date:** [October 22, 2024, 8:45am UTC](https://gromacs.bioexcel.eu/t/post-analysis-of-rdf-cn-for-specific-z-range/10391/3 "2024-10-22T08:45:03Z")

</div>

Thank you for your response. From my understanding, -rmax implies the maximum distance to calculate g(r) (please correct me if I’m wrong).

My purpose is that I would like to calculate RDF in a specific z region (please see the figure below).

 ![Screenshot 2024-10-22 153539](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/4/4b4d4f71a736b597512a3d457bc6e6a465998be8.jpeg)

I think it is similar to options for gmx densmap: -xmin and -xmax.

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [October 22, 2024, 8:59am UTC](https://gromacs.bioexcel.eu/t/post-analysis-of-rdf-cn-for-specific-z-range/10391/4 "2024-10-22T08:59:07Z")

</div>

I see. Then I’m afraid I don’t have any good advice right now.
