Ab initio study on the coordination structures of M+XY3− and M+XY4− ion pairs