Reduce Box Size keeping density

GROMACS version: 2020.3
GROMACS modification: No
I have a homogeneous system of small molecules with Brownian movement in a box size of 5000 x 5000 x 5000 nm. After the simulation, I would like to have the trajectories for molecules that go though a smaller volume (500 x 500 x 1500) inside the box.
How can I print a *.trr file only for the molecules that are inside the smaller volume for each frame? The density of the system should no change. And since the molecules are moving, on each frame I can have different molecules inside de fixed smaller box and I am no sure how to set this.
I tried gmx trjconv with -box but it reduces the whole box and keeps the number of molecules inside it increasing the density.

Any suggestion is greatly appreciated!
Thanks in advance.

You need a kind of dynamic selection so that only the index number of atoms or molecules that are inside the area of your interest would be selected in each frame.

Please have a look at gmx select with taking into account a selection such as “group “xxx” and within 500 of [x1, y1, z1]” to get the index file of the molecules which are within the spherical region (for rectangle you need to change the selection definition). Then use the index file into gmx trjconv to get the gro/trr file.
One tedious way to make it dynamic is to repeat the above, for each step and then merge (gmx trjcat) all the gro/trr files to have the trajectory of your desire. Of course you can automate everything in a script.

Salman Zarrini

1 Like