Structural and electronic properties of neutral and anionic magnesium clusters doped with two barium atoms