# Modifying topology file

**URL:** <https://gromacs.bioexcel.eu/t/modifying-topology-file/686>\
**Category:** User discussions\
**Created:** [August 19, 2020, 2:50pm UTC](https://gromacs.bioexcel.eu/t/modifying-topology-file/686 "2020-08-19T14:50:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![L\_k](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@L\_k](https://gromacs.bioexcel.eu/u/L_k)\
**Post date:** [August 19, 2020, 2:50pm UTC](https://gromacs.bioexcel.eu/t/modifying-topology-file/686/1 "2020-08-19T14:50:24Z")

</div>

Hello All,

This may be a very simple task, but how can I manually add ions to my topology file and then create the proper gro file with water and ions? I seem to be running into an error in properly adding the ions. Thank you in advance.

---

<div class="post-metadata">

**Author:** ![Dr\_DBW](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/dr_dbw/32/42_2.png) [@Dr\_DBW](https://gromacs.bioexcel.eu/u/Dr_DBW)\
**Post date:** [August 19, 2020, 10:35pm UTC](https://gromacs.bioexcel.eu/t/modifying-topology-file/686/2 "2020-08-19T22:35:21Z")

</div>

May be better off solving the error you are getting, since it could be something that will persist. What command did you use? What was the output? Best to copy and paste exactly, rather than filter through you.

Personally I have separate coordinate files each for a single chloride and sodium ion, and insert them using `gmx insert-molecules` then edit the `topol.top` using a text editor. Depending on the number, that can be either before or after the system is solvated.

---

<div class="post-metadata">

**Author:** ![L\_k](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@L\_k](https://gromacs.bioexcel.eu/u/L_k)\
**Post date:** [August 19, 2020, 11:34pm UTC](https://gromacs.bioexcel.eu/t/modifying-topology-file/686/3 "2020-08-19T23:34:20Z")

</div>

Thank you for your reply. To add salt I use the following commands after solvating the system:

1. gmx grompp -f ions.mdp -c solv.gro -p topol.top -o ions.tpr

2. gmx genion -s ions.tpr -o solv\_ions.gro -p topol.top -pname NA -nname CL -neutral -conc 

With this, gmx genion begins to add ions but is eventually interrupted by the fatal error: ‘No more replaceable solvent!’. Also to note - I am trying to add concentrations of 2M and higher, this approach has worked below 2M. Thank you again.

---

<div class="post-metadata">

**Author:** ![Dr\_DBW](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/dr_dbw/32/42_2.png) [@Dr\_DBW](https://gromacs.bioexcel.eu/u/Dr_DBW)\
**Post date:** [August 20, 2020, 12:57am UTC](https://gromacs.bioexcel.eu/t/modifying-topology-file/686/4 "2020-08-20T00:57:11Z")

</div>

How many waters are in the system? Are they continuous in the coordinate file? How many ions are needed to be added to reach the 2M concentration?

One of the developers or those with better knowledge of how the back end of the `genion` code works will probably need to provide a comment on what is happening here.

For reference, here is where you mentioned this problem previously - [Ion Concentration Force Fields](https://gromacs.bioexcel.eu/t/ion-concentration-force-fields/611/23)

---

<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:** [August 20, 2020, 1:17am UTC](https://gromacs.bioexcel.eu/t/modifying-topology-file/686/5 "2020-08-20T01:17:29Z")

</div>

`genion` can’t find any place to put an ion that doesn’t clash with the other ions, as determined by a radius set via `-rmin`. You can try decreasing that value slightly to see if it allows you to add enough ions. Otherwise, use `gmx insert-molecules` as @Dr_DBW is suggesting rather than using `genion`. I suspect you’ll have to delete so much solvent that you’re just going to end up with floating crystals of salt with as many waters as will be removed.

---

<div class="post-metadata">

**Author:** ![L\_k](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@L\_k](https://gromacs.bioexcel.eu/u/L_k)\
**Post date:** [August 20, 2020, 5:33pm UTC](https://gromacs.bioexcel.eu/t/modifying-topology-file/686/6 "2020-08-20T17:33:03Z")

</div>

@jalemkul @Dr_DBW Thank you for your suggestions, I appreciate it. Reducing -rmin does resolve this and I can reach the desired concentration, but I am curious as to implications that this may have later on in the simulation.

---

<div class="post-metadata">

**Author:** ![Dr\_DBW](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/dr_dbw/32/42_2.png) [@Dr\_DBW](https://gromacs.bioexcel.eu/u/Dr_DBW)\
**Post date:** [August 20, 2020, 9:35pm UTC](https://gromacs.bioexcel.eu/t/modifying-topology-file/686/7 "2020-08-20T21:35:46Z")

</div>

> [@Dr\_DBW](#):
>
> How many waters are in the system? Are they continuous in the coordinate file? How many ions are needed to be added to reach the 2M concentration?

Answer to those questions will help inform the answer to your question.

---

<div class="post-metadata">

**Author:** ![L\_k](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@L\_k](https://gromacs.bioexcel.eu/u/L_k)\
**Post date:** [September 1, 2020, 1:13am UTC](https://gromacs.bioexcel.eu/t/modifying-topology-file/686/8 "2020-09-01T01:13:23Z")

</div>

@Dr_DBW After going through, it seems that at these high concentrations there is not enough water to be replaced to meet these conditions as was stated earlier. Thank you for your time, I appreciate it.
