The theory of crystal ordering