This seems to be more a question for chemistry. The reason lays on the atomic bonds. First at all, for high enough temperatures all solids will go to a liquid or and gaseous-like state and behave like marbles. And for temperatures near 0 Kelvin the marbles will behave more or less like a crystal. >... if we take different marble in a box and shake it then it should be arrange in order to get low energy state. It does. Nearly all marbles will lay in the [closed-packing of equal spheres](https://en.wikipedia.org/wiki/Close-packing_of_equal_spheres).[![enter image description here][1]][1] And why the balls do not stick together an the crystalline level? Because it is needed some [activation energy](https://en.wikipedia.org/wiki/Activation_energy). But that’s all about chemistry. [1]: https://i.sstatic.net/Hs5yEs.jpg