Define ATP+mg in Amber forcefield

GROMACS version:2025
GROMACS modification: No
Hello everyone, I am using Amber99SB-ildn force field to simulate a kinase in complex with ATP and Mg. I generated the protein topology using pdb2gmx. Then created ATP topology with Ambertools and attached it to my topol.top file. I also attached ions.itp file of forcefield for Mg parameters. But after EM Mg interacts with the Adenosine ring instead of the phosphate group. I tried to apply position restraint for ATP+Mg, but it did not work.
I am new to this field, and I am not sure if I did it correctly or not. I would appreciate any suggestions or guidance.
I have to mention that I extracted ATP coordinates of my protein complex to generate topology, not the standard ATP coordinates from PDB.