Given $X$, a set of $n^2$ integers what are necessary and sufficient conditions for forming a [magic square](https://en.wikipedia.org/wiki/Magic_square) with them?

For eg: if $X$ has members from an arithmetic sequence, we can create a magic square.

Here is a magic square formed using $X = \{ 1, 2, \dots, 9 \}$

[![enter image description here](https://i.stack.imgur.com/2L43I.png)](https://i.stack.imgur.com/2L43I.png)

Here is another with $X = \{ 5 + 3k : k \in [1, 9] \}$

[![enter image description here](https://i.stack.imgur.com/9nNop.png)](https://i.stack.imgur.com/9nNop.png)

and this one using $Y = \{ 5 + 3k : k \in X \}$, where $X$ is the set defined above.

[![enter image description here](https://i.stack.imgur.com/GqTn4.png)](https://i.stack.imgur.com/GqTn4.png)

Are there other sets apart from elements from Arithmetic Sequences that can be arranged into a magic square?