  To explore the formation of noncollinear magnetic configurations in materials
with strongly correlated electrons, we derive a noncollinear LSDA+$U$ model
involving only one parameter $U$, as opposed to the difference between the
Hubbard and Stoner parameters $U-J$. Computing $U$ in the constrained random
phase approximation, we investigate noncollinear magnetism of uranium dioxide
UO$_2$ and find that the spin-orbit coupling (SOC) stabilizes the 3$\textbf{k}$
ordered magnetic ground state. The estimated SOC strength in UO$_2$ is as large
as 0.73 eV per uranium atom, making spin and orbital degrees of freedom
virtually inseparable. Using a multipolar pseudospin Hamiltonian, we show how
octupolar and dipole-dipole exchange coupling help establish the 3$\textbf{k}$
magnetic ground state with canted ordering of uranium $f$-orbitals. The
cooperative Jahn-Teller effect does not appear to play a significant part in
stabilizing the noncollinear 3$\textbf{k}$ state, which has the lowest energy
even in an undistorted lattice. The choice of parameter $U$ in the LSDA+$U$
model has a notable quantitative effect on the predicted properties of UO$_2$,
in particular on the magnetic exchange interaction and, perhaps trivially, on
the band gap: The value of $U=3.46$ eV computed fully $ab$ $initio$ delivers
the band gap of 2.11~eV in good agreement with experiment, and a balanced
account of other pertinent energy scales.
