The refinement of my structure is changing the position of my Mg2+ ion

Hello, since I’m a new user, I cannot upload my files.

I’m facing an issue when doing the refinement of my modelled structure when I add a magnesium ion. For some reasons, the position is not the optimal initial one I have introduced first. The refinement is messing it up. I try adding constraints within the document like this :
COMPND MG
HETATM 1 MG+2 MG2 F 1 13.942 -5.590 6.587 1.00 55.96 MG
assign (segid F and resid 1 and name MG) (segid A and resid 535 and name O3G) 1.8 0.0 0.4
assign (segid F and resid 1 and name MG) (segid A and resid 535 and name O1B) 2.3 0.0 0.4
END

But I’m still facing issues and low score results with low stability.

What should I do ?

The restraints should match the naming of your ions. And in this case the atom name should be between double quote because of the + sign:

assign (segid F and resid 1 and name “MG+2") (segid A and resid 535 and name O3G) 1.8 0.0 0.4
assign (segid F and resid 1 and name “MG+2”) (segid A and resid 535 and name O1B) 2.3 0.0 0.4

And of course the oxygen names must match the HADDOCK naming.