# Gmx select to get index of upper and lower leaflet residues in bilayer

**URL:** <https://gromacs.bioexcel.eu/t/gmx-select-to-get-index-of-upper-and-lower-leaflet-residues-in-bilayer/3284>\
**Category:** User discussions\
**Tags:** analysis-tools\
**Created:** [December 10, 2021, 6:07pm UTC](https://gromacs.bioexcel.eu/t/gmx-select-to-get-index-of-upper-and-lower-leaflet-residues-in-bilayer/3284 "2021-12-10T18:07:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yogeshb](https://avatars.discourse-cdn.com/v4/letter/y/bc79bd/32.png) [@Yogeshb](https://gromacs.bioexcel.eu/u/Yogeshb)\
**Post date:** [December 10, 2021, 6:07pm UTC](https://gromacs.bioexcel.eu/t/gmx-select-to-get-index-of-upper-and-lower-leaflet-residues-in-bilayer/3284/1 "2021-12-10T18:07:58Z")

</div>

GROMACS version: 2021.4  
GROMACS modification: No  
Command for getting index of residues in upper and lower leaflet of bilayer.  
Assuming there is no before hand information about residues (resid) packed in upper and lower leaflets in initial configuration. I want to get the residue indexes using z-coordinate) criteria, (bilayer normal is in z direction). for example, if I have DPPC bilayer and I know there is P atom in DPPC headgroup. I want use following criteria in gmx select.

1. get indexes of all P atoms having z coordinate higher than z value of bilayer COM.
2. get indexes for all the DPPC molecules which has these P atoms (collected in step 1)
3. last step would be choosing all DPPCs not in index of step 2.

how can we accomplish this using gmx select command?

---

<div class="post-metadata">

**Author:** ![alevilla](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/alevilla/32/439_2.png) [@alevilla](https://gromacs.bioexcel.eu/u/alevilla)\
**Post date:** [December 14, 2021, 9:02am UTC](https://gromacs.bioexcel.eu/t/gmx-select-to-get-index-of-upper-and-lower-leaflet-residues-in-bilayer/3284/2 "2021-12-14T09:02:03Z")

</div>

Hi

I think it is possible to create a index group for upper and slower leaflet using z as reference. But maybe that some rethinking on the order of the definition is needed ( Here is selection syntax [https://manual.gromacs.org/current/onlinehelp/selections.html?highlight=selection](https://manual.gromacs.org/current/onlinehelp/selections.html?highlight=selection)).

Maybe this conversation is useful

> [@Gmx select](https://gromacs.bioexcel.eu/t/gmx-select/2739):
>
> GROMACS version: 2020.1 GROMACS modification: No I have a lamellar system consisting of four bilayers. After the equilibration run, the bilayers get diffused. So now I want to split each bilayer and do a separate analysis. For separating each bilayer I am using gmx select tool, but every time it is giving me a syntax error. Like I have tried - “group 0 30 \< z \< 40” and also “resname PPG within 40 of PPT” and then “group 0 z \> 30 & z \< 40”. But none of the selection criteria is working. All of …

\Alessandra
