  We present a detailed investigation of the mechanisms at play for the
incorporation of In and Mg on the GaN(0001) surface during plasma-assisted
molecular beam epitaxy (PAMBE). First, we have studied the kinetics of In
desorption in the presence of Mg either without or with N supply from the
plasma cell by quadrupole mass spectrometry (QMS) in the line of sight. Second,
we have explored the effect of Mg doping at a different time along the cycle of
(InN/GaN) supply repeated 10 times to form (In,Ga)N/GaN superlattices (SLs). By
the complementary ex-situ investigation of these SLs by X-ray diffraction (XRD)
and secondary ion mass spectrometry (SIMS), we found that in monolayer-thick
(In,Ga)N layer, the In content was maximized when Mg was not supplied
simultaneously to In, but it drastically decreased otherwise. In contrast, the
Mg concentration strongly increased in the (In,Ga)N monolayers compared to the
GaN barriers. We attribute this finding to the surfactant effect of In for Mg,
which decreases the binding energy of Mg in GaN in presence of N.
