# Create a cavity

**URL:** <https://gromacs.bioexcel.eu/t/create-a-cavity/3512>\
**Category:** User discussions\
**Created:** [January 21, 2022, 4:33am UTC](https://gromacs.bioexcel.eu/t/create-a-cavity/3512 "2022-01-21T04:33:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hasanmme](https://avatars.discourse-cdn.com/v4/letter/h/e480ec/32.png) [@hasanmme](https://gromacs.bioexcel.eu/u/hasanmme)\
**Post date:** [January 21, 2022, 4:33am UTC](https://gromacs.bioexcel.eu/t/create-a-cavity/3512/1 "2022-01-21T04:33:43Z")

</div>

GROMACS version: 2020.6 released March 4th, 2021  
GROMACS modification: No

Dear Gromacs Users,  
I am a new user of Gromacs. I have system with around 100k atom which includes martini CG 20 protein chains, nonpolar Martini water and charged particles. The cubic box size is 400 x 400 x 400 Angstrom. I want to delete specific atoms from a sphere inside the box. Suppose the center of the box is 0,0,0. I want to delete only Martini water withing 5nm radius around that center (0,0,0). Is there any MDP options to do that?

---

<div class="post-metadata">

**Author:** ![jalemkul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/jalemkul/32/18_2.png) [@jalemkul](https://gromacs.bioexcel.eu/u/jalemkul)\
**Post date:** [January 21, 2022, 11:22am UTC](https://gromacs.bioexcel.eu/t/create-a-cavity/3512/2 "2022-01-21T11:22:47Z")

</div>

This is not a process performed by `mdrun`, so it is not handled within `.mdp` settings. You can specify geometric criteria for selections with `gmx select`, to encompass the region of space you wish to eliminate. You would create an index group with `gmx select` for everything within that region and then take the complement of that to get the atoms you want to keep. Then pass that index group to `gmx trjconv` to save the subset of the system you want to retain.

---

<div class="post-metadata">

**Author:** ![hasanmme](https://avatars.discourse-cdn.com/v4/letter/h/e480ec/32.png) [@hasanmme](https://gromacs.bioexcel.eu/u/hasanmme)\
**Post date:** [January 30, 2022, 9:27pm UTC](https://gromacs.bioexcel.eu/t/create-a-cavity/3512/3 "2022-01-30T21:27:24Z")

</div>

@jalemkul, Thank you so much. How can I take a complement to my selection and make an index out of it? I have got the index of selected atoms from the following command:  
gmx select -f step3\_charmm2gmx.gro -s step3\_charmm2gmx.gro -n index.ndx -on out.ndx -ofpdb out.pdb -select ‘group 13 and within 5 of [0,0,0]’

The Out index file contains the index of selected atoms.

Thank you!

---

<div class="post-metadata">

**Author:** ![hasanmme](https://avatars.discourse-cdn.com/v4/letter/h/e480ec/32.png) [@hasanmme](https://gromacs.bioexcel.eu/u/hasanmme)\
**Post date:** [January 30, 2022, 11:01pm UTC](https://gromacs.bioexcel.eu/t/create-a-cavity/3512/4 "2022-01-30T23:01:26Z")

</div>

Hi @jalemkul I have already solved the problem. Thank you so much for your help.
