Theoretical analysis of the 3-k magnetic structure and distortion of uranium dioxide