  Using state-of-the-art first-principles calculations we have elucidated the
complex magnetic and structural dependence of LaOFeAs upon doping. Our key
findings are that (i) doping results in an orthorhombic ground state and (ii)
there is a commensurate to incommensurate transition in the magnetic structure
between $x=0.025$ and $x=0.04$. Our calculations further imply that in this
system magnetic order persists up to the onset of superconductivity at the
critical doping of $x=0.05$. Finally, our investigations of the undoped parent
compound reveal an unusually pronounced dependence of the magnetic moment on
details of the exchange-correlation (xc) functional used in the calculation.
However, for all choices of xc functional an orthorhombic structure is found.
