# Unification of box shapes in molecular simulations

**URL:** <https://gromacs.bioexcel.eu/t/unification-of-box-shapes-in-molecular-simulations/5976>\
**Category:** User discussions\
**Tags:** pbc\
**Created:** [March 15, 2023, 8:56am UTC](https://gromacs.bioexcel.eu/t/unification-of-box-shapes-in-molecular-simulations/5976 "2023-03-15T08:56:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pbarletta](https://avatars.discourse-cdn.com/v4/letter/p/bc8723/32.png) [@pbarletta](https://gromacs.bioexcel.eu/u/pbarletta)\
**Post date:** [March 15, 2023, 8:56am UTC](https://gromacs.bioexcel.eu/t/unification-of-box-shapes-in-molecular-simulations/5976/1 "2023-03-15T08:56:35Z")

</div>

Hi!

I had a bit of a theoretical question. Since GROMACS uses a triclinic representation of all boxes, I was wondering if GROMACS uses the methodology from [Bekker’s “Unification of box shapes in molecular simulations”](https://pure.rug.nl/ws/portalfiles/portal/3218542/1997JComputChemBekker.pdf) when, for example, running `gmx trjconv ... -pbc mol -center -ur compact`

If so, is there any additional —perhaps more modern—, resource to understand this topic?

Maybe is too of a specific question, but I’d appreciate any pointers. Thanks!

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [March 16, 2023, 11:31am UTC](https://gromacs.bioexcel.eu/t/unification-of-box-shapes-in-molecular-simulations/5976/2 "2023-03-16T11:31:47Z")

</div>

We use some of the methodology of that paper. But we don’t use any linear algebra.

The main point to understand is that a periodicity of a system is completely defined by it periodic vectors, which are 3 in the case of a 3D system. How you handle PBC for different parts of the computation is a choice, but doesn’t affect the results. What you can choose is how you want to show a representation of the system.

trjconv -ur compact simply moves each atom along vectors c, b and a (in that order) until the distance to the chosen box center is smallest.

---

<div class="post-metadata">

**Author:** ![pbarletta](https://avatars.discourse-cdn.com/v4/letter/p/bc8723/32.png) [@pbarletta](https://gromacs.bioexcel.eu/u/pbarletta)\
**Post date:** [March 16, 2023, 11:55am UTC](https://gromacs.bioexcel.eu/t/unification-of-box-shapes-in-molecular-simulations/5976/3 "2023-03-16T11:55:53Z")

</div>

> [@hess](#):
>
> trjconv -ur compact simply moves each atom along vectors c, b and a (in that order) until the distance to the chosen box center is smallest.

aaahhh, and it moves it the same magnitude as the box size in the corresponding direction, right?

So, say, for a given vector from **a** , **b** and **c** and a given particle:  
1\_calculate the distance to the center  
2\_move the particle 1 unit of the box dimension along the current cordinate and re-calculate the distance to the center  
3\_move the particle -1 unit of the box dimension along the current cordinate and re-calculate the distance to the center  
Pick the minimum distance among the results of 1, 2 and 3.

And I guess that “particle” may be an atom, a residue or a molecule, to prevent the braking of molecules?

Thanks for taking the time!
