Atomic arrangements in multicomponent alloys : first-principles theory, atomistic modelling, and implications for magnetic properties