# RDF and PBC corrections

**URL:** <https://gromacs.bioexcel.eu/t/rdf-and-pbc-corrections/4892>\
**Category:** User discussions\
**Tags:** analysis-tools, gmx-trjconv\
**Created:** [September 27, 2022, 9:45pm UTC](https://gromacs.bioexcel.eu/t/rdf-and-pbc-corrections/4892 "2022-09-27T21:45:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sallaprat](https://avatars.discourse-cdn.com/v4/letter/s/f08c70/32.png) [@sallaprat](https://gromacs.bioexcel.eu/u/sallaprat)\
**Post date:** [September 27, 2022, 9:45pm UTC](https://gromacs.bioexcel.eu/t/rdf-and-pbc-corrections/4892/1 "2022-09-27T21:45:36Z")

</div>

GROMACS version: 2018  
GROMACS modification: No

Dear all,

I want to calculate the RDF of water molecules close to my ligand. I have recentered my protein ligand system using the following commands:

gmx trjconv -s sys.md1.tpr -f sys.md1.xtc -o sys.md1.whole.xtc -pbc whole

gmx trjconv -s sys.md1.tpr -f sys.md1.whole.xtc -o sys.md1.whole.nojump.xtc -pbc nojump

gmx trjconv -s sys.md1.tpr -f sys.md1.whole.nojump.xtc -o sys.md1.whole.nojump.mol.xtc -pbc mol

After these steps, my protein-ligand system is whole and centered but the waters have drifted away from the box and are all over the place. I was wondering if there is a better way to fix the PBC in order to obtain sensible RDF results.

Thank you very much in advance,

Sara Llopart

---

<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:** [September 28, 2022, 10:25am UTC](https://gromacs.bioexcel.eu/t/rdf-and-pbc-corrections/4892/2 "2022-09-28T10:25:38Z")

</div>

Hi,  
maybe this workflow may help  
[https://manual.gromacs.org/current/user-guide/terminology.html?highlight=workflow](https://manual.gromacs.org/current/user-guide/terminology.html?highlight=workflow)  
\Alessandra

---

<div class="post-metadata">

**Author:** ![sallaprat](https://avatars.discourse-cdn.com/v4/letter/s/f08c70/32.png) [@sallaprat](https://gromacs.bioexcel.eu/u/sallaprat)\
**Post date:** [September 28, 2022, 9:51pm UTC](https://gromacs.bioexcel.eu/t/rdf-and-pbc-corrections/4892/3 "2022-09-28T21:51:45Z")

</div>

Thank you Alessandra,

I managed to fix the PBC using the following commands:

```auto
echo 0 | gmx trjconv -s sys.md1.tpr -f sys.md1.xtc -o sys.md1.whole.xtc -pbc whole

echo 0 | gmx trjconv -s sys.md1.tpr -f sys.md1.whole.xtc -o sys.md1.whole.nojump.xtc -pbc nojump

echo 1 0 | gmx trjconv -s sys.md1.tpr -f sys.md1.whole.nojump.xtc -o sys.md1.whole.nojump.tric.xtc -pbc mol -ur tric -c

```

Sara

---

<div class="post-metadata">

**Author:** ![sallaprat](https://avatars.discourse-cdn.com/v4/letter/s/f08c70/32.png) [@sallaprat](https://gromacs.bioexcel.eu/u/sallaprat)\
**Post date:** [October 1, 2022, 4:28pm UTC](https://gromacs.bioexcel.eu/t/rdf-and-pbc-corrections/4892/4 "2022-10-01T16:28:16Z")

</div>

This is the correct fix:

```auto
echo 0 | gmx trjconv -s sys.md1.tpr -f .sys.md1.xtc -o sys.md1.whole.xtc -pbc whole -skip 100

echo 0 | gmx trjconv -s sys.md1.tpr -f sys.md1.whole.xtc -o sys.md1.whole.nojump.xtc -pbc nojump -ur tric

echo 1 0 | gmx trjconv -s sys.md1.tpr -f sys.md1.whole.nojump.xtc -o sys.md1.whole.nojump.tric.xtc -pbc atom -ur tric -center 

echo 0 | gmx trjconv -s sys.md1.tpr -f sys.md1.whole.nojump.tric.xtc -o sys.md1.fixed.xtc -pbc whole -ur tric

```

Sara
