# Selection in control volume

**URL:** <https://gromacs.bioexcel.eu/t/selection-in-control-volume/2781>\
**Category:** User discussions\
**Tags:** gmx-trjconv\
**Created:** [September 8, 2021, 12:40pm UTC](https://gromacs.bioexcel.eu/t/selection-in-control-volume/2781 "2021-09-08T12:40:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MichelePellegrino](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/michelepellegrino/32/628_2.png) [@MichelePellegrino](https://gromacs.bioexcel.eu/u/MichelePellegrino)\
**Post date:** [September 8, 2021, 12:40pm UTC](https://gromacs.bioexcel.eu/t/selection-in-control-volume/2781/1 "2021-09-08T12:40:54Z")

</div>

GROMACS version: 2021  
GROMACS modification: Yes/No

Hi,

I am trying to perform a selection based on a control volume, i.e. I provide the whole trajectory to `gmx select` and get in the index file a group for each frame, corresponding to the molecules in the control volume at that frame.

Now, I would like to output a trajectory with the molecules occupying the control volume at each frame; it is possible to do it automatically with `gmx trjconv`? I believe one way to go could be:

```auto
for n from 1 to N_frames :
echo <n> | gmx trjconv -f ... -s ... -n control_volume.ndx -dump <n> -b <n-1> -o ...

```

and the concatenate the all output files, but that is quite slow (I got 4000 frames and the trajectory weight almost 100G); is there a way to made `trjconv` change selection group at each frame _automatically_?
