{'fraction_non_alphanumeric': 0.03321168777094712, 'fraction_numerical': 0.012882999828553234, 'mean_word_length': 4.67714126807564, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
The Fe-Mg interplay and the effect of deposition mode in (Ga,Fe)N doped with Mg

The effect of Mg codoping and its deposition mode on the Fe distribution in (Ga,Fe)N layers grown by metalorganic vapor phase epitaxy is investigated. Both homogeneously- and digitally-Mg codoped samples are considered and contrasted to the case of (Ga,Fe)N layers obtained without any codoping by shallow impurities. The structural analysis of the layers by high-resolution transmission electron microscopy and by high-resolution- and synchrotron x-ray diffraction gives evidence of the fact that in the case of homogenous-Mg doping, Mg and Fe competitively occupy the Ga-substitutional cation sites, reducing the efficiency of Fe incorporation. Accordingly, the character of the magnetization is modified from ferromagnetic-like in the non-codoped films to paramagnetic in the case of homogeneous Mg codoping. The findings are discussed vis-`a-vis theoretical results obtained by ab initio computations, showing only a weak effect of codoping on the pairing energy of two Fe cations in bulk GaN. However, according to these computations, codoping reverses the sign of the paring energy of Fe cations at the Ga-rich surface, substantiating the view that the Fe aggregation occurs at the growth surface. In contrast to the homogenous deposition mode, the digital one is found to remarkably promote the aggregation of the magnetic ions. The Fe-rich nanocrystals formed in this way are distributed non-uniformly, giving reason for the observed deviation from a standard superparamagnetic behavior.


I. INTRODUCTION
One of the principal goals of nowadays materials science is to develop tools allowing for the bottom-up assembling of nanostructures with predefined properties and functionalities. It was theoretically suggested 1 that the codoping of magnetic semiconductors with shallow impurities affects the self-assembly of magnetic nanocrystals during epitaxy, and therefore modifies both the global and local magnetic behavior of the material. This concept was qualitatively corroborated by experimental data for (Zn,Cr)Te (Ref. 2) and (Ga,Fe)N (Refs. 3,4). In the latter case it was proven that by doping (Ga,Fe)N with donors (Si) the charge state of the Fe ions is reduced from Fe 3+ to Fe 2+ , affecting the binding energy of the Fe pairs, and suppressing the ions' aggregation even at a high Fe precursor flow rate. 3 The quenching of Fe aggregation, and therefore of either crystallographic or chemical phase-separation, results in an overall reduced magnetization of the layers, particularly at high temperatures, where the paramagnetic response of dilute spins is small.
While the effect of doping of (Ga,Fe)N with donors may be considered experimentally clarified, the role of intentional doping with acceptors (Mg) rises several remarkable issues, namely: (i) does the introduction of acceptors in a feasible concentration modify the Fe charge state to Fe 4+ or do the holes remain bound to the Mg ions? 5,6 (ii) in either case, does the introduction of acceptors affect, similarly to donors, 3,4 the aggregation of Fe? (iii) which is the effect of Mg-codoping on the magnetization of the layers? (iv) is the process of aggregation essentially a bulk effect [as in annealed (Ga,Mn)As] (Refs. 7,8) or it occurs at the growth surface, as suggested by our preliminary experimental 3 and theoretical 9 results for (Ga,Fe)N? (v) can the chemistry and spatial distribution of Fe-rich nanocrystals be controlled by codoping protocols?
In the present work, we report on the effect of Mg doping and deposition mode, considering three different series of (Ga,Fe)N samples: (i) without any codoping; (ii) with Mg continuously provided during the growth process (homogeneous codoping) and (iii) with digital Mgcodoping (δMg). 10 Our x-ray diffraction (XRD), transmission electron microscopy (TEM), and superconducting quantum interference device (SQUID) data show that homogeneous Mg codoping reduces the Fe incorporation with the consequent suppression of Fe-rich nanocrystals formation, as preliminary reported. 3 Interestingly, utterly different effects are found in the case of digital codoping. In this case, the self-assembling of Fe-rich nanocrystals is promoted, and their chemical composition and spatial distribution affected. Thus, the present analysis complements, by providing fundamental information on the role of the mode of acceptors incorporation into the system, the extensive work others 5,[11][12][13][14] and we 3,4,6,15,16 have carried out on controlling the structural and magnetic properties of (Ga,Fe)N. The data presented here demonstrate that various modes of codoping may serve, in a bottom-up fashion, to hamper or to promote phase separation and the self-assembling of Fe-rich nanocrystals in GaN.
These experimental results are confronted with our ab initio calculations carried out according to a methodology developed and employed earlier 9 to confirm the experimental observation 3 that the aggregation of Fe in GaN occurs at the growth surface. Other relevant first principles studies include works on the electronic states brought about by Ga-substitutional Fe ions in GaN. 4,17 It was found that the Fe 3+ ion, in addition to acting as a mid-gap acceptor, gives rise to a hole trap level localized at 0.3 eV above the top of the valence band, 17 substantiating earlier theoretical suggestions 18 and experimental findings. 6 Recently, the energetic and magnetic properties of Fe incorporated on a clean and Ga-bilayer GaN(0001) surface have been evaluated 19 within a formalism similar to ours. 9 It was found that a Fe atom occupies preferentially, by ∼2.0 eV, a surface substitutional Ga site rather than a near-surface interstitial site. Moreover, the authors conclude that under N-rich conditions the Fe atoms incorporate into Ga substitutional sites at the top bilayer with no tendency to migrate towards the bulk.
Here, we present computed values of cohesive energies for various Fe, Mg, and also Si clusters in the bulk and at the Ga-terminated GaN(0001) surface, assuming that the Fe ions occupy Ga-substitutional positions, in agreement with the first principles studies referred to above. 19 The computational data allow us to interpret the effect of codoping by either Mg or Si on the incorporation of the Fe ions. We also put forward an explanation for the highly non-random distribution of Fe-rich nanocrystals in the film volume, and relate it to the magnetic properties of this ferromagnetic/semiconductor nanocomposite system.
The manuscript is structured as follows: the experimental details on the fabrication and on the characterization methods are given in Sec. II, where a table listing the samples considered and their significant parameters is included. In Sec. III we discuss the structural and magnetic analysis of the two differently Mg-doped series of (Ga,Fe)N epilayers. We then present, in Sec. IV, the results of first principles computations carried out within a model developed to account for the Fe-Mg interplay observed experimentally and to compare it with the Fe-Si case. A series of often unanticipated conclusions emerging from the comparison of experimental and computational results are outlined in Sec. V. Within the final section, we provide a summary and an outlook prompted by the results.

A. Samples
Reference (Ga,Fe)N and two series of (Ga,Fe)N layers codoped with Mg have been fabricated by metalorganic vapor phase epitaxy (MOVPE) in a 200RF AIX-TRON horizontal system at a substrate temperature T s = 850 • C with trimethylgallium (TMGa), ammonia (NH 3 ), ferrocene (Cp 2 Fe) and biscyclopentadienyl magnesium (Cp 2 Mg) as precursors. The 1 µm thick doped layers are deposited onto a 1 µm thick GaN buffer grown on c-plane sapphire (Al 2 O 3 ) substrates following the procedure described elsewhere, 15 employing a TMGa precursor flow rate of 12 standard cubic centimeters per minute (sccm). For the homogeneously Mg-doped layers TMGa and both doping sources Cp 2 Mg and Cp 2 Fe are opened simultaneously during the layer growth. The (Ga,Fe)N:δMg layers are produced by growing 60 periods of (Ga,Fe)N layers between Mg thin layers. 10 The enrichment of the sample surface with nitrogen is ensured during the entire growth procedure by keeping the NH 3 flow rate constant. The Cp 2 Mg source flow rate is 350 sccm, giving -according to secondary ion mass spectroscopy (SIMS) measurements -a mean Mg content of ≈10 19 cm −3 (x Mg = 0.02%) in the δ-doped samples and a concentration ten times higher in the homogenously doped ones. The Fe concentration is varied by changing the Cp 2 Fe source flow rate from 50 to 450 sccm. A summary of the main parameters employed to fabricate the samples considered in this work is presented in Table I.

B. Secondary-ion mass spectroscopy
The total Fe and Mg content in the layers has been determined via secondary-ion mass spectroscopy (SIMS). An undoped GaN sample implanted with 10 16 cm −2 of 56 Fe at 270 keV is used as reference for calibration of the system. 15 In the (Ga,Fe)N reference layers the total Fe concentration in the films is found to increase with the nominal Cp 2 Fe flow rate.

C. X-ray diffraction
Structural analysis of the samples is performed by high-resolution x-ray diffraction (HRXRD), and synchrotron x-ray diffraction (SXRD). Conventional x-ray diffraction measurements are carried out on a X'Pert Pro material research diffractometer at an energy of 8 keV with the following configuration: a hybrid monochromator and a 0.25 • divergence slit are placed in front of the incoming beam and a PixCel detector with 1 mm active length is used, in order to reduce the diffuse scattering around the substrate peak and to improve the resolution.

D. Transmission electron microscopy
The high-resolution transmission electron microscopy (HRTEM) studies are performed on cross-sectional samples prepared by standard mechanical polishing followed by Ar + ion milling at 4 kV for about 1 h. Conventional diffraction contrast images in bright-field imaging mode and high-resolution phase contrast pictures have been obtained from a JEOL 2011 Fast TEM microscope operating at 200 kV and capable of an ultimate point-to-point resolution of 0.19 nm and allowing to image lattice fringes with a 0.14 nm resolution. Additionally, energy dispersive spectroscopy (EDS) analysis via an Oxford Inca EDS equipped with a silicon detector provides information on the local composition. Selected area electron diffraction (SAED) and fast Fourier transform (FFT) procedures are employed to study the scattering orders and the dspacing for respectively the larger and the smaller embedded nanocrystals.

E. SQUID magnetometry
The magnetic moment of the samples has been measured in a Quantum Design MPMS XL 5 SQUID magnetometer between 1.85 and 400 K and up to 5 T following the methodology described elsewhere. 20,21 As demonstrated previously, 3,6,15,16 the magnetic response of (Ga,Fe)N layers can be considered as representative for semiconductors containing transition metal ions at a concentration near the solubility limit. In particular, it contains a sizable diamagnetic component from the sapphire substrate, which is carefully subtracted according to the procedure detailed recently. 20,21 The remaining magnetic moment m(H) is: (i) purely paramagnetic and assigned to substitutional Fe 3+ ions if the system is dilute, while (ii) it is build up from the paramagnetic part as well as from a ferromagnetic-like component and from an antiferromagnetic contribution linear in H -these latter, both stemming from various magnetically ordered nanocrystals with high Fe content 16if the material undergoes phase-separation.
Due to the fact that the Fe-rich nanocrystals are characterized by relatively high ordering temperatures, a significant variation of m(H) at low temperatures allows us to assess quite precisely the concentration of paramagnetic ions x para .
Following the procedure employed previously, 6,16 we obtain x para by fitting gµ B Sx para N 0 ∆B S (H, T ) to the difference between the experimental values of the magnetization measured at 1.85 and 5.0 K, where ∆B S (H, T ) is the difference of the corresponding paramagnetic Brillouin functions ∆B S (H, T ) = B S (H, 1.85 K)-B S (H, 5 K). We adopt here parameters suitable for Fe 3+ ions in GaN, i.e., the spin S= 5/2, the corresponding Landé factor g = 2.0, and the cation density N 0 = 4.4 × 10 22 cm −3 , treating x para as the only fitting parameter. Its value is then employed to calculate the paramagnetic contribution at any other temperature according to M (T, H) = gµ B Sx para N 0 B S (H, T ), which is then subtracted from the experimental data to obtain the magnitude of the magnetization M ferro (H, T ) and its saturation value from which we establish x ferro , a lower limit of the Fe concentration in the Fe-rich nanocrystals. We assume the magnetic moment per Fe ion to be Sgµ B = 2.0 µ B , the value determined for ǫ-Fe 3 N. 16 Since, in general, the distribution of ferromagnetic nanocrystals is highly non-uniform, x ferro is intended as a mean value.

F. Electron spin resonance
Electron spin resonance (ESR) spectra have been obtained with a Bruker Elexsys E 500 spectrometer operating in the microwave X-band (≈ 9.8 GHz) equipped with a pumped helium cryostat. The measurements have been performed at a temperature of 2 K at the microwave power of ≈ 2 mW. The magnetic field is applied parallel to the crystal c-axis. To allow for lock-in detection, its magnitude is modulated at 100 kHz with an amplitude of 5 Oe. The integrated amplitude of the Fe 3+ ESR signal, omitting the region in the immediate vicinity of residual resonances corresponding to g = 2.0, serves as a relative measure of the concentration of Fe 3+ ions. 15

III. EXPERIMENTAL RESULTS
We discuss here the results of the SIMS, XRD, TEM, SQUID, and ESR measurements carried out according to the methodologies specified in the previous section. The findings provide information on the Fe incorporation, distribution, concentration, and on the corresponding magnetic properties of the considered samples. In order to demonstrate that we can control the Fe incorporation and distribution by selecting an appropriate codoping mode, the experimental results for three series of samples, namely: (Ga,Fe)N (reference samples), (Ga,Fe)N:Mg (homogeneous Mg-codoping), and (Ga,Fe)N:δMg (digital Mg-codoping) are compared.

A. Fe incorporation -SIMS data
In Fig. 1 the Fe concentration as obtained from SIMS data averaged over the layer thickness is reported. As seen, the two employed Mg codoping modes have a considerable, but reverse effect on the Fe incorporation, that is on the total Fe concentration in the layers for a given Fe precursor flow rate. In particular, homogeneous Mg-codoping reduces substantially the Fe concentration, which is -on the other hand -significantly enhanced in case of digital Mg-codoping in comparison to the (Ga,Fe)N reference films. It is interesting to establish how the effects described above evolve with the Mg concentration. According to the SIMS data presented in Fig. 2 only above a certain threshold of the Mg concentration, namely for x Mg ≥ 0.03%, Mg appears to prevail in thwarting the efficient incorporation of the magnetic ions.

B. Fe-rich nanocrystals -XRD and TEM data
As it can be seen in Fig. 3, in (Ga,Fe)N films, grown at a sufficiently high Fe precursor flow rate of 300 sccm, there are signatures of crystallographic phase separation witnessed by the HRXRD peaks corresponding to the expected ε-Fe 3 N secondary phase, detected also by HRTEM, as displayed in the inset to Fig. 3. In contrast, in the correspondent (Ga,Fe)N:Mg sample grown with the same parameter, but homogeneously doped with Mg, the Fe ions are less efficiently incorporated and the sample is dilute, as confirmed in Fig. 3 by the absence of both additional diffraction peaks in the HRXRD spectra and of nanocrystals in the HRTEM images. In Fig. 4, the HRXRD spectrum for a reference dilute (Ga,Fe)N sample grown at the relatively low Fe precursor flow rate of 100 sccm, is compared to those obtained for a homogeneously-and for a digitally-Mg codoped  In order to identify the detected Fe-rich phases, SXRD measurements have been carried out on a series of (Ga,Fe)N:δMg samples fabricated with constant nominal δMg-doping and by varying the nominal Fe concentra-tion throughout the series. In Fig. 5 the SXRD spectra for these samples are reported together with the corresponding (Ga,Fe)N phase-separated (nominal Fe content above 0.2%) reference. Several diffraction peaks close to the Al 2 O 3 (006) peak are observed and are labeled from 1 to 8 in the inset to Fig. 5. The Fe-rich phases in the (Ga,Fe)N phase-separated sample are all observed in the Mg-codoped ones, however their density is higher in the δMg-doped layers as inferred from the higher peak intensity and the narrower full-width-at-half-maximum (FWHM) of the peaks from the nanocrystals in the δMgdoping case compared with those in (Ga,Fe)N. The identified Fe-rich phases, their d -spacing and their size, as obtained directly from the FWHM of the SXRD peaks, 16 are summarized in Table II. Some of the phases identified, like e.g. the galfenol Fe 1−x Ga x ones, are not present in phase-separated (Ga,Fe)N when not δMg-doped.  Table II.
The FFT of the Moiré fringes in the HRTEM images of selected nanocrystals, reveals the presence of mainly ε-Fe 3 N in the (Ga,Fe)N reference and a variety of Ferich phases with d -spacings as reported from SXRD in the (Ga,Fe)N:δMg ones. The EDS spectra show that the Fe signal is significantly enhanced in the region of the nanocrystals, confirming their Fe-rich nature.
Another important issue concerns the spatial distribution of the Fe-rich nanocrystals. SIMS measurements on the δMg-doped samples evidence an inhomogeneous distribution of Fe in the layers along the growth direction, as seen in Fig. 6(a). Up to 300 nm below the surface the Fe concentration reaches its maximum for all δMgdoped samples. Additionally, in the sample containing 0.38% of Fe, an increased concentration of the magnetic ions is resolved close to the interface. This is also observed in TEM images, where in the highly δMg-doped layer the nanocrystals are found 300 nm below the sample surface -as seen in Fig. 6(b) -in two narrow regions separated by 180 nm and close to the interfaceas evidenced in Fig. 6(c). In the undoped (Ga,Fe)N sample, the nanocrystals lie around 200 nm below the sample surface. 16

C. Magnetic properties and Fe concentrations -SQUID data
A strict correlation between the presence of Ferich nanocrystals and the emergence of high temperature ferromagnetism has already been demonstrated for (Ga,Fe)N (Ref. 3,15,16). In fact, the SQUID data can serve to quantify the concentrations of Fe ions contribut-ing to ferromagnetic and paramagnetic signals, respectively, as described in Sec. II E.
Since the concentrations of Fe and Mg are similar, the question arises about a contribution of the Mg impurities to the magnetic response. From ESR measurements, we can state that no paramagnetic signal originates from holes bound to Mg acceptors in GaN:Mg, presumably because of compensation by hydrogen centers. Likely due to the same reason, the paramagnetic signal is -within 3%independent of the orientation of the c-axis of the samples with respect to the magnetic field, indicating that the Fe ions retain the 3+ charge state also in (Ga,Fe)N:Mg. In Figs. 7 and 8 the amount of Fe contributing to the ferromagnetic and paramagnetic signals, is respectively given. We see that the onset of ferromagnetism, which occurs at about 100 sccm of the Fe-precursor-flow-rate in the case of (Ga,Fe)N, is shifted to up to 300 sccm and down to 50 sccm for homogeneous and digital Mg codoping, respectively. Thus, the present data supports the assignment of ferromagnetism to the presence of Fe-rich nanocrystals revealed by XRD and TEM, as discussed in the previous subsection. Moreover, they demonstrate directly how a particular mode of codoping can serve to control high temperature ferromagnetism in (Ga,Fe)N.
As seen by comparing Figs. 7 and 8, in the region where ferromagnetism sets in, the concentration of paramagnetic Fe ions saturates and then decreases. It is also clear that homogeneous Mg-codoping reduces not only the ferromagnetic contribution but also the magnitude of the paramagnetic signal, in accordance with the induced quenching of the efficiency of Fe-incorporation. Interestingly, the data obtained earlier for (Ga,Fe)N:Si (Ref. 3), and displayed also in Fig. 8, show that Si codoping, in contrast to Mg codoping , enhances the concentration of paramagnetic Fe ions, at least at low Fe flow rates. In Fig. 9, the total Fe concentration from SIMS is compared to the sum of ferromagnetic and paramagnetic components. It is seen that the concentration from SIMS is systematically higher in the ferromagnetic region, indicating that some Fe ions are not captured by the employed analysis of the SQUID data in this regime. We assign the missing contribution to the presence of antiferromagnetic Fe-rich nanocrystals stabilized by the host. The clear correlation between the appearance of ferromagnetic-like features and the presence of Fe-rich nanocrystals referred to above substantiates the fact that Fe aggregation accounts for the high temperature ferromagnetism of (Ga,Fe)N. As shown in Fig. 10, the ferromagnetic component of the magnetization M f (H) of (Ga,Fe)N exhibits the features characteristic for high temperature ferromagnetic semiconductors. In particular, for any orientation of the magnetic field, the saturation magnetization is much larger than the spontaneous one. However, the spontaneous magnetization persists to above room temperature, indicating that for some nanocrystals the blocking temperature is higher than 300 K. Actually, the shape of the normalized M (H), particularly the presence of a small but non-zero spontaneous magnetization even at 300 K, indicates that for some nanocrystals the superparamagnetic limit has not been reached, whereas for others M f is described by a temperature independent Langevin-type function: 23 where H 0 is a sample dependent parameter, evaluated here to be 800 ± 200 Oe. It has been suggested 23 that dipole-dipole interactions between densely packed magnetic constituents may lead to a magnetization that can be accurately parameterized by a temperature independent Langevin-type function (Eq. 1), with 4πH 0 ≫ M Sat f constituting the magnitude of the local magnetization. In particular, these interactions may result in a domain or vortex structure within individual magnetic nanocrystals, that reduces their magnetization in weak magnetic fields. Furthermore, as evidenced by the TEM and SIMS measurements discussed in the previous subsection and illustrated in Fig. 6 the distribution of magnetic nanocrystals is highly non-uniform, promoting their dipole-dipole interactions.

D. Concentration of Fe 3+ ions -ESR data
In order to asses the microscopic origin of the paramagnetic component we have carried out ESR measurements. As in the previous studies 15 we observe a spectrum that is assigned to non-interacting Fe 3+ ions in a wurtzite crystal field. As shown in Fig. 12, the Fe concentration determined from the ESR signal intensity scales consistently in both (Ga,Fe)N and (Ga,Fe)N:δMg with the concentration of paramagnetic ions drawn from the SQUID data. At the same time, however, the ESR signal is dramatically reduced in (Ga,Fe)N:Mg.
The integrated peak amplitude of the Fe 3+ magnetic transitions at the magnetic field parallel to the crystal caxis serves as a relative measure for the concentration of these isolated paramagnetic ions, 15 calculated according to the following procedure: since the spectra are collected by means of a lock-in technique, they are proportional to the first derivative of the absorption with respect to the magnetic field. First a linear background is subtracted from the spectra which is afterwards numerically integrated to yield a signal proportional to the absorption. These integrated spectra usually show a broad background, which is removed by substracting a polynomial of an order between 4 and 9. Then the peaks of interest are integrated again to get their integrated intensity, the integration ranges being chosen to be the same for all samples. These integrated peak areas are proportional to the total number of spins and are therefore normalized by the sample volume.
To convert these integrated peak areas into absolute concentration values, they are multiplied by a calibration factor (the same for all samples), which is chosen such that it minimizes the sum over all samples of the squares of the differences between the Fe 3+ concentration values obtained by ESR and SQUID according to the procedure described in Sec. II E. The formula that is minimized is where a is the calibration factor, I i is the integrated peak intensity for sample i obtained from ESR and x i is the Fe 3+ concentration in sample i as obtained by SQUID. The minimization leads ESRi . The Fe transition at g ≈ 2 has not been employed for quantification, since it overlaps with a signal stemming from impurities in the substrate and varying in intensity from wafer to wafer.

(Ga,Fe)N:Mg
As seen in Fig. 11, the concentration of paramagnetic isolated Fe 3+ as determined by ESR is consistent with the values obtained by fitting the SQUID magnetisation curves according to Sec. II E. This agreement corrabo-rates our statement, that most of the present Fe is indeed isolated and in the 3+ valence state. By comparing the ESR spectra of (Ga,Fe)N with those of (Ga,Fe)N:Mg, it is observed that the concentration of Fe 3+ is generally decreased when homogeneously codoping (Ga,Fe)N with Mg.

(Ga,Fe)N:δMg
Also for the digitally Mg-doped layers a significant consistency between the SQUID and ESR values for Fe 3+ is found and summarized in Fig. 12. In the δMg doped samples, the concentrations of Fe 3+ are systematically and notably lower than the overall Fe concentration as determined by SIMS, in agreement with the observation that a substantial amount of Fe is incorporated in secondary Ferich phases. Furthermore, we generally observe that the Fe 3+ concentration as determined by ESR is lower in the digitally doped samples than in the reference (Ga,Fe)N.

IV. COMPUTATIONAL RESULTS
As mentioned earlier, the computation of the cohesive energies for various Fe, Mg, and also Si clusters in the bulk and at the Ga-terminated GaN(0001) surface allows us to interpret the effect of codoping by either Mg or Si on the incorporation of the Fe ions, especially in the frame of the different codoping modes.

A. Methodology
The computations have been performed within the density functional theory-generalized gradient approximation DFT-GGA+U approach with the Perdew-Burke-Ernzerhof exchange and correlation functional 24 and ultrasoft pseudopotentials 25 to describe electron-ion interactions as implemented in the plane wave basis Quantum Espresso code. 26 The energy cut-off is set to 30 and 180 Ry for the kinetic energy and electronic density, respectively. The value of the U parameter is chosen to be 4.3 eV for the Fe 3d orbitals, a similar value being employed in our previous work. 9 As previously, 9 we use the supercell approach to calculate the formation energy of Fe n Mg m and Fe n Si m (n, m ≤ 2) clusters in the zinc-blende (zb) GaN and at the Ga terminated (0001) wurtzite (wz) GaN surface. The zb supercell consists of 64 (2a × 2a × 2a) atoms. A 4 × 4 × 4 Monkhorst-Pack k-point sampling mesh is employed. The modeling at the Ga surface is carried out with a supercell containing 4 GaN bilayers (48 Ga and 48 N atoms) and a vacuum region of approx-imately 1 nm. The first GaN bilayer is fixed in the appropriate bulk configuration. The unit cell is taken to be 2 √ 3a × 3a, and the dangling bonds on the opposite nitrogen surface are saturated with 12 H atoms. The integration over the Brillouin zone (BZ) is performed using a 4 × 4 × 4 Monkhorst-Pack k-point mesh. We have used the Methfessel-Paxton smearing for the integration over the BZ with a smearing width of 0.05 and 0.005 for the surface and bulk calculations, respectively. The atomic positions within the supercells have been fully optimized in all cases. The lattice constants are taken from our previous work 9 and set to 0.4549 nm for zb-GaN, and a = 0.3211 nm and c = 0.5231 nm for wz-GaN.
We have studied the formation of Fe n Mg m and Fe n Si m (n, m ≤ 2) complexes in the zb-GaN matrix and also at the (0001) wz-GaN surface. The atoms in the studied clusters occupy substitutional positions in the cation sublattice of GaN. The most stable configuration for the Fe-X (X = Mg or Si) cluster is the one where Mg or Si is the nearest neighbor (NN) of the Fe atom. If a second Mg or Si is at the NN distance to Fe, then the three atoms form an almost linear X-Fe-X cluster, where X = Mg or Si. A cluster with two Fe has been previously considered 9 and the stable configuration has the two transition metal atoms as NNs, both in the bulk and at the surface. The Fe 2 X (X = Mg or Si) complex forms an isosceles triangle. Interestingly, the same configuration has been recently found to be the most stable structure for the isolated Fe 2 Si cluster. 27 Finally, the Fe 2 X 2 (X = Mg or Si) cluster forms two isosceles triangles with a common Fe-Fe base. The two triangles are almost coplanar and the cluster has Cs symmetry. It should be pointed out that there is no significant difference in the shape of the structures in bulk compared to those at the surface.

B. Results of ab initio studies
As previously reported, 9 two Fe ions tend to form pairs both in the bulk and at the Ga terminated surface as the heat of reaction (pairing energy E d ) for those clusters is -0.158 and -0.125 eV, respectively. The formation of Fe-Mg and Fe-Si cation pairs in bulk GaN is energetically favorable since E d for those clusters is -0.178 and -1.349 eV, respectively. In contrast, at the Ga surface only Fe and Si tend to form pairs (E d = -0.309 eV), whereas Fe and Mg avoid being at NNs positions (E d = 0.187 eV). It is worth mentioning that the E d value for Fe-Si pairs in bulk is similar to the binding energy -1.44 eV for an isolated Fe-Si cluster. 27 Finally, neither Mg nor Si are likely to form monoatomic pairs in the bulk (E d = 0.102 and 0.847 eV, respectively) or at the surface (E d = 0.130 and 0.067 eV, respectively).
The formation of Fe pairs may be, however, strongly affected by the presence of Mg or Si atoms. This is shown in Fig. 13, where we compare the heat of reactions for the formation of several consecutive Fe n X m (n, m ≤ 2) clusters, where X denotes Mg and Si, respectively. Codoping of (Ga,Fe)N with Si or Mg not only affects the formation of the Fe pairs, but also influences the magnetic coupling between the Fe ions, as shown in Fig. 14 where we plot the total energy difference between the ferromagnetic (FM) and antiferromagnetic (AF) configurations for several Fe 2 X m (m ≤ 2, and X denotes Si or Mg) clusters in the zb-GaN matrix and at the (0001) wz GaN surface.
To complement our investigation, we have also carried out calculations for the formation of Fe n Mg (n ≤ 2) clusters in the presence of negative charge in the GaN matrix. The negative charge in the system may be viewed as an analog of the compensating defects (e.g., H impurities) that can be present during the codoping process of (Ga

V. DISCUSSION AND CONCLUSIONS
In this Section we discuss the outcome of the experimental studies summarized in Sec. III in the light of the theoretical results presented in Sec. IV.
It is well known that except for isoelectronic Mn in II-VI compounds, where d-levels are far from the Fermi energy, in virtually all other transition metal (TM)-doped semiconductors a significant contribution of open d shells to the bonding leads to a strong attractive force between magnetic cations. 2,28 This leads to segregation and/or precipitation of TM-rich compounds during the growth under thermal equilibrium conditions, the resulting solubility limit being typically well below 0.1%. However, epitaxy at sufficiently low temperatures is known to allow for the fabrication of dilute magnetic semiconductors (DMSs) with random distribution of TM cations of concentrations largely surpassing the solubility limit, a canonical example being (Ga,Mn)As. 29 The high temperature annealing of this material leads to the aggre-gation of Mn cations resulting in the formation of Mnrich embedded ferromagnetic nanocrystals. 7 The ferromagnetic/semiconductor nanocomposite formed in this way shows the typical properties of a superparamagnetic systems. 30 Extensive investigations over the recent years have made it increasingly clear that in most TM-doped semiconductors and oxides the aggregation of magnetic cations occurs already during the growth process. 31 The studies carried out to-date on TM-doped nitrides allow us to shed light onto a number of questions pertinent to these systems.
A. Does the aggregation of magnetic ions occur in the bulk or at the surface?
A strong dependence of the efficiency of Fe aggregation on the growth rate led us to conclude that this process takes place at the growing surface. 3 This fact was further supported by the lack of evidences for aggregation of both Fe and Mn under post-growth annealing up to above growth temperature. 16,20 At the same time, we found that under similar growth conditions, the solubility limit of Mn in GaN is at least one order of magnitude greater than the one of Fe. 32 We explained this surprising difference within first principles computations 9 implying that there is no attractive force between Mn cation pairs at the GaN surface, whereas the magnitude of the pairing energy of Fe cations E d = −0.125 eV, reported in Fig. 13 can explain the formation of the Fe-rich nanocrystals, even at a growth temperature of ∼1100 K. According to computational results displayed in Fig. 13, there is a gain in energy with the formation of Fe-Si cation pairs at the GaN surface. In contrast, there is a repulsive force between Fe and Mg under the same conditions. This means, in line with the experimental results collected in Fig. 8 at low Fe flow rate, that the presence of Si enforces the Fe incorporation whereas Mg has an opposite effect, as observed.
At the same time, the destructive effect of homogeneous Si and Mg codoping upon the Fe aggregation found experimentally in the previous 3 and present work -as evidenced in Fig. 7 -is in accord with the theoretically established repulsive interaction between Fe cations at the GaN surface in the presence of either Mg or Si, as shown in Fig. 13. As discussed in Sec. IVB, the effect is stable against a donor compensation (e.g., of Mg by H) and is independent of the distance of Mg or Si to the Fe-Fe pair. Once more it must be underlined, that in contrast to Si -shown to rather promote the incorporation of Fe into GaN -the homogeneous codoping with Mg diminishes the efficiency of the Fe incorporation into the GaN ma-trix, with the obvious effect of promoting the dilution of the system.
It is worth noting that according to the results collected in Fig. 2, the presence of Fe favors the incorporation of Mg into GaN. This may mean that the strength of the repulsive interaction within Mg-Mg pairs is lowered by the presence of Fe. The ab initio results reported in Sec. IVB suggest that the pairing energies Mg-Mg and Mg-Fe are of the same order at the growth surface, 0.13 and 0.2 eV, respectively. However, the presence of Fe leads to an attractive interaction within Mg-Mg and Mg-Fe pairs, that may promote the Mg incorporation, as observed.
C. How does digital doping promote the formation of nanocrystals?
For the case of digitally codoped layers: (i) in contrast to the case of homogeneous doping, the δ-fashion growth-mode promotes the aggregation of Fe and the consequent phase-separation of the system; (ii) a high density of Fe-rich nanocrystals is observed already for 0.1% of Fe under our growth conditions; (iii) the variety of the Fe-rich phases becomes more variegated with increasing Fe concentration; (iv) the nanocrystals are not distributed uniformly in the sample volume, but concentrate 300 nm below the sample surface and at the interface GaN-buffer/(Ga,Fe)N:δMg-layer; and (v) due to the presence of the Fe-rich embedded nanocrystals, a significant FM contribution to the overall magnetization is observed up to above room temperature. At the same time, the presence of Fe reduces the mean concentration of Mg that can be incorporated in the digital mode.
The origin of the above striking phenomena is not yet fully understood. It is possible that interdiffusion of Mg and Fe accompanying the digital growth mode makes that bulk rather than surface energetics applies to this case. According to Fig. 13, the presence of Mg not only does not hamper the Fe aggregation but enhances it, particularly in the case of larger clusters. At the same time a substantial repulsion between Fe-Mg pairs at the surface may lead to a reduction of a mean Mg concentration in (Ga,Fe)N, compared to digitally-Mg doped GaN.
The overall effect of digital-doping and or/generally digital-growth requires at this point a dedicated study of growth-kinematics and -dynamics both in the presence and absence of intentional doping. D. Why are the embedded Fe-rich nanocrystals not distributed uniformly over the film volume?
According to the present and previous 3 XRD and TEM studies, the average size of the embedded Fe-rich nanocrystals is independent of the Fe flow rate, suggesting that the precipitation occurs by a nucleation mechanism in which only nanocrystals with a critical size can form. If this is the case, during the epitaxy, as long as the nanocrystals maintain an undercritical size, they develop and segregate with the growth front, a process that is interrupted once the critical size is reached. Accordingly, a high density of nanocrystals is expected to be found in narrow volumes perpendicular to the growth direction. Within this scenario, the distance between the nanocrystals-rich volumes would be inversely proportional to the rate of Fe incorporation at the surface. The previous and present TEM data reveal the existence of such 2D-like distribution of nanocrystals. An important consequence of the resulting highly non-uniform distribution of the magnetic nanostructures over the film volume, is the onset of significant dipole-dipole interactions freezing the thermal fluctuations of the nanocrystals magnetic moments.

VI. SUMMARY AND OUTLOOK
The effect of Mg-doping on the structural arrangement and in the magnetic behavior of (Ga,Fe)N has been investigated, with particular attention to the role of the doping method (homogeneous or digital). The onset of a competitive mechanism between Mg and Fe for the occupation of substitutional sites becomes evident, as the presence of Mg reduces the amount of Fe in the homogeneously Mg-doped layers compared to the corresponding reference samples (Ga,Fe)N and induces Fe aggregation in the digitally fabricated ones. As a consequence of the reduced efficiency of Fe incorporation in the homogeneously Mg-doped layers, the system becomes dilute and its magnetic response is purely paramagnetic. In contrast, upon δMg-doping, the tendency of the Fe ions to aggregate is enhanced, and the system becomes ferromagnetic, due to the presence of FM ε-Fe 3 N and galfenol Fe 1−x Ga x nanocrystals.
The ab initio calculations, confirm the tendency of the Fe ions to aggregate at the growing sample surface of wz-GaN efficiently in the presence of Mg. Furthermore, they indicate that: (i) the presence of either Mg hinders, while the one of Si promotes the Fe incorporation, as observed; (ii) both (homogeneous doping with) Mg or Si quenches the aggregation of Fe. This is in contrast with the computational results for bulk, where an enhancement of the tendency to aggregation is expected in the case of Mg codoping. It is possible that this case applies to the digital-like codoping, where interdiffusion is important.
In general terms, our combined experimental and theoretical studies demonstrate how particular codoping modes may serve to control the bottom-up fabrication of magnetic nanostructures in a semiconductor matrix. In view of our results, a considerable diversity of local atom arrangements obtained via particular codoping modes results from substantial differences in the energetics at the growth surface and in the bulk, providing a worthy mean to design self-assembling processes at the nanoscale.