Placing ions in between the residue

GROMACS version:2020.1
GROMACS modification: Yes/No
i am working on RNA so i want to place Mg2+ ions in between the residues. how can i place ions at specific location.
with regards
shailesh mani tripathi


My suggestion is to take the ion position from the original experimental structure or from exp structure having the ion in similar position (and manually insert it).

In alternative you can provide defined positions to insert molecules to gmx insert-molecules with option -ip [(gmx insert-molecules — GROMACS 2021.1 documentation)

Best regards

good evening mam,
I tried to insert ions at the junction using gmx insert molecules but i failed. My question is Where to define the ion type (such as Magnesium) in gmx insert-molecules? What is the -ci flag, is it is initial pdb structure or something else?
gmx insert-molecules -f solvated_system.gro -ci 5fj9.pdb -ip positions.dat -nmol 6 -try 10000 -dr 0 0 0 -o ionsolv.gro
here -f solvated_sysrem.gro is the output file of gmx solvate
-ci 5fj9 is the initial pdb structure i am working on
-ip is a position.dat (i am attaching , please go through it and suggest it is correct or wrong)
-nmol is the no. of magnesium ion

when i run this command :
Try 10000 skipped position (-2.460, -12.747, 7.057)
Try 20000 skipped position (-1.478, -12.880, 5.785)
Try 30000 skipped position (-0.737, -14.086, 5.554)
Try 40000 skipped position (-1.093, -14.720, 4.211)
Try 50000 skipped position (-0.699, -13.913, 2.987)
Try 60000
Added 0 molecules (out of 6 requested)
Writing generated configuration to ionsolv.gro

ma’am please suggest me how can i add ions at the junction , please help me out from this problem…
Please find attachementpositions.dat (177 Bytes)

gmx insert-molecules inserts -nmol copies of the system specified in the -ci input file.
As far as I understood, you want to locate 6 Mg ions in specific position in space around RNA.
gmx insert-molecules
-f gro/pdb with your RNA (better unsolvated)
-ci pdb/gro with one mg ion
-nmol 6
-ip ion positions (see details how define the ion position in gmx insert-molecules — GROMACS 2021 documentation

I hope it helps

thankyou for replying ma’am

ma’am can you please provide pdb of mg2+

ma’am my initial pdb having a charg of -31e, i follow the same as you guided, I downloaded the pdb of mg2+ ion from this site ( ) i am also atteching the pdb please go through it.
Before solvation I executed : gmx insert-molecules -f 15fj9_solv_ions.gro -ci MG_ideal.pdb -ip positions.dat -nmol 6 -try 10000 -dr 1 1 1 -o ionsolv.gro

and the output of this command is : Using random seed -67141641
Read 6 positions from file positions.dat

Try 7 success (now 31995 atoms)!
Try 8 success (now 31996 atoms)!
Try 14 success (now 31997 atoms)!
Try 30 success (now 31998 atoms)!
Try 32 success (now 31999 atoms)!
Try 36 success (now 32000 atoms)!

Added 6 molecules (out of 6 requested)
Writing generated configuration to ionsolv.gro

After that i execute gmx editconf -f ionsolv.gro -c -o ionsolv.pdb
Then i see ionsolv.pdb in Chimera software and all 6 mg2+ ions are visible.

Then i execute : gmx solvate -cp ionsolv.gro -cs spc216.gro -o 5fj9_solv.gro -p
Then i execute : gmx grompp -f ions.mdp -c 5fj9_solv.gro -p -o ions.tpr
then gmx genion -s ions.tpr -o 5fjp_solv_ions.gro -p -pname MG -pq 2 -nname CL -neutral

after this command 16 mg2+ ions added and one chloride ions added.

my question is when i add 6 mg2+ ion before solvation why 16 mg2+ ion added in gmx genion why not only 10mg2+?

When you run gmx insert-molecules the Mg ions are inserted in the coordinate file, but I guess not in the topology file ( Please check the original file before running gmx solvate (that before SOL is added to the topology file) the last line of the topol, should be something like
'MG 6 ’
if this line is missing added it, and re-run again starting from gmx solvate

Best regards