# Distance between two benzene centroids vs time plot?

**URL:** <https://gromacs.bioexcel.eu/t/distance-between-two-benzene-centroids-vs-time-plot/4215>\
**Category:** User discussions\
**Created:** [May 26, 2022, 12:43am UTC](https://gromacs.bioexcel.eu/t/distance-between-two-benzene-centroids-vs-time-plot/4215 "2022-05-26T00:43:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tijanar](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/tijanar/32/1498_2.png) [@Tijanar](https://gromacs.bioexcel.eu/u/Tijanar)\
**Post date:** [May 26, 2022, 12:43am UTC](https://gromacs.bioexcel.eu/t/distance-between-two-benzene-centroids-vs-time-plot/4215/1 "2022-05-26T00:43:01Z")

</div>

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

Hello Everyone,

I want to plot “the distance between a pair of benzene (only C-atoms) centroids vs time” for the MD run.  
I found that _gmx traj_ can be used to extract the centre of mass of these benzene rings using _index_. The system has a total of 12 pairs of such benzene rings. So, extracting 24 centroids separately and calculating distances between them followed by plotting them seems to be very tedious.

Is there any way to use _gmx_ to extract all centroids in one go (as gmx angle, pairdist, etc.)? Or is there any other script to extract such kind of data?

Thank you for your time.

Regards  
Ranajit

---

<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:** [June 2, 2022, 8:01am UTC](https://gromacs.bioexcel.eu/t/distance-between-two-benzene-centroids-vs-time-plot/4215/2 "2022-06-02T08:01:34Z")

</div>

Hi,  
Maybe the options -refgrouping and -selgrouping in gmx pairdist ( [gmx pairdist — GROMACS 2022.1 documentation](https://manual.gromacs.org/current/onlinehelp/gmx-pairdist.html)) can help you, or similar options in gmx distance (it depends which type of distance you are interested in).  
You can also have a look at the tag gmx-distance for similar posts and solution  
\Alessandra

---

<div class="post-metadata">

**Author:** ![Tijanar](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/tijanar/32/1498_2.png) [@Tijanar](https://gromacs.bioexcel.eu/u/Tijanar)\
**Post date:** [June 11, 2022, 2:37pm UTC](https://gromacs.bioexcel.eu/t/distance-between-two-benzene-centroids-vs-time-plot/4215/3 "2022-06-11T14:37:58Z")

</div>

Hi @alevilla,  
Thank you for your comment.  
I will try this way. If I face any error I will get back here again.  
Regards  
Ranajit
