# Adding ions

**URL:** <https://gromacs.bioexcel.eu/t/adding-ions/3772>\
**Category:** User discussions\
**Created:** [March 3, 2022, 2:20pm UTC](https://gromacs.bioexcel.eu/t/adding-ions/3772 "2022-03-03T14:20:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![reza786](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@reza786](https://gromacs.bioexcel.eu/u/reza786)\
**Post date:** [March 3, 2022, 2:20pm UTC](https://gromacs.bioexcel.eu/t/adding-ions/3772/1 "2022-03-03T14:20:40Z")

</div>

GROMACS version: 2021.4  
GROMACS modification: No  
Hi there, can we add two different types of ions in the box?  
I am trying to add NaCl and Mgcl2 simultaneously in one box.  
Can anyone help me?

---

<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:** [March 3, 2022, 2:33pm UTC](https://gromacs.bioexcel.eu/t/adding-ions/3772/2 "2022-03-03T14:33:36Z")

</div>

You can’t do it simultaneously. You have to do two separate steps of adding the ions.

---

<div class="post-metadata">

**Author:** ![reza786](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@reza786](https://gromacs.bioexcel.eu/u/reza786)\
**Post date:** [March 3, 2022, 2:42pm UTC](https://gromacs.bioexcel.eu/t/adding-ions/3772/3 "2022-03-03T14:42:24Z")

</div>

Could you help do this? I use this command but I do nat know how I can do it in two steps.  
Here is my commands after solvation:  
gmx grompp -f ions.mdp -c box\_sol.gro -p topol.top -o ION.tpr  
gmx genion -s ION.tpr -o box\_sol\_ion.gro -p topol.top -pname MG -nname CLA -neutral -conc 0.02

after adding MG ions I want to add Na ions.  
what is the next command?

---

<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:** [March 3, 2022, 3:30pm UTC](https://gromacs.bioexcel.eu/t/adding-ions/3772/4 "2022-03-03T15:30:30Z")

</div>

You need to generate a new `.tpr` file after adding the Mg2+ ions, then add Na+ in the exact same way. The commands are structurally identical, but you need to generate a new `.tpr` file after making any change to the system.

---

<div class="post-metadata">

**Author:** ![reza786](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@reza786](https://gromacs.bioexcel.eu/u/reza786)\
**Post date:** [March 3, 2022, 5:53pm UTC](https://gromacs.bioexcel.eu/t/adding-ions/3772/5 "2022-03-03T17:53:59Z")

</div>

Thanks, dear doctor. I did it successfully.  
You have been always helpful.
