magnesium ion binding [GO_0000287] - Virtual Fly Brain