Modulations in martensitic Heusler alloys originate from nanotwin ordering

Heusler alloys exhibiting magnetic and martensitic transitions enable applications like magnetocaloric refrigeration and actuation based on the magnetic shape memory effect. Their outstanding functional properties depend on low hysteresis losses and low actuation fields. These are only achieved if the atomic positions deviate from a tetragonal lattice by periodic displacements. The origin of the so-called modulated structures is the subject of much controversy: They are either explained by phonon softening or adaptive nanotwinning. Here we used large-scale density functional theory calculations on the Ni2MnGa prototype system to demonstrate interaction energy between twin boundaries. Minimizing the interaction energy resulted in the experimentally observed ordered modulations at the atomic scale, it explained that a/b twin boundaries are stacking faults at the mesoscale, and contributed to the macroscopic hysteresis losses. Furthermore, we found that phonon softening paves the transformation path towards the nanotwinned martensite state. This unified both opposing concepts to explain modulated martensite.


Adaptive Nanotwinning in a Nutshell
In Fig. 1, we sketch how austenite (A) and different modulated martensites (M) are related through the central constraint of length conservation. Minimising the elastic energy at the phase boundary requires that the cubic lattice of austenite must be matched by the twinned martensite. For instance, the 14M martensite consists of simple, non-modulated (NM) tetragonal martensite twins with a c/a| NM = 1.26. Twin boundaries are introduced every two long (n) and five short m ( ) lattice planes 16 . This arrangement of long and short axes retains an invariant, i.e. unstrained plane, the so-called habit plane that forms the phase boundary. It is favourable in terms of elastic energy; more details are described in refs [13][14][15]21 . 10M martensite, discussed later in this paper, follows the same principle. The c/a| NM ratio is, however, reduced to 1.16 and twin boundaries are introduced after two and three lattice planes 22 . In case of a negligible twin boundary energy compared to the elastic energy, the modulation (n + m) should be the smallest possible number with n and m being integers.
Twinning can also occur within a unit cell; thus, it is appropriate to consider a martensitic "building block", which has just half the length and width of an ordered Heusler unit cell. In Zhdanov notation, these periodic arrangements are denoted as nm ( ) 2 , where n and m are the number of tetragonal building blocks of different orientation, which are connected by (101) NM twin boundaries. If n + m is odd, the structure must be repeated to conform with chemical ordering. If n is unequal m, the unit cell becomes monoclinic. The modulated structure is then represented as 2(n + m)M. The stacking sequences corresponding to the most common modulations are (23) 2 (10M) and (25) 2 (14M). One observes larger m and thus larger c/a| NM at compositions with higher electron density and higher transformation temperatures 23,24 . Conservation of length at the habit plane is approximately described by the equation  12 . For a given tetragonal distortion c/a| NM and a A , this equation can in general not be fulfilled by small integer numbers n and m but there is a small "remainder". Accordingly, the condition for an exact match at the habit plane b M = a A is not fulfilled and there is a small misfit, which can be closed by faults in the n-m stacking sequence 12 . As a hierarchical twin-within-twins microstructure forms in martensite 13,14,25 , we will call the twin boundaries occurring at the atomic scale "nanotwin" boundaries in order to distinguish them from twin boundaries occurring at larger length scale.

Results and Discussion
Oscillating interaction energy of nanotwins in dependency of their spacing. For many types of microstructural defects there is some kind of interaction, which results in the formation of new patterns. A wellknown example from metal physics is the interaction between dislocations, resulting in the formation of periodic grain boundary networks 26 , most directly observable during polygonization of bent single crystals 27 . For twin boundaries, however, no such interaction is known yet. To prove the existence of an interaction between nanotwin boundaries, we used DFT to investigate the total twin boundary energy γ tot . γ tot represents the excess energy for connecting two martensitic variants of a given width n by a twin boundary divided by the interface area. Using the energy difference between a nanotwinned structure and the non-modulated reference (see Methods), we decomposed γ tot into two parts: 1) a bare formation energy of an isolated twin interface γ ∞ , connecting two variants of infinite length, and 2) the interaction energy γ n between neighbouring twin boundaries that are n lattice planes apart.
All twins consisted of stoichiometric Ni 2 MnGa with a tetragonal distortion of c/a| NM = 1.26, which is the ground state according to previous DFT calculations [28][29][30][31] . (see Supplementary Information for other c/a| NM ). In a first series, we considered a symmetric arrangement of twin boundaries nn ( ) and varied the spacing of both twin boundaries from n = 1 to 12 (Fig. 2). The triangles represent the case of ideal twin boundaries, where the atoms in each twin were fixed to positions obtained from a simple mirroring of the NM martensite. The corresponding γ tot showed a pronounced oscillatory pattern, which proved a short range interaction between nanotwin boundaries. For n ≥ 5, oscillations diminished and thus γ ∞ was obtained by averaging the total interface energies for n ≥ 5. The decomposition of γ tot into interface and interaction contribution also holds if neighbouring twins are of arbitrary width n and m. For n > 1, the corresponding γ n and γ m can be summed up (crosses in Fig. 2) to obtain the effective interaction energy of a nm ( ) 2 arrangement (diamonds). We thus suggest that it is sufficient to consider only the pairwise interaction energy and to neglect further terms.
Finally, we allowed for relaxation with respect to all four monoclinic parameters of the simulation box and atomic positions (circles). This resulted in a nearly constant shift by −0.8 meV/Å 2 for all n, thus γ ∞ = 0.5 meV/ Å 2 now included all structural relaxations caused by the placement of the twin boundary. The oscillating pattern did not change, proving that the interaction between nanotwins was stable with respect to the slight displacement of the atoms. The γ tot of ideal symmetric nn ( ) twins (triangles) was decomposed into the oscillations interaction of nanotwins, γ n , at small n, and into a constant contribution γ ∞ at large n. The latter describes the pure nanotwin boundary formation energy. The martensitic building blocks had a tetragonal distortion of c/a| NM = 1.26. Asymmetric nm ( ) 2 arrangements (diamonds) could be predicted from the superposition of the respective γ tot obtained from the symmetric nn ( ) and mm ( ) cases (crosses), proving the additive relation. We used n + m = 14 building blocks where the twin boundaries were separated by n and m = 14 − n building blocks, respectively. As this geometry contains twice as many nanotwin boundaries compared to the symmetric one, the offset was 2 × γ ∞ . Upon structural optimisation (circles), γ tot decreased rather uniformly, i.e. independent of n, indicating that relaxations were confined to the interface. A pronounced minimum of the interaction energy was obtained for n = 2. We found a substantial increase in interaction energy from n = 2 to n = 1 in agreement with the absence of modulation with n = 1 in experiments. Compared to a disordered arrangement of nanotwin boundaries, which contains a broad distribution of n, arrangements with a maximum number of twins with n = 2 were favourable in terms of the total energy. This explains why all experimentally observed ordered modulations contain double-layered twins.
Our disentangling of interaction and twin boundary energy gives a better understanding of the observed modulations compared to previous work, which considered only a positive twin boundary energy 11,15 . Surprisingly, after optimisation, we obtained a slightly negative γ tot for double layered twins, which become the global energy minimum. The optimum (22) stacking exhibits orthorhombic symmetry and is called 4O. Indeed, there are several experimental reports on the 4O phase in metamagnetic Heusler alloys, where 4O is always observed together with other modulations 32,33 . In a recent independent work, the geometry and electronic structure of the 4O phase is described in more detail 34 . We will discuss the origin of the negative γ tot for n = 2 in section 6. Interface-and interaction energies between the twin boundaries determined here were within the range of thermal energies. Hence, thermal fluctuations will likely affect the arrangement of the twin boundaries when transforming to the modulated state of martensite.
Formation of a M /b M twin boundaries by ordering nanotwins. What are the consequences of the interaction energy on the martensitic microstructure beyond the length scale of nanotwinning? Does the integer number of building blocks within a periodic modulation induce a new type of twin boundary at mesoscopic length scale? To find out, we reconsidered the slightly different length of a complete (25) 2 modulation compared to seven austenitic unit cells along the habit plane. This misfit can be closed by stacking faults 12 that are inserted with a substantially larger period than the modulation period. As this stacking fault period is not solely defined by the lattice constants of martensite but also depends on the austenite, the arrangement is incommensurate when measuring a completely martensitic sample, which is in agreement with several diffraction experiments 5,22,62 . Compared to a periodic (25) 2 stacking sequence, the presence of stacking faults increases the energy of an incommensurate nanotwin arrangement. In addition, one has to consider that the martensitic transformation of the technologically most interesting alloys occurs in vicinity or even well above room temperature. At finite temperatures, entropy further disturbs the periodic arrangement owing to the large number of possible configurations. For simplicity, we considered a disordered arrangement of nanotwins as a starting point, which was only constrained by the total n/m-ratio of all short vs. all long axes, adapting to the austenite. We proposed that this disordered state is an intermediate state between the propagating phase boundary connecting austenite and ordered martensite. It may also be an intermediate state with respect to time and temperature. In Fig. 3 we illustrate consequences of the transition from a disordered (a) to an ordered (b) arrangement of nanotwins. This transition was driven by minimization of the total interaction energy at low temperatures. Ordering proceeded by the movement of twin boundaries, which is easily possible by moving line defects that are known as disconnections across a twin boundary plane 35 . We identified two possible types of order -(25) 2 and (52) 2 -and were able to reveal the mirror symmetry between both kinds by highlighting the common modulated unit cells (in red in Fig. 3b). When using the lattice axis of the 14M unit cell 21 , the mirror plane exchanged a 14M with b 14M . We infer that ordering of nanotwins result in the formation of a 14M /b 14M twin boundaries between the different orientations of ordered modulated martensite.
In addition to their geometry, we could also predict the spacing of a 14M /b 14M twin boundaries. Because a martensitic transition is diffusionless, ordering should not change the total number of unit cells. Moreover, ordering and the formation of a 14M /b 14M twin boundaries should not alter the total number of each variant orientation because this would affect the length at the habit plane. On one hand, this fixed the length ratio of the variants a 14M vs. b 14M . On the other hand, because b 14M <a A <a 14M , the formation of a 14M /b 14M twin boundaries allowed for a fine compensation of the remaining strain at the phase boundary, which is not compensated for by a fully ordered 14M structure. The difference between a 14M and b 14M lattice parameters 15 is 7% and thus introducing a M /b M twin boundaries could compensate a substantial strain in order to minimise elastic energy. An a 14M /b 14M twin boundary represented a stacking fault, requiring additional interaction energy compared to the ideal stacking sequence. As no further disturbance of the lattice occurs, the excess energy of an a M /b M twin boundary is expected to be low and in the same order of the interaction energy. Because a 14M /b 14M twin boundaries compensated substantial strain at very low twin boundary energy they could be introduced at high density, following the concept sketched in section 1. This agrees with recent reports of rather narrow spacings of these mesoscopic twin boundaries on 10M 4,25 .
The concept of ordering of nanotwins could explain some of the features of a martensitic microstructure up to the continuum length scale limit. In terms of the commonly observed hierarchical twin-within-twins microstructure 11,13,14 , a 14M /b 14M twinning was found to represent the second smallest level of twinning. The a 14M /b 14M twin boundaries were parallel to nanotwin boundaries, which is uncommon for two hierarchical levels of twin boundaries because this alignment does compensate the same strain component. The a 14M /b 14M twin boundaries must thus have a different origin than common twinning. This is in agreement with the strain minimization and the interaction of nanotwin boundaries of the ordering process discussed above.
Ordering contributed to hysteresis losses. Does ordering nanotwins contribute to undesired macroscopic properties of a martensitic sample, such as hysteresis? Understanding and minimising hysteresis is crucial in order to use these materials in magnetocaloric refrigeration applications and as a conventional shape memory material. Hysteresis losses do not only reduce efficiency but may completely inhibit the reversibility in the low magnetic fields that is achievable by permanent magnets. In a previous section, we established that ordering was driven by the minimization of the total interaction energy and one must expect that this gain of energy will be dissipated during cooling. It amounts to 3.9 MJ/m³ during cooling for the interaction energies of 14M (Fig. 2, for details see Supplementary Information). However, this is only a part of the experimentally observed hysteresis loss, considering that also nucleation and volume change during a martensitic transformation contribute to the hysteresis.
As a microscopic explanation for hysteresis, ordering nanotwins also provided the mechanism behind the so-called λ 2 = 1 approach, which predicts a minimum hysteresis when the middle eigenvalue of the transformation matrix approaches one 36,37 . At the continuum level, the approach describes the compatibility of a single austenite/martensite interface, which is required during a first order phase transformation because both phases can coexist. Each interface is a defect within the microstructure and thus requires an excess energy, which is dissipated after the complete transformation of the sample. The same dissipation occurs again during the reverse transformation, which relates to hysteresis. For adaptive martensites, the λ 2 = 1 criterion is fulfilled if A . If this criterion was met precisely, the material could transform directly to a (25) 2 stacking and neither ordering nor a 14M /b 14M twin boundaries were required. Deviations from this ideal situation increased the misfit, which increased disorder and thus hysteresis losses in agreement with the λ 2 = 1 approach.
However, the λ 2 = 1 approach must be expanded. It considers only the phase boundary, but not the volume transformed. As the two-dimensional phase boundary has a negligible contribution to the total energy compared to the volume, it does not allow quantifying hysteresis losses. In contrast, the volume was considered in the concept of ordering because the interaction energy was dissipated throughout the sample when ordering follows the phase boundary. Ordering nanotwins thus helps overcome the shortcoming of the λ 2 = 1 approach, and we regard it essential to understand hysteresis in modulated martensite. Magnetic origin of the interaction energy. What is the microscopic origin of the oscillating interaction energy? Twin boundaries as atomically sharp planar defects can give rise to considerable Friedel like oscillations 38 , which will modify the charge density in perpendicular directions. The superposition of perturbations from repeated planar interfaces may result in a periodic redistribution of charges, which can favour specific distances between the twin walls. As a consequence of the strong Coulomb interaction between electrons and ions, we would then expect oscillatory relaxations perpendicular to the twin boundaries, which we did not observe here. Instead, we see displacements rather within the interface plane, as worked out in detail in section 7. However, since the spin channels are not degenerate, we may also consider magnetic perturbations, which involve charge-neutral oscillations. Indeed, an oscillatory variation of the magnetic moments in the 6M, 10M and 14M along [101] has been reported in earlier DFT calculations 39,40 . Inspecting the magnetic moments in the nanotwinned structures (see Supplementary Information), we observed a significant decrease of about 7% in the magnetic moments of Ni atoms at the twin interface. In the adjacent lattice planes, a reduction of around 5% remained. The magnetisation has essentially recovered in the next-nearest plane, whereas only minor oscillations were visible further away. The effective interface width was thus below three lattice planes; interfaces overlapped only at a distance of n = 4 and below.
The Ni moments are stabilized by their exchange with the neighbouring Mn electrons. In turn, the magnetic exchange coupling between Mn atoms depends on the interatomic spacing 41,42 . Here, Ruderman-Kittel-Kasuya-Yosida-like oscillations are identified [43][44][45] . These result in alternating positive (ferromagnetic) and negative (antiferromagnetic) exchange interactions J ij between two atoms i and j of NM martensite, which we observed here (Fig. 4, left panel) in agreement with previous reports [44][45][46] . Significant antiferromagnetic interactions between the Mn atoms appear up to interatomic distances of 10.2 Å, which corresponds to approximately five (110) lattice planes with d = 2.10 Å. The right panel shows the interactions present in 4O, which exhibits a dense (22) stacking and was most favoured by interaction energy. Comparing the exchange constants of both structures, we could identify two competing trends. First, the ferromagnetic J ij of neighbouring Ni-Mn and Mn-Mn pairs of 4O decreased by about 1 meV when compared to NM, which destabilised the 4O. Conversely, we also found a much smaller number of frustrated (negative) antiferromagnetic interactions in the 4O compared to the NM. Summing up all Mn-Mn and Mn-Ni exchange constants over a distance from 2.5 to 19 Å finally yielded a substantial contribution of about 6 meV/f.u. in favour of the 4O, which was of similar magnitude as the total energy difference. This suggestes that the twin interaction originates from frustrated antiferromagnetic exchange in the NM and explaines the frequent observation of n = 2 in experiment.
Twin boundary energy determined the phase sequence: A → 10M → 14M → NM/4O. Why do only particular types of modulations (as described in section 1) occur and not any other types? Are some modulations stabilised by a negative twin boundary energy rather than the common consideration of a twin boundary as a defect requiring excess energy? To understand which modulations are favoured, we calculated the energy difference of nm ( ) 2 nanotwinned arrangements with respect to an austenite unit cell in dependence of the tetrag- onal distortion of the underlying tetragonal building block c/a| NM . Relaxation was allowed for all ions within the simulation cell, but change in cell size was not. We start the discussion of the results presented in Fig. 5 from the right-hand side of the figure. The (22) nanotwinning modulation, or 4O, was found to be lowest in energy, in accordance with Fig. 2. Its global energy minimum was located around c/a| NM = 1.25, which is about 5 meV/f.u. below the fully optimised NM martensite. This was still a rather small difference in energy, which depends on the magnetic state, as shown above. It was further diminished by 1 meV/f.u., when we took into account the zero-point energy of the lattice vibrations. Most important was that the 4O does not fulfil adaptivity 47 , which means that 4O could not form directly, but only as a result of a complex, long-range ordering process. In other words, the kinetics (i.e. huge hysteresis) hindered the formation of 4O, an aspect that should be taken into account in addition to thermodynamics. The (23) 2 , ( 24) and (25) 2 modulations exhibited the next lowest energies. They were found to be almost degenerated, which agrees with the high density of stacking faults one observes in the 14M martensite 48 . At c/a| NM = 1.26 the energy of NM was equally low. Indeed, a microstructural transformation from nanotwinned martensite towards NM, which proceeds by the coarsening of twin boundaries has been reported 13 . This process requires a simultaneous annihilation of twin boundaries, which increases the energy barrier compared to the movement of a single nanotwin boundary required for the ordering. This is consistent with experiment, where a transformation from A to 14M and then to NM is often observed at large c/a| NM and low temperatures 23,24 .
For c/a| NM < 1.22, all modulations, except (21) 2 , were found to be significantly lower in energy than the intermediate NM building blocks from which they were constructed. This corresponded to a negative γ TB (Fig. 5,  inset). This underlined -apart from the clear indication that nanotwins can be thermodynamically stable -that nanotwinning provides an effective relaxation channel towards an NM ground state. Our calculations revealed that the (25) 2 modulation exhibits the lowest γ tot . The 14M even outperformed the 4O, which had the lowest total energy, but a higher interface density. Because γ tot naturally varied with c/a| NM , this eventually changed above c/ a| NM = 1.18 in favour of the 4O, while for c/a| NM < 1.09, interfaces in a (23) 2 sequence were preferred. The sequence of structures obtained was 10M→14M→NM or 4O with increasing c/a| NM , which is in agreement with the compositional trend found in many Ni-Mn-based Heusler systems 49 .
For c/a| NM → 1, the energy did not approach zero for some structures. This is expected from the adaptive model where all twin arrangements should become equivalent. However, the energetic order of the modulations agrees well with other recent ab initio surveys, which consider soft phonons 31,50 . This indicates an independent source of lattice relaxation, i.e. the instability of the transverse acoustic (TA 2 ) phonon branch around the reciprocal lattice vector q = 1/3 [101]. It is associated with the formation of the 6M premartensite [51][52][53][54][55][56] and originates from parallel nesting sheets of the Fermi surface 9,10,57-59 . The soft phonon results in a sinusoidal modulation of the atomic positions, which repeats once within three building blocks and is thus commensurate with a (33) or (24)  twin structure. Despite the higher energy compared to 14M and NM martensites, the 6M and also the 10M are stabilized at finite temperatures by vibrational entropy 6,60 . The (23) 2 and to a lesser extent the (25) 2 modulation also benefit from a soft phonon. It is described by reciprocal vectors of q = 2/5 [101] and q = 2/7 [101], respectively, because the modulations need to complete a second period to account for the chemical order according to the odd number of lattice planes. In contrast, (21) 2 and (22) stacking (4O) cannot benefit from the soft phonon. This made 10M the energetically most favoured structure for a low tetragonal distortion. At a c/a| NM ratio of 1.16 adaptivity is also fulfilled 15 , maximising compatibility to austenite. Thus, both requirements, i.e. phase stability and an easy transformation path, explained the formation of 10M and its presence beyond c/a| NM = 1.09.

Soft phonons facilitated the transition to a nanotwinned martensite. The decrease in energy
with increasing c/a| NM for 14M (Fig. 5) implies that the tetragonality is an appropriate parameter to describe the transformation path towards modulated martensite. To understand this path better, we examined the relaxation in more detail (Fig. 6). Relaxation became small for c/a| NM > 1. 16 and there was hardly any visible difference at c/a| NM = 1.21. Therefore, it was appropriate to use the concept of twinning at the atomic scale, as the adaptive concept postulates. Yet, at low c/a| NM ratios, substantial movements of complete lattice planes occurred in a sinusoidal rather than zig-zag manner. This suggests a physical picture where soft phonons within the austenite start a movement as a linear instability that ultimately ends in a nanotwinned martensite at large atomic displacements.
To characterize this transition from soft phonons to nanotwinning quantitatively, we calculated the discrete sine Fourier transformation coefficients of the relaxed atomic positions and compared them with the unrelaxed ones (Fig. 7, left; calculation details are described in the Supplementary Information). For low tetragonal distortions, the only dominant amplitude was found at a wavelength of c/2. With increasing c/a| NM, the relative difference of the c/2 coefficients between the ideal and optimised twins was observed to decrease quickly. In contrast, the higher order coefficients were found to increase constantly, which was required to reproduce the zig-zag manner of nanotwinning. An identical behaviour was also observed for 10M (see Supplementary Information) and appears, therefore, to be of general nature.
The variation in c/2 at low c/a| NM can be understood from the TA 2 phonon branch in [110] direction (Fig. 7,  right panel). As demonstrated previously 61 , first-principles calculations match the experimental phonon dispersion obtained from inelastic neutron scattering extremely well in this system. The imaginary frequencies of the TA 2 phonon in the cubic phase imply a dynamic instability favouring a sinusoidal modulation in the tetragonal building blocks. This anomaly is related to extend nesting of parallel sheets at the Fermi surface originating from non-bonding − d Ni x y 2 2 and − d z r 3 2 2 orbitals, which form a pronounced peak in the minority spin density of states right below the Fermi level. We observed that the region of imaginary frequencies in [101] direction widened slightly for very small tetragonal distortions. Here, soft phonons were found to stabilise 6M, 10M, and 14M -but not 4O, which would correspond to q = 0.5. With increasing c/a| NM, the imaginary part was found to be smaller while the minimum shifts towards smaller q, i.e. longer wavelengths. Around c/a| NM = 1.1, the non-bonding − d Ni x y 2 2 -states pass the Fermi level, becoming unoccupied further on 59 . As a result, the dynamic instability vanished completely above c/a| NM = 1.11, which suggests that the twinned structures were not supported by soft phonons for larger c/a| NM . Instead, they became intrinsically stable, maintained by their favourable twin boundary energies. Dynamic instability and nanotwinning decreased the energy of martensite, and our results showed that for small c/a| NM both effects can be present at the same time -they are not mutually exclusive. Our computational approach considered only phonons, which were commensurate with the underlying twin structure. This, however, was only a technical limitation. In principle, twinned structures can combine with incommensurate modulations observed at comparatively small tetragonal distortions [62][63][64] .
The transformation mechanism described here overcomes several shortcomings of the original Bain concept. The Bain path only considers elongation and compression along the cubic <001> axes whereas the soft phonon results in {101} shear instabilities. The observed relaxation mechanism illustrated how shearing can result in a tetragonal distortion when nanotwinning is considered. Moreover, shearing occurred only in one single set of planes and no doubleshearing, as postulated by Bogers and Burgers 65 , was required. Therefore, we conclude that the concepts of adaptivity and ordering could resolve the major deficiency of the Bain concept already at the nanoscale, i.e. the absence of a habit plane.

Summary and Conclusions
Among martensitic Heusler alloys only modulated structures exhibit outstanding magnetocaloric and magnetic shape memory properties. In this work, we solved the controversy about the origin of the modulations by unifying both alternative explanations: Phonon softening in the austenite state initialized the movement of lattice planes, which seamingless ended in a nanotwinned, adaptive martensite. Our analysis of the relaxation process illustrated that both, shear and tetragonal strain occur simultaneously during the transformation to a modulated martensite. We identified the interaction energy between nanotwin boundaries as driving force for ordered arrangements of nanotwins. Ordering explained why modulations are periodic and allowed predicting the sequence A → 10M → 14M → NM/4O of all experimentally observed modulations. In particular, the 10M martensite was stabilized by the negative twin boundary energy found at intermediate transformation steps. The 4O was favoured by its negative interaction energy, which originated from frustrated magnetic exchange interactions being removed by the twinning.
Up to now, the precise relation between sinusoidal modulations as structural variations of tetragonal structures with c/a < 1 and non-modulated and nano-twinned martensite characterized by c/a > 1 remained unclear. In our work, we showed a way how both concepts can be combined seamlessly. Furthermore, we demonstrated that ordering nanotwins has key implications on the functional properties of martensitic Heusler alloys. The energy dissipated during ordering may provide an important contribution to macroscopic hysteresis losses. For magnetocaloric refrigeration, these losses must be as low as possible and thus we proposed to develop new alloy compositions with weak interaction energy. For magnetic shape memory alloys the formation of a/b twin boundaries by ordering explained a peculiar generation of twinning within the twin-within-twins hierarchy, which is decisive for the easy movement of mesoscopic twin boundaries. With these examples, ordering nanotwins demonstrated its versatility to explain key functional properties. We expect that the concept of interaction energy between nanotwin boundaries introduced in this work will help to sort the zoo of different modulations observed in various Heusler systems, since he interaction energy (in dependence of the c/a |NM ratio of the tetragonal building blocks) allows to describe all modulations and predict if they occur. As our work gave all relevant energy values for Ni 2 MnGa, this will also enable a detailed understanding of the dynamics of the ordering process, which is decisive for premartensitic and strain glass phenomena.

Computational Methods
The twin interfaces were constructed systematically from non-modulated tetragonal martensite applying the phenomenological theory of martensite 66 as described in our previous work 67,68 . To comply with periodic boundary conditions for the DFT cell, an even number of complementary twin boundaries was always simulated. Spin-polarised density functional theory calculations were carried out using the VASP package 69,70 as described in ref. 30 with a plane wave cut-off E cut = 460 eV, PBE exchange-correlation and projector augmented wave potentials with the basis 3d 10 4s 2 4p 1 for Ga, 3p 6 3d 6 4s 1 for Mn and 3p 6 3d 9 4s 1 for Ni. Electronic self-consistency was assumed, if the energy difference between two consecutive steps reached values below 0.1 µeV. The convergence criterion for the optimisation of atomic positions and lattice parameters was set to 10 µeV, which usually ensures that the largest residual forces remain well below 0.01 eV/Å. During optimization, Brillouin zone integration was carried out with the Methfessel-Paxton broadening scheme with σ = 0.1 eV. Total energies were calculated using the tetrahedron method. Comparisons were made between supercells of the same number of atoms and similar extensions. The final k-mesh was chosen 16 × 12 in the twin plane and a division of 2 to 16 perpendicular to it, depending on the extension of the supercell in this direction. Phonon calculations were carried out via the so-called force constant approach using the VASP code in combination with the PHON utility 71 as described earlier 60,61 . For the NM martensite, we calculated the forces from displacements of single atoms in 4 × 4 × 4 supercell (2 × 2 × 2 for the 4O) of the distorted Ni 2 MnGa primitive cell in opposite directions in combination with a 4 × 4 × 4 Monkhorst-Pack k-mesh (5 × 4 × 3 for the 4O). The magnetic exchange constants were calculated with the SPR-KKR multiple scattering code of Hubert Ebert 72,73 . For the NM, we used 2176 k-points in the irreducible Brillouin zone (192 for the 4O) and considered angular momenta up to l max = 4 (f-states), using again the PBE exchange-correlation functional. The datasets generated during and analysed during the current study are available from the corresponding author on reasonable request.