# Strip solvent from trajectory - Cannot do both runtime modification and charge-zeroing/index

**URL:** <https://gromacs.bioexcel.eu/t/strip-solvent-from-trajectory-cannot-do-both-runtime-modification-and-charge-zeroing-index/4523>\
**Category:** User discussions\
**Tags:** mdrun, gmx-trjconv\
**Created:** [July 28, 2022, 9:15am UTC](https://gromacs.bioexcel.eu/t/strip-solvent-from-trajectory-cannot-do-both-runtime-modification-and-charge-zeroing-index/4523 "2022-07-28T09:15:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielhall](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@danielhall](https://gromacs.bioexcel.eu/u/danielhall)\
**Post date:** [July 28, 2022, 9:15am UTC](https://gromacs.bioexcel.eu/t/strip-solvent-from-trajectory-cannot-do-both-runtime-modification-and-charge-zeroing-index/4523/1 "2022-07-28T09:15:48Z")

</div>

GROMACS version: 2021.3  
GROMACS modification: No  
Hello all!

I am trying to strip solvent from the MD trajectory. The command

gmx trjconv -s npt\_prod.tpr -f npt\_prod.xtc -n index.ndx -pbc nojump -o npt\_prod\_nowat\_nojump.xtc

works as expected, selecting the option for the zinc ion and the protein, but

gmx convert-tpr -s npt\_prod.tpr -n index.ndx -nsteps -1 -o npt\_prod\_nowat\_nojump.tpr

does not work, giving the error “Cannot do both runtime modification and charge-zeroing/index group extraction in a single call.”

I do not understand this error, could anyone provide some help as to how to address this. Or is there a better way of stripping water molecules from the MD trajectory?

Regards  
Dan

---

<div class="post-metadata">

**Author:** ![ebriand](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/ebriand/32/2314_2.png) [@ebriand](https://gromacs.bioexcel.eu/u/ebriand)\
**Post date:** [July 28, 2022, 1:50pm UTC](https://gromacs.bioexcel.eu/t/strip-solvent-from-trajectory-cannot-do-both-runtime-modification-and-charge-zeroing-index/4523/2 "2022-07-28T13:50:38Z")

</div>

If you need a .tpr without water to use for further `trjconv` call, call `convert-tpr` without the nstep argument (`gmx convert-tpr -s npt_prod.tpr -n index.ndx -o npt_prod_nowat_nojump.tpr`), despite what the documentation says.

---

<div class="post-metadata">

**Author:** ![danielhall](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@danielhall](https://gromacs.bioexcel.eu/u/danielhall)\
**Post date:** [July 29, 2022, 6:56pm UTC](https://gromacs.bioexcel.eu/t/strip-solvent-from-trajectory-cannot-do-both-runtime-modification-and-charge-zeroing-index/4523/3 "2022-07-29T18:56:04Z")

</div>

Hello @ebriand

Thank you for your response. I will try this.

Is there another way to generate a tpr file without solvent present?

Regards,  
Dan.

---

<div class="post-metadata">

**Author:** ![ebriand](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/ebriand/32/2314_2.png) [@ebriand](https://gromacs.bioexcel.eu/u/ebriand)\
**Post date:** [August 1, 2022, 7:32am UTC](https://gromacs.bioexcel.eu/t/strip-solvent-from-trajectory-cannot-do-both-runtime-modification-and-charge-zeroing-index/4523/4 "2022-08-01T07:32:03Z")

</div>

Most generally, to remove anything you can edit the structure and topology file.

Eg, you could make a copy of your .gro and .top file, modify the .gro to remove all solvents (delete all line with “SOL” and update the atom count at the top of the file - 3\*number of solvent) and modify the .top `[molecule]` section to remove the SOL line.

---

<div class="post-metadata">

**Author:** ![danielhall](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@danielhall](https://gromacs.bioexcel.eu/u/danielhall)\
**Post date:** [September 11, 2022, 8:09pm UTC](https://gromacs.bioexcel.eu/t/strip-solvent-from-trajectory-cannot-do-both-runtime-modification-and-charge-zeroing-index/4523/5 "2022-09-11T20:09:04Z")

</div>

@ebriand Hello, sorry for the very delayed response. So far I have removed all ions (except the Zn2+) ion from the production .gro file. Amended the count at the top of the file. But how do I generate a new .tpr file? I have tried using grompp but my .mdp file contains two groups Protein\_Zn and Water\_and\_ions, obviously, I want to remove the water and some ions, so I am not sure how to amend further.

Also when I come to view the system in Chimera using gmx convert-tpr without -nsteps I also get an error, so maybe this part is important?

---

<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:** [September 12, 2022, 2:31am UTC](https://gromacs.bioexcel.eu/t/strip-solvent-from-trajectory-cannot-do-both-runtime-modification-and-charge-zeroing-index/4523/6 "2022-09-12T02:31:41Z")

</div>

> [@danielhall](#):
>
> But how do I generate a new .tpr file?

Use `convert-tpr` with the same index group that you saved from the trajectory and write a new one.

```auto
gmx convert-tpr -s full.tpr -o subset.tpr -n index.ndx

```

---

<div class="post-metadata">

**Author:** ![danielhall](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@danielhall](https://gromacs.bioexcel.eu/u/danielhall)\
**Post date:** [September 12, 2022, 9:04am UTC](https://gromacs.bioexcel.eu/t/strip-solvent-from-trajectory-cannot-do-both-runtime-modification-and-charge-zeroing-index/4523/7 "2022-09-12T09:04:50Z")

</div>

@jalemkul Excellent, thank you! Not sure why I didn’t opt to use that method.
