Magnetic skyrmions 1, 2 , i.e. non-collinear spin textures with particle-like properties, are promising future magnetic bits for future data storage technologies based on topological concepts [3] [4] [5] [6] [7] [8] [9] [10] [11] . Of great technological relevance are skyrmions in thin films and magnetic multilayers [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] , which can be stabilized as a result of the competition among the Heisenberg exchange interaction (HEI), Dzyaloshinskii-Moriya interaction (DMI) 23, 24 and the perpendicular magnetic anisotropy. The low spin polarized current thresholds required to manipulate skyrmions compared to typical ferromagnetic domain walls 3, 25 along with their high mobility, high stability and small sizes make them ideal for achieving efficient and functional devices. However, defects that are ineluctable in any device and materials are often seen as inhibitors for applications.
The dynamical behavior of the skyrmion motion as function of applied currents hinges on the presence of defects, which define the three motion regimes: pinning, creep-and steady-flowmotion as demonstrated experimentally in ultrathin heavy metal/ferromagnetic bilayers and multilayers 15, 26, 27 . Atomic-scale imaging based on scanning tunneling microscopy demonstrated that skyrmions in PdFe bilayer on Ir(111) are inert to the presence of a single Co adatom, in accordance to recent ab-initio simulations 28 , but react to the presence of a Co trimer 29 . Not only skyrmions experience pinning but also magnetic vortices with cores containing thousands of atoms. This was visualized with spin-polarized scanning tunneling microscopy, which was utilized to extract the pinning strength by moving vortices across defects with a vector magnetic field 30 .
In tandem to the few available experiments, scarce ab-initio simulations addressed the case of point-defects 28, 31, 32 while several phenomenological-based studies were dedicated to various defects assuming local changes in the magnetic properties of the material 3, [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] . Yet, the energylandscape impacting skyrmions as induced by complex defects remains weakly explored.
In the current work, we demonstrate that multi-atomic defects can behave in stark contrast to their single-atom counterpart when interacting with a magnetic skyrmion. The mechanisms favoring either skyrmion pinning or repulsion define two interaction genotypes. Similarly to concepts known in biology, they coexist in each defect but the observable interaction phenotype is one or the other depending on their relative strength. The breeding of the interaction profiles of the impurities by building-up multi-atomic defects may yield unexpected energy landscapes that can be engineered via various external means. Not only the chemical nature of the inhomogeneities was found of paramount importance but also their shapes, size and stacking sites. This gives a plethora of opportunities for new device architectures incorporating defects into their design by manipulating either their attractive or repulsive phenotypes.
We use a multiscale modelling approach, with parameters defining an atomistic extended Heisenberg model mapped from first-principles calculations (see Methods section) to investigate the energy profile of a single skyrmion at the vicinity of defects (dimer, trimers and tetramers) of different shapes, sizes and chemical nature deposited on PdFe/Ir(111) surface ( Figure 1a ). The latter substrate is known to host few nanometers-wide magnetic skyrmions 13, [45] [46] [47] [48] [49] [50] . The defects consisting of 3d transition metal atoms are located on top of the Pd layer and we consider both fcc and hcp stacking sites (Figure 2a-b) . The nanostructures can be ferromagnetic, antiferromagnetic, ferrimagnetic or even non-collinear when deposited on the saturated substrate. Here, we focus on nanostructures made of elements leading to unexpected interaction patterns such as Fe and Cr adatoms and illustrate their behavior with a collection of interesting examples. Although, single Fe and Cr adatoms tend to repel the investigated skyrmion, surprising new behavior emerges from placing the atoms in a cluster as shown schematically in Figure 1b in the form of a Punnett square.
While the trivial outcome of breeding two identical interaction profiles when forming a dimer is to generate the same phenotype profile, the most astonishing result is the emergence of an interaction profile of opposite behavior with respect to the phenotype of the isolated adatoms that act as "parents". Even more remarkable is the appearance of a dual behavior exhibiting both pinning and repulsive regions. The competition between the intra-defect and defect-substrate magnetic interactions are found to play a substantial role in establishing these counter-intuitive behaviors ( Figure 1c ).
Overview of the nature of skyrmion-defects interactions. The interaction energy between the various defects and the single magnetic skyrmion is defined as the energy difference between the two cases: (a) the skyrmion at the vicinity of the defect and (b) the skyrmion and defect far away from each other. A negative (positive) energy difference indicates an attractive (repulsive) skyrmion-defect interaction.
Our study is based on the following atomistic extended Heisenberg hamiltonian with param-4 Figure 1 : Atom-by-atom manufacture of skyrmion-defects energy landscapes. a A schematic picture of a magnetic skyrmion interacting with different types of defects indicated by green spheres. A plethora of interactions profiles emerge from building-up nanostructures made of the same atoms. b Graphical representation of a Punnett square describing the possible nature of the skyrmion-defect interaction that arises from bringing two repulsive adatoms together. The isolated adatoms act symbolically as parents and "carry" a repulsive interaction phenotype (red color) resulting from the subtle competition of mechanisms defining pinning and repulsion genotypes.
Owing to various mechanisms rooting in the magnetic interactions depicted in c, the resulting interaction phenotype can be trivially similar or even opposite to the one of the parents, and can remarkably develop a dual behavior. 
where the unit vectorm i = M i /M i defines the direction of the atomic magnetic moment M i at site i. The first term, J, describes the HEI, the second is the DMI, D, while K, corresponds to the uniaxial magnetocrystalline anisotropy energy (MAE) being positive for an out-of-plane easy axis. The defects can have a MAE of different sign and magnitude than that of the substrate (see Supplementary Table 1) . This, however, does not affect the orientation of the moments which is imposed by the adatom-substrate HEI (see Table 1 ). The last term is the Zeeman contribution due to an external magnetic field B ext applied along the magnetization of the ferromagnetic substrate,
i.e. the direction perpendicular to the substrate, which defines the z-direction. A field of 10 Tesla is considered in this study, which stabilizes single magnetic skyrmions with a diameter of about 3.2 nm.
The adatom-substrate magnetic interactions oscillate as function of distance with the nearest neighboring (NN) one being the most relevant (see Supplementary Note 1 and Supplementary   Figure 1 ). Considering the NN-averaged HEI presented in Table 1 , we expect the Fe nanostructures to be ferromagnetic by virtue of the first Hund's rule. In contrast, the antiferromagnetic interactions of the Cr nanostructures (see Table 1 ) lead to a rich set of magnetic textures (see for example
Supplementary Figure 2 obtained when the defects are away from the skyrmion).
After calculating the energy profile for all the investigated nanostructures depicted in Fi- gure 2c, we collect systematically the maximum (minimum) repulsive (attractive) skyrmion-defect binding energy per impurity as a function of the cluster size in Figure 3 . The breath of the binding energies, i.e. largest positive and negative values, is distinctly larger (a factor of three) for Crclusters as compared to that of Fe-clusters. This is related, in particular, to the adatom-substrate HEI being the strongest for Cr (see Table 1 ). Separating the adatoms, as done for the dimers depicted in Figure 2c , weakens the hybridization channels among their electronic states, which drastically reduces the adatom-adatom magnetic interactions shown in Table 1 and allows to recover the magnetic and interaction behaviors of the individual adatoms.
One notices that while single Cr-adatoms are repulsive, Cr-dimers can be pinning if the two atoms are nearest neighbors (dimer-1). Thus, while the interaction-genotype was initially repulsive, it can switch to pinning if the adatom-adatom interaction is permitted. Even more notable is that adding other Cr-adatoms to form a linear trimer or a tetramer, the resulting interaction phenotype switches back to the original repulsive nature. Intriguingly, the stacking site seems to mainly affect compact trimer-1 binding energies.
For several cases, one notices the dual behavior of the binding energies. This means that the same nanostructure on the same stacking site generates remarkably domains with opposite interaction-type with the skyrmion, i.e. repulsive and pinning regions surrounding the defect.
In that case two points are assigned to the same defect. As displayed in Figure 3 , the stacking site has a more dramatic impact on Fe-than on Cr-nanostructures, which can be assigned to the weaker adatom-substrate HEI of the former compared to that of the latter. While all hcp Fe-clusters repel skyrmions, fcc ones experience a transition from repulsion towards either pinning or a dual behavior when the size of the defects is increased.
As elaborated in the following subsections, the mechanisms driving the skyrmion-defect interaction genotype is settled by the chemical nature of the defects, their geometry, size and stacking sizes, which tune the balance between competing mechanisms affecting: (i) the magnetic interaction among the adatoms, (ii) the magnetic interaction of the adatoms with the Fe substrate, (iii) and
Zeeman energy. On the one hand, the defects tend to decrease the HEI among the neighboring Fe atoms of the substrate, initially reaching a value of 19.8 meV, owing to the hybridization of various electronic states (see Table 1 ). This favors non-collinearity among the substrate spin moments, which tends to stabilize skyrmions at the vicinity of the defects. On the other hand, the HEI be- Notably, reshaping and increasing the size of the nanostructures from dimers, to trimers (being of compact, corner and line forms) and tetramer open hopping channels for the electrons participating in the hybridization mechanisms within the nanostructure and with the substrate. This controls the magnitude of the magnetic interactions between the adatoms 51 , which is found to be in general the largest for the compact trimers (see Table 1 ), and dictates the overall magnetic behavior of the nanostructures. For conciseness, we focus our following analysis on the fcc stacking of the defects, but specific cases of the hcp stacking will also be addressed.
Anatomy of defect-skyrmion interaction profiles: case of Cr-nanostructures. Single Cr adatoms display a large repulsive impurity-skyrmion interaction (see red square in Figure 3 ) owing to electronic-structure-based mechanisms 28 , which can be simplified resting on the aformentioned arguments. The adatom-substrate HEI, being more important than the defect-induced reduction of the substrate HEI that faciliates pinning, leads to a local stiffness of the spin-texture on the substrate, and its consequently repulsive behavior. As shown in Supplementary to the non-collinearity of the skyrmion weakening the effective adatom-substrate HEI. Therefore, the effective exchange energy provided by the dimer is diminished at the vicinity of the skyrmion, which helps explaining the observed pinning. Likewise, the skyrmion is strongly reshaped when the cluster is on top of the skyrmion core as observed in Figure 4c . Accordingly, the canting between adjacent moments at the center of the magnetic skyrmion, position 1, decreases with respect to the shape obtained in the defect-free region. In contrast, the skyrmion recovers a more symmetric shape when its core is located at position 2. Thus, the skyrmion is stiffer at position 1 than at 2, which explains the off-centered energy minima. In fact, dissecting the various contributions to the binding energies, we find that a major difference between the two positions lies in the DMI contribution being more repulsive for position 1 than for position 2 due to the observed stiffness (see Supplementary Figure 4 ).
Similarly to the dimer, bigger Cr clusters experience a reversal of their magnetic chirality at the vicinity of magnetic skyrmions. Their energy landscape is found rich by hosting potentially a dual-behavior, i.e. multi-domains being pinning and repulsive. In Figure 5 , we plot the bindingenergy landscape of Cr trimers together with their magnetic state when the core of the skyrmion Because of the strong intra-defect magnetic frustration, a Néel state with a rotation angle of 120 • between the adatom moments is expected. Owing to the magnetic substrate, alteration of this state is observed depending on the shape and stacking of the defects. For instance, the hcp compact trimer (Fig. 5f ) is in a Néel state with moments forming a spin-flop configuration resembling the one found for the dimer with moments lying almost in-plane and perpendicular to z-axis defined by the ferromagnetic magnetization direction. In strong contrast, the same trimer on the fcc stacking site has moments forging a ferrimagnetic-like non-collinear configuration (Fig. 5b) , where the majority of atoms have their moments pointing almost antiferromagnetically to the substrate moments.
The simplified model addressed in Supplementary Note 4 gives a good account of the impurities magnetic texture and their stability, which is governed by the ratio of magnetic interactions J ad-sub /J ad-ad . The polar angles of two of the adatom moments is 164 • , which is rather close to 136 • found from the model (cos θ ≈ − 1 2 − 3 2 J ad-sub J ad-ad ) utilizing the averaged HEI listed in Table 1 . At the skyrmion vicinity, the effective adatom-skyrmion exchange interaction decreases because of non-collinearity and therefore the polar angle decreases. In the particular case of the distinct magnetic behavior of the fcc and hcp compact trimer-1, two mechanisms are at play: (i) the effective adatom-substrate magnetic interaction being reduced because of the substrate's non-collinearity and (ii) the weaker ratio of magnetic interactions (J ad-sub /J ad-ad ) for hcp compared to the fcc stacking site, respectively ∼ 10% and ∼ 15%.
The sequence of phenotypes observed by rotating and opening the trimers can further be explained with similar arguments. For instance, the immediate environment of trimer-2 and trimer-1 is different leading to a decrease in the ratio of HEI, (J ad-sub /J ad-ad ), for the former when compared to that of the latter. By opening the trimer to form a corner-trimer, the spin-texture is less non-collinear and rather ferrimagnetic since the intra-defect magnetic frustration is reduced. The effective magnetic interaction felt by the surrounding substrate's atoms is anisotropic. Therefore, the stiffness of the skyrmion is enhanced close to the region seeing two of the parallel Cr magnetic moments. As observed in Figure 5b -c-g, repulsive areas emerge at the vicinity of the majority of magnetic moments pointing along a similar direction.
As expected from a previous study 51 , the antiferromagnetic interaction given in Table 1 tend to strongly decreases between the adatoms of the linear trimer, in comparison to that of the compact and corner trimers. The hybridization mechanisms between the electronic states of the adatoms weakens the HEI when the impurities form a chain. This favors a transition towards a collinear behavior with the three adatom moments aligned antiparallel to the substrate magnetization (see Figure 5 ). The antiferromagnetic interaction with the substrate is strong enough to impose such a collinear magnetic behavior. Here, the adatom-induced exchange contribution to the binding energy increases linearly with the number of adatoms, which induces an overall repulsive behavior.
As expected, the linear Cr-tetramer behaves similarly to the trimer line and acts as repulsive defect independently from the stacking site. Figure 6c) . Hence, the mechanism leading to repulsion enabled by the Zeeman interaction is not anymore active. The same arguments can be used for all the more complex nanostructures made of Fe adatoms. When increasing the size of the nanostructures, single domains tend to develop. They are in general pinning for the fcc stacking site but switch to repulsion if the stacking is of hcp type. This is induced by the general weakening tendency of the adatom-substrate HEI when the stacking is of hcp instead of fcc type (see Table 1 ). While on the fcc stacking the adatom-substrate exchange interaction oscillate as function of the distance, on the hcp stacking the adatom couples ferromagnetic with both the first and the second nearest neighbour (see Supplementary Note 1). The latter provides a stronger magnetic exchange energy than for the fcc stacking sites, which stiffens the region under the defects and leads to the repulsion of the magnetic skyrmion.
In Antiferromagnetic Cr nanostructures can host non-collinear spin-textures enabled by magnetic frustration due to the competition of intra-defect and defect-substrate magnetic interactions.
The tendency for non-collinearity of the defects is amplified at the vicinity of skyrmions. The smallest nanostructure is a dimer characterized by a spin-flop state, which facilitates the pinning of skyrmions. In fact, we conjecture a pinning interaction phenotype for compact defects containing an even number of atoms since the total impurity-substrate magnetic interaction cancels out. The latter is finite for an odd number of impurities, which in general would promote ferrimagnetism and therefore repulsion. Fe nanostructures are ferromagnetic with rather sensitive magnetic interactions to the aforementioned knobs. As a result of the weakening of impurity-substrate magnetic interactions, the dimers are found mostly pinning but developing small repulsive domains. Shifting the defects from fcc to hcp stacking switches them to a repulsive behavior.
We envisage atomic fabrication of nanostructures made of the same atoms to design complex energy landscapes for the benefit of skyrmion-based devices. Resting on already available subnanoscale technologies, racetracks could be patterned with defects in a Lego-fashion to obtain personalized energy landscapes. Out of a row of defects generating a dual pinning-repulsive behavior, one could divide the racetrack into regions with the opposite interaction nature and even manufacture inert areas where the interactions cancel each other. One may create confining regions for potential reservoir computing 56 or build complex slalom-paths and networks to counteract properly the expected skyrmion Hall effect (see Figure 7 ). Our work promotes the exploration of man-controlled complex defects to exciting and useful constituents of future nanotechnology devices resting on non-collinear spin-textures.
First-principles calculations. The first-principles calculations are based on density functional theory considering the local spin density approximation 57 , as implemented in the full-potential relativistic Korringa-Kohn-Rostoker Green function (KKR) method 58, 59 . The latter allows us to embed the nanostructures in a non-perturbed magnetic substrate by using a real-space embedding procedure. The adatoms are relaxed by 18% similarly to what was considered in Ref. 32 . To extract the tensorial exchange coupling, one single interation was performed using the infinitesimal rotation method 60-62 considering a k-mesh of 200 × 200 and an angular momentum cut-off at l max = 3. The Pd overlayer carries a sizable spin-moment of ≈ 0.3µ B induced by the Fe atoms, which is incorporated in the atomistic model via a renormalization scheme of the substrate's magnetic exchange interactions as described in Ref. 63 . The magnetic states are investigated via an atomistic spin-dynamics approach 64, 65 extended to treat an embedding problem similar to the ab initio method. 