# Remove water from xtc file

**URL:** <https://gromacs.bioexcel.eu/t/remove-water-from-xtc-file/7312>\
**Category:** User discussions\
**Created:** [October 2, 2023, 10:36am UTC](https://gromacs.bioexcel.eu/t/remove-water-from-xtc-file/7312 "2023-10-02T10:36:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![amiel](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@amiel](https://gromacs.bioexcel.eu/u/amiel)\
**Post date:** [October 2, 2023, 10:36am UTC](https://gromacs.bioexcel.eu/t/remove-water-from-xtc-file/7312/1 "2023-10-02T10:36:23Z")

</div>

GROMACS version: 2020.7  
GROMACS modification: No

I want to use Prolint Webserver for peptide/membrane interaction and i need to remove water and ions from the XTC file (required by the webserver).  
Do i use gmx trjconv ? How exactly ?

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [October 2, 2023, 10:46am UTC](https://gromacs.bioexcel.eu/t/remove-water-from-xtc-file/7312/2 "2023-10-02T10:46:38Z")

</div>

You can use `gmx trjconv` with an index file (`-n`) containing the molecules you want to output in an index group.

---

<div class="post-metadata">

**Author:** ![amiel](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@amiel](https://gromacs.bioexcel.eu/u/amiel)\
**Post date:** [October 2, 2023, 1:55pm UTC](https://gromacs.bioexcel.eu/t/remove-water-from-xtc-file/7312/3 "2023-10-02T13:55:09Z")

</div>

oh, i see thank you\>  
i did gmx trjconv but i strugled to select all at once  
Select group for output  
Group 0 ( Protein) has 118 elements  
Group 1 ( POPC) has 4308 elements  
Group 2 ( POPS) has 1068 elements  
you got an idea ?

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [October 3, 2023, 7:43am UTC](https://gromacs.bioexcel.eu/t/remove-water-from-xtc-file/7312/4 "2023-10-03T07:43:34Z")

</div>

Generate a new index file with an index group containing the atoms you want to keep in your file. `gmx make_ndx` will help you.

---

<div class="post-metadata">

**Author:** ![amiel](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@amiel](https://gromacs.bioexcel.eu/u/amiel)\
**Post date:** [October 3, 2023, 8:10am UTC](https://gromacs.bioexcel.eu/t/remove-water-from-xtc-file/7312/5 "2023-10-03T08:10:28Z")

</div>

that is what i did but when i do  
gmx trjconv -f file.xtc -n index.ndx  
i have  
Select group for output  
Group 0 ( Protein) has 118 elements  
Group 1 ( POPC) has 4308 elements  
Group 2 ( POPS) has 1068 elements  
and i cant select all of them at once apparently

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [October 3, 2023, 9:53am UTC](https://gromacs.bioexcel.eu/t/remove-water-from-xtc-file/7312/6 "2023-10-03T09:53:04Z")

</div>

That means that you do not have an index group with all the atoms you want to keep. Use `gmx make_ndx` to create a new one, i.e. a new group that contains Protein + POPC + POPS.

If you find it difficult to do that using `make_ndx` then you can do it manually by editing your index file. The format is simple:

```auto
[Protein-POPC-POPS]
<enter the numbers of all relevant atoms here, e.g. by copying and pasting>

```

---

<div class="post-metadata">

**Author:** ![amiel](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@amiel](https://gromacs.bioexcel.eu/u/amiel)\
**Post date:** [October 3, 2023, 10:03am UTC](https://gromacs.bioexcel.eu/t/remove-water-from-xtc-file/7312/7 "2023-10-03T10:03:32Z")

</div>

Thank you very much  
Have a nice day
