# RDF between atoms in lipids, but without atoms from the same lipid molecule

**URL:** <https://gromacs.bioexcel.eu/t/rdf-between-atoms-in-lipids-but-without-atoms-from-the-same-lipid-molecule/1496>\
**Category:** User discussions\
**Created:** [January 27, 2021, 5:35pm UTC](https://gromacs.bioexcel.eu/t/rdf-between-atoms-in-lipids-but-without-atoms-from-the-same-lipid-molecule/1496 "2021-01-27T17:35:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JakubH](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@JakubH](https://gromacs.bioexcel.eu/u/JakubH)\
**Post date:** [January 27, 2021, 5:35pm UTC](https://gromacs.bioexcel.eu/t/rdf-between-atoms-in-lipids-but-without-atoms-from-the-same-lipid-molecule/1496/1 "2021-01-27T17:35:20Z")

</div>

GROMACS version: 2018.4  
GROMACS modification: No  
I have a question. I want to calculate RDF oxygen atoms in carbonyl groups with the respect to oxygen in digalactose residues. I have a membrane which consists of 200 DGDG molecules. The problem with RDF is that in gromacs it calculates also between atoms in the same molecule, I don’t want that. I want to calculate RDF for atoms from different molecules, no for example between 2 oxygens in the same molecule

I created two index groups 1) for oxygen in carbonyl groups, 2) for oxygen in digalactose residues and I used gmx rdf  
`gmx rdf -f eq3.xtc -n rdf.ndx -b 900000 -e 1000000 -rmax 1 -o rdf_O22_O32_GalI_II_DGDG.xvg`

what I should change?

---

<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:** [January 29, 2021, 10:51am UTC](https://gromacs.bioexcel.eu/t/rdf-between-atoms-in-lipids-but-without-atoms-from-the-same-lipid-molecule/1496/2 "2021-01-29T10:51:29Z")

</div>

Hi,  
`gmx rdf` calculates radial distribution functions from one reference set of position (set with `-ref` ) to one or more sets of positions (set with `-sel` ). Then when the two groups are defined without overlapping (common) elements, the tool is doing what you want.  
Or I misunderstood your question?  
Best regards  
Alessandra

---

<div class="post-metadata">

**Author:** ![xieliqiang](https://avatars.discourse-cdn.com/v4/letter/x/ea666f/32.png) [@xieliqiang](https://gromacs.bioexcel.eu/u/xieliqiang)\
**Post date:** [February 1, 2024, 5:09am UTC](https://gromacs.bioexcel.eu/t/rdf-between-atoms-in-lipids-but-without-atoms-from-the-same-lipid-molecule/1496/3 "2024-02-01T05:09:16Z")

</div>

Dear sir, i met a problem like the following.  
GROMACS version:2023.1  
GROMACS modification: No  
Here post your question  
hi,everyone,  
i have a micelle composed of 40 molecules A, and i have a drug molecule B. i wang to caculate the rdf function between the center of mass (com) of the micelle and drug B, but i can not get a proper result.( the drug was on the surface of the miclle ,but the rdf was not right.

my rdf is caculated by :  
gmx rdf -f trajout.xtc -s md.tpr -ref “com of group A” -sel “com of group B” -pbc -bin 0.1

thank you in advace.
