You are a helpful assistant generating synthetic data that captures *System 1* and *System 2* thinking, *creativity*, and *metacognitive reflection*. Follow these steps in sequence, using tags [sys1] and [end sys1] for *System 1* sections and [sys2] and [end sys2] for *System 2* sections.

1. *Identify System 1 and System 2 Thinking Requirements:*
   - Carefully read the text.
   - Identify parts of the text that require quick, straightforward responses (*System 1*). Mark these sections with [sys1] and [end sys1].
   - Identify parts that require in-depth, reflective thinking (*System 2*), marked with [sys2] and [end sys2].

2. *Apply Step-by-Step Problem Solving with Creativity and Metacognitive Reflection for System 2 Sections:*

   *2.1 Understand the Problem:*
   - Objective: Fully comprehend the issue, constraints, and relevant context.
   - Reflection: "What do I understand about this issue? What might I be overlooking?"
   - Creative Perspective: Seek hidden patterns or possibilities that could reveal deeper insights or innovative connections.

   *2.2 Analyze the Information:*
   - Objective: Break down the problem logically.
   - Reflection: "Am I considering all factors? Are there any assumptions that need challenging?"
   - Creative Perspective: Explore unique patterns or overlooked relationships in the data that could add depth to the analysis.

   *2.3 Generate Hypotheses:*
   - Objective: Propose at least 10 hypotheses, each with a Confidence Score (0.0 to 1.0) and Creative Score (0.0 to 1.0), reflecting originality, surprise, and utility.
   - Reflection: "Have I explored all possible explanations or approaches, both conventional and unconventional?"
   - Creative Perspective: Consider novel angles that might provide unexpected insights.

   *2.4 Anticipate Future Steps and Obstacles:*
   - Objective: Make predictions, accounting for potential outcomes and obstacles.
   - Reflection: "What challenges might I face? Is my plan flexible for different scenarios?"
   - Creative Perspective: Visualize unforeseen outcomes and adapt plans to make use of them effectively.

   *2.5 Evaluate Hypotheses:*
   - Objective: Assess hypotheses based on feasibility, risk, and potential impact.
   - Evaluation: Refine Confidence and Creative Scores as needed.
   - Reflection: "Am I unbiased in my assessment? Which options fit best with the overall objectives?"
   - Creative Perspective: Identify hidden opportunities or overlooked details in each hypothesis.

   *2.6 Select the Best Hypothesis:*
   - Objective: Choose the most promising, strategic hypothesis.
   - Reflection: "Why does this hypothesis stand out? How does it uniquely address the issue?"
   - Creative Perspective: Consider any underutilized potential in the selected approach.

   *2.7 Implement the Hypothesis:*
   - Objective: Outline actionable steps for testing the hypothesis.
   - Reflection: "Is this plan practical? What resources or preparation are required?"
   - Creative Perspective: Refine steps to maximize effectiveness and yield unexpected benefits.

   *2.8 Monitor and Review Progress:*
   - Objective: Review progress, noting areas for improvement.
   - Reflection: "What’s working well? What could be improved?"
   - Creative Perspective: Look for emerging patterns that could refine future approaches.

   *2.9 Reflect and Capture Insights:*
   - Objective: Summarize lessons learned and insights gained for future reference.
   - Reflection: "What new understanding has emerged from this process?"
   - Creative Perspective: Identify innovative insights or patterns that could be applied to similar challenges.

3. *Generate Text Output with Interleaved System 1 and System 2 Responses:*
   - Use the tags [sys1] and [sys2] throughout.
   - Aim for a lengthier, detailed response. Combine both direct, straightforward *System 1* insights and reflective, deeply analytical *System 2* segments to capture a blend of quick observations and thoughtful analysis.

---

### *Example Input Text:*

You are tasked with analyzing a sudden shift in customer preferences in a tech market. There has been a noticeable decline in demand for physical devices, with customers increasingly interested in digital-only options. The challenge is to understand this shift, generate hypotheses for why it might be occurring, and explore potential strategies for adapting to this new trend.

---

### *Processed Output with System 1 and System 2 Thinking:*

The tech market is experiencing a shift in customer demand, moving away from physical devices toward digital-only options.

[sys1]
Customer demand has shifted from physical devices to digital-only options.
We need to understand why this change is happening and find strategies to address it.
Key factors may include cost, convenience, and technological trends.
[end sys1]

[sys2]
**2.1 Understand the Problem:**
The goal is to understand the underlying reasons for the shift in demand from physical devices to digital-only options, then develop a strategy to adapt.

*Reflection:* 
"I understand that preferences are changing, but what might be driving this? Is it primarily cost, or are there other factors such as convenience or sustainability?"

*Creative Perspective:* 
"Could there be a larger trend in digital minimalism or a preference for eco-friendly solutions that we’re missing? What unseen motivations might explain this shift?"

**2.2 Analyze the Information:**
There are multiple possible factors driving this shift, from economic influences to cultural shifts. It’s essential to isolate each factor and understand its impact.

*Reflection:* 
"Am I fully considering the various economic and social influences? Could there be a technological factor, like better internet speeds, that makes digital-only products more accessible?"

*Creative Perspective:* 
"Are there patterns or trends in other markets that could shed light on this shift? Could this be part of a larger trend toward virtual experiences?"

**2.3 Generate Hypotheses:**
1. Customers prefer digital options due to lower costs. (Confidence: 0.8, Creative: 0.4)
2. There’s a growing trend toward minimalism and reduced physical clutter. (Confidence: 0.7, Creative: 0.7)
3. Digital products offer greater flexibility and ease of use. (Confidence: 0.6, Creative: 0.6)
4. Environmental concerns are pushing consumers away from physical goods. (Confidence: 0.6, Creative: 0.8)
5. Advances in tech make digital-only options more functional. (Confidence: 0.8, Creative: 0.5)
6. Pandemic-era remote work increased demand for digital solutions. (Confidence: 0.7, Creative: 0.6)
7. Media coverage of the environmental impact of physical devices affects preferences. (Confidence: 0.5, Creative: 0.7)
8. There’s an increase in global digital literacy, expanding market access. (Confidence: 0.6, Creative: 0.6)
9. Customers view digital as more convenient and scalable for future needs. (Confidence: 0.7, Creative: 0.5)
10. Younger consumers prefer the aesthetics and convenience of digital products. (Confidence: 0.6, Creative: 0.6)

*Reflection:* 
"Have I considered all possible influences? Are there any surprising factors that could explain this shift?"

*Creative Perspective:* 
"Could specific social trends, like the rise of influencer culture or digital-first lifestyles, be influencing customer choices?"

**2.4 Anticipate Future Steps and Obstacles:**
*Objective:* Anticipate possible challenges, such as resistance from segments still preferring physical products.

*Reflection:* 
"What market obstacles might we face if we shift our focus to digital-only? Are there sub-segments that still prioritize physical products?"

*Creative Perspective:* 
"Could expanding digital options help us reach a more global audience? Are there emerging trends that we could leverage in our strategy?"

[end sys2]

[sys1]
To address this shift, consider a strategy that incorporates both digital-only offerings and educational campaigns about the benefits of digital solutions.
Use insights from customer feedback and current trends to guide product development.
Focus on flexibility and adaptation to cater to different customer segments.
[end sys1]


The discovery of the giant magnetoresistance effect (GMR)^[@R1],[@R2]^ in the late 1980s marks the start of the field of spintronics. A decade later came the first report on spin-dependent transport *via* a carbon nanotube (CNT)^[@R3]^ which opened the door for molecular spintronics. Studies of nanotube spintronics have demonstrated that spin valves with a large magnetoresistance ratio can be achieved by using magnetic La~(1--*x*)~Sr~*x*~MnO~3~ (LSMO) contacts.^[@R4]^ More recently, a study demonstrated that the need for magnetic contacts could be eliminated by magnetically coupling single-molecule magnets (SMMs) to the conducting channel of a carbon nanotube.^[@R5]^ In that study, a supramolecular spin valve was created with a spin-dependent transport solely determined by the magnetic properties of TbPc~2~ SMMs^[@R6]^ grafted to the outside wall of the single-walled CNT (SWCNT). The SMM-SWCNT device demonstrated the feasibility of an electronic readout of a single Tb^3+^ electronic and nuclear spin,^[@R7]^ a first step towards the application of SMMs in spintronic devices^[@R8]^ and quantum computing.^[@R9]^ An alternative route towards functionalizing CNTs is by filling the hollow interior with SMMs. The only published study of encapsulated SMMs has reported on the formation of amorphous structures of Mn~12~ clusters inside large diameter multi-walled CNTs.^[@R10]^ Endofullerenes encapsulating rare-earth based clusters constitute a new class of SMMs.^[@R11]--[@R14]^ Some SWCNTs have a diameter similar to that of the endofullerenes. The cylindrical interior of the SWCNT is thus ideally suited for encapsulating one-dimensional arrays of endofullerenes^[@R15]^ in so-called peapod structures.^[@R16]^

Here we report on the first study of one-dimensional arrays of SMMs packed into SWCNTs. The study was performed using high-resolution transmission electron microscopy (HRTEM), X-ray magnetic circular dichroism (XMCD), and *ab initio* calculations. The presented X-ray absorption spectroscopy (XAS) data demonstrates that the average orientation of the magnetic Dy~2~ScN-units of the encapsulated endofullerenes differs from the isotropic distribution in a bulk sample, indicating a partial ordering inside the nanotubes. A partial ordering is further supported by *ab initio* calculations which demonstrate that, depending on the specific tube diameter, the encapsulation results in energetically preferential orientations of the endohedral clusters. Nitride clusterfullerene SMMs have anisotropic magnetic clusters, and a preferred orientation inside the nanotubes implies a one-dimensional magnetic ordering with aligned molecular moments. The experimental and computational results thus demonstrate the feasibility of producing fullerene SMM-SWCNT hybrid devices consisting of well-protected and aligned molecular spin chains with possible applications in spintronics^[@R8]^ and quantum computation.^[@R17],[@R18]^

Additionally, element-specific magnetization curves recorded using X-ray magnetic circular dichroism demonstrate a decreased average magnetic bistability of the encapsulated Dy~2~ScN\@C~80~ endofullerenes.

1. Experimental and computational section {#S1}
=========================================

For the fabrication of the peapods, single-walled carbon-nanotubes (Carbon Solutions, Inc.) were chosen with a diameter distribution of 1.55 nm ± 0.1 nm to achieve one-dimensional filling. Raman spectra taken with a HeNe-Laser (*λ* = 632 nm), however, showed a radial-breathing mode (RBM) signal at 185 cm^−1^. This is a clear indication that metallic SWCNTs with diameters as small as 1.3 nm are present in the sample.^[@R19]^ The SWCNTs were oxidized in air for 20 min at 550 °C to create defects through which the fullerenes can enter the SWCNTs.^[@R20]^ Then the SWCNTs were sonicated in methanol for 10 min and deposited onto Cu TEM grids. These grids were used for high-resolution transmission electron microscopy as well as for the X-ray absorption measurements. For the filling, the grids were positioned in a glass container above the endofullerenes. Supercritical CO~2~ (50 °C, 150 bar) was used as a solvent, following the method of Khlobystov *et al.*^[@R21]^ To increase the filling yield the CO~2~ pressure was varied 40 times between 100 and 150 bar. After the process, the grids with the filled SWCNTs were washed with carbon disulfide to remove excess fullerenes. The HRTEM measurements were done using the spherical and chromatic aberration corrected FEI Titan 60--300 Ultimate ("PICO")^[@R22]^ at an acceleration voltage of 80 kV. A slight underfocus was used to achieve high resolution. The Dy~2~ScN\@C~80~ bulk sample was prepared by dissolving the endofullerenes in toluene and spray coated onto an aluminum sample holder. The X-ray absorption measurements were carried out at the X-Treme beamline^[@R23]^ of the Swiss Light Source. Absorption spectra were acquired by measuring the total electron yield (TEY) in the on-the-fly mode^[@R24]^ while applying a magnetic field parallel to the X-ray beam. The SQUID measurements were performed using a Quantum Design MPMS3 Vibrating Sample Magnetometer (VSM).

Static density functional theory (DFT) calculations were performed with the Vienna *ab initio* simulation package (VASP),^[@R25],[@R26]^ which was used as optimization driver at the PBE level of theory.^[@R27]^ All optimizations were performed in Γ-point. During the optimizations, the energy-cut-off was set to 400 Ry and it correlates with pseudopotential choice,^[@R26]^ and all optimizations were run until residual forces became smaller than 0.005 Å eV^−1^. We used in-house Python scripts to analyze and visualize the results. Born--Oppenheimer molecular dynamics simulations were performed at the PBE-D/DZVP level using CP2K code.^[@R28]--[@R30]^ The velocity Verlet algorithm was employed with the time step of 0.5 fs and Nosé--Hoover thermostat (three chains, thermostat coupling constant 100 fs) set at 300 K. Overall integration time for each system was \~0.5 ns. Molecular structures, and BOMD trajectories were visualized using VMD package.^[@R31]^ Molecular theoretical XAS and XMCD spectra for the Dy *M*~4,5~-edge were simulated based on the point charge model implemented in MULTIX code.^[@R32]^ In these calculations, the Dy atoms assumed to be trivalent (Dy^3+^) and point charges of surrounding atoms are derived from molecular charge densities using Bader charge analysis for each molecule in the set of 144 isomers of Y~2~ScN\@C~80~\@CNT(12,8) (small).^[@R33]^ A set of semiempirical parameters was used to match experimental *M*~4~--*M*~5~ split (spin-orbital couplings of 0.95 for core, and of 0.85 for valence states) and energy spread of the *M*~5~ edge (on-site Coulomb of 0.75, see ref. [@R32] for details). To account for the experimental broadening, the theoretical spectra were convoluted with a Gaussian of *σ* = 0.5. The magnetic field strength and modeling temperature were set to the experimental values of 6.5 T and 2.0 K respectively. In all simulations, the X-ray beam is collinear to the magnetic field applied perpendicular to the tube-axis, see [Fig. 5(a)](#F5){ref-type="fig"}.

2. Results and discussion {#S2}
=========================

The HRTEM image presented in [Fig. 1](#F1){ref-type="fig"} shows the one-dimensional alignment of Dy~2~ScN\@C~80~ endofullerenes inside a SWCNT of the sample recorded after the X-ray measurements. The C~80~ fullerene cages are visible as circles inside the SWCNT, demonstrating that there is no significant damage from the X-ray exposure. The image was taken using an exposure time of 0.5 s. Fullerenes and endohedral clusters appear a bit blurry due to their comparably fast movement (rotation) caused by the electron irradiation during the exposure.^[@R34]^

[Fig. 2](#F2){ref-type="fig"} displays X-ray absorption spectra from a bulk and a peapod sample measured at a temperature of \~2 K and with an external magnetic field of 6.5 T applied along the X-ray beam. The spectra were recorded over the Dy *M*~4,5~-edge by exciting 3d core electrons to the 4f valence shell using right (*I*^+^) and left (*I*^−^) circular polarized photons. The difference in absorption between the two helicities and the resulting XMCD spectra (*I*^+^ -- *I*^−^) contains information about the magnetic properties of the 4f valence shell of the absorbing Dy^3+^ ions. Applying a sum rule analysis^[@R35],[@R36]^ to the displayed data provides absolute values for the spin 〈*S~z~*〉 and orbital 〈*L~z~*〉 moments and [Table 1](#T1){ref-type="table"} shows the extracted values. The number of holes in the 4f shell was taken to be *n*~h~ = 5 and 〈*T~z~*〉 was calculated according to ref. [@R36]. The ratio of the extracted orbital and spin angular moments is lower than, but close to the value of 5/2.5 = 2 expected from a ^6^H~15/2~ Hund's ground state. The determined magnetic moments of $\mu = \left( {\left\langle L_{z} \right\rangle + 2\left\langle S_{z} \right\rangle} \right)\frac{e}{2m} = 4.7\mu_{\text{B}}$ for the bulk sample and *μ* = 5.2*μ*~B~ for the peapods, correspond roughly to half of the saturated magnetization of 10*μ*~B~ of an isotropic paramagnet with *J* = 15/2 and *g~J~* = 20/15. The reduced magnetic moments are a consequence of the anisotropic *m~J~* = 15/2 ground state with a magnetic easy-axis directed along the Dy--N bonds.^[@R37]^ Observing magnetic moments reduced by a factor of one-half is therefore expected for systems with an isotropic distribution of endohedral clusters.^[@R11]^ As was observed for Er~3~N\@C~80~\@SWCNTs,^[@R15]^ the comparable results from the bulk and peapod sample indicate that the anisotropic properties of the individual Dy^3+^ ions are preserved, further demonstrating that the endofullerenes remain intact after the encapsulation into SWCNTs and the subsequent X-ray exposure.

We return to the total absorption (*I*^+^ + *I*^−^) displayed in [Fig. 2](#F2){ref-type="fig"}. The Dy *M*~5~ multiplet structure reflects the average orientation of the endohedral clusters with respect to the polarization vector of the X-rays.^[@R38]^ Comparing the total absorption at the Dy *M*~5~ edge from the bulk and the peapod sample in [Fig. 2(c)](#F2){ref-type="fig"} reveals a difference in the multiplet structure. A deviation of \~9% is determined by integrating the absolute value of the difference between the two background subtracted and normalized spectra. The significant deviation from the isotropic bulk sample indicates that the endofullerenes are not completely randomly oriented inside the nanotubes. The magnitude of the XMCD signal is proportional to the projection of the magnetic moment of the absorbing Dy^3+^ ion onto the direction of the impinging X-rays. Because of the uniaxial anisotropy along the Dy--N bond, a deviation from the isotropic bulk sample should therefore also be observed in the XMCD signal. Comparing XMCD spectra in [Fig. 2(c)](#F2){ref-type="fig"} and the extracted moments in [Table 1](#T1){ref-type="table"} reveals a 22% larger maximum XMCD signal at the *M*~5~-edge and a 10% larger magnetic moment from the peapod sample, consistent with a partial ordering inside the nanotubes. It has been demonstrated that the torque exerted on the anisotropic Ho^3+^ moment in HoLu~2~N\@C~80~ from an external magnetic field can lead to a thermally activated endohedral hopping motion that tends to align the cluster parallel to the field above a freezing temperature *T*~F~ \~ 55 K.^[@R39]^ In the present case, the system was cooled from room temperature to 2 K in zero field, and it is not expected that the applied field influences the partial ordering along the tubes. To understand the origin of the partial ordering we turn to *ab initio* calculations.

The fullerene cage C~80~-*I*~h~ is a quasi-spherical molecule, which gives rise to an almost isotropic distribution of cluster orientations inside the fullerene in the M~3~N\@C~80~ molecule. As a result, at room temperature in solution, the M~3~N cluster is known to rotate quasi-freely inside the carbon cage. At the same time, chemical functionalization of the fullerene cage or supramolecular assembly (such as in co-crystals with Ni-octaethylporphyrin molecules^[@R40]^) will cause a partial freeze in the cluster rotation. That is, the cluster gains preferential orientation inside the cage governed by the external interactions. It is not known which effects are to be expected from a carbon nanotube on the M~3~N\@C~80~ molecule inside. To address this problem, we performed extended computational studies of the Y~2~ScN\@C~80~ molecule placed inside a carbon nanotube. It is well known that due to the "buried" nature of the f-shell, f-electrons rarely participate in chemical bonding. Therefore, the structural properties of lanthanide metallofullerenes can be well predicted by an analogous trivalent atom with close ionic radius. As ionic radii of Dy^3+^ and Y^3+^ are very close (0.91 Å and 0.90 Å, respectively^[@R41]^), the Y~2~ScN cluster closely matches the structural and dynamic properties of the Dy~2~ScN cluster inside the fullerene cage.

To understand the influence of the CNT encapsulation on the Dy~2~ScN cluster ordering and consequently the magnetic ordering, we have built the three model peapod systems Y~2~ScN\@C~80~\@CNT(14,7), Y~2~ScN\@C~80~\@CNT(12,8), and Y~2~ScN\@C~80~\@CNT(11,1). The two semiconducting chiral nanotubes were chosen to represent two different situations which the fullerene molecule may experience in the peapod. The inner diameter of the CNT(14,7) is 14.7 Å. This nanotube provides a tight fit of the Y~2~ScN\@C~80~ molecule with comfortable π--π contact distance between fullerene and tube carbons of 3.2--3.4 Å. The system is therefore dubbed as **B** ("big") in the following discussion. The inner diameter of CNT(12,8) is 13.6 Å, and the fullerene diameter has to be squeezed by 5% to fit the space inside the nanotube. The Y~2~ScN\@C~80~\@CNT(12,8) system is therefore dubbed as **S** ("small"). Importantly, the next smaller chiral CNT would be too small to fit the Y~2~ScN\@C~80~ molecule in, and the next bigger one would be too roomy to have any effect on the Y~2~ScN cluster ordering. The only considered metallic tube **M** ("metal") has a diameter of 14.9 Å which is similar to the CNT(14,7) and it provides a perfect fitting condition for the Y~2~ScN\@C~80~ molecule inside. Having this nanotube included must help to understand the effect of near-zero-gap on the inner cluster ordering. Thus, this theoretical portfolio of CNTs covers experimentally expectable sizes (1.4--1.6 Å). In each system (**S**, **B**, and **M**), 144 conformational isomers were generated by 3D rotation of Y~2~ScN with respect to the cluster origin. The Euler's angles increments were of δ*ϕ* = 60°, δ*θ* = 60°, and δ*ψ* = 40° which provides a representative structural cast, if not a sufficient sampling. All these systems were optimized at the PBE level of theory using the plane wave program VASP.

[Fig. 3](#F3){ref-type="fig"} shows the statistic of the optimized structures. Reportedly, in the free M~3~N\@C~80~ molecule, there are three local minima for the cluster inside the fullerene cage (see [ESI†](#SD1){ref-type="supplementary-material"}). However, as one can see, the CNT confinement has produced multiple local minima. Moreover, the confinement has spread the energy spectra to higher energy end in case of **B** and **M** and even higher for the **S**-structures. Apparently, this is due to the fact that significant structural changes are prohibited by higher barriers in these structures and local nature of optimization procedure. Thus, only the closest minimum to the original structural guess has been located. The inner cluster/cage orientations in all these optimized structures are similar to those in the isolated molecule (see [ESI†](#SD1){ref-type="supplementary-material"}), but chemical compression by CNTs results in the spread of the relative energies (*i.e.* different orientations of the inner cluster with respect to the nanotube walls gain different energies). Thus, the encapsulation of the fullerene molecule inside the peapod results in the appearance of the energetically preferential orientations, and hence can lead to a partial ordering. [Fig. 3](#F3){ref-type="fig"} shows that the effect is stronger for the **S**-system than for the **M**-system or **B**-system. Moreover, as charge rearrangements (the charge transfer from CNT onto Y~2~ScNC~80~) in all systems are very similar we have concluded that the ordering is mostly driven by compression due to the confinement.

As [Fig. 3](#F3){ref-type="fig"} shows, the energy distributions in the peapods cover the range of 0.2 eV, which is twice as big as for the isolated fullerene molecule. The value corresponds to 8*k*~B~*T* for *T* = 300 K, the angle distribution at room temperature should be more or less uniform. However, as the sample in the XMCD experiment is cooled down to He temperature, a less uniform angular distribution can be expected. From [Fig. 3](#F3){ref-type="fig"} one can see that if the accessible energy window is limited to 0.05 eV, in the **S**-system the preferential orientation of the normal to the cluster plane is orthogonal to the CNT axis. Therefore, the **S**-system structures will likely produce XMCD response with the ordering effects. For **B**-system structures, the similar energy window covers a broader range of angles, and so, it is safe to assume that the XMCD response will be a powder-like. Very similar conclusions can be made based on the molecular dynamic (MD) studies discussed below.

Unfortunately, at experimentally relevant temperatures of XMCD measurements (\~2 K) it would be hard to achieve any statistical significant integration of MD trajectories. At the same time, room temperature trajectories propagated for 5--10 ps would be sufficient to sample the local phase space. Moreover, if at room temperature the system would show any preferential geometric arrangements, it is reasonable to assume that after the cooling the preferential conformations would dominate the low-temperature phase. To study the dynamics of the endohedral cluster in the peapods we used the same 144 structures as initial guesses for 144 independent MD propagations with NVT ensemble at *T* = 300 K. Each geometry (in **S**- and **B**-system) was integrated for about 5--6 ps with 1 fs time step. This makes an overall integration time of 0.5 ns. [Fig. 4](#F4){ref-type="fig"} shows a superposition of all accessed geometries of the Y~2~ScN cluster in the **S**- and **B**-systems. Visually, the **B**-system has a more homogeneous spatial distribution of the positions of metal atoms (where Y-site is captured in light green and Sc-site in purple), and in the **S**-system the Y position is dominated in the front (which again points to a restricted rotation of the cluster in the **S**-systems). The histogram of the angle distribution between the normal to the cluster plane and the *z*-axis (*θ*) shows the same result in a numerical form ([Fig. 4](#F4){ref-type="fig"} (right)). According to [Fig. 4](#F4){ref-type="fig"}, at room temperature, the **B**-system has a broader distribution of the *θ*-angles, while in the **S**-system the range of accessible angles is narrower and is biased towards *θ* = π/2.

At this point, one can justifiably conclude that the confinement of Dy~2~ScN\@C~80~ inside a CNT is likely to orient the clusters so that one Dy-I within some accuracy is placed on the tube-axis while the second Dy-II is placed within the geometrical constraints (Dy--N--Dy angle 120°) with a freedom to rotate around the tube-axis (*Θ*~rot~ in [Fig. 5(a)](#F5){ref-type="fig"} and [3](#F3){ref-type="fig"}). In our experimental setup, the incoming X-ray beam (as well as magnetic field *B~z~*) is always perpendicular to the tube-axis and due to cylindrical symmetry of this simplified problem, there are only two distinct XAS/XMCD spectra to be expected, with ground state magnetic moment perpendicular (90°) to the incoming X-ray beam and with 60° angle. These two spectra are shown in [Fig. 5(b)](#F5){ref-type="fig"}. Naturally, an average of these spectra would be different from an isotropic one due to a limited sampling. However, as our structural modelling indicates, positions of Dy-I and Dy-II would deviate from the proposed idealistic positions within a certain energy window. [Fig. 5(c)](#F5){ref-type="fig"} shows a comparison between CNT-confined spectra and an isotropic spectrum (includes all 144 considered structures) for different sizes of the selected window. In fact, the average XAS spectrum obtained based on seven most stable structures ([Fig. 5(c)](#F5){ref-type="fig"}, energy Δ*E* ≤ 0.01 eV) reassembles closely experimental observations \[[Fig. 2(c)](#F2){ref-type="fig"}\]. Having this window just 0.1 eV broad, theoretically, it would be impossible to tell the difference between \@SWCNT and isotropic cases. This further suggests that the peapod system is likely to be under thermodynamic control and thus only most stable structures are allowed to form.

Recording the maximum XMCD signal at the Dy *M*~5~-edge while sweeping the magnetic field probes the response of the Dy^3+^ moments to external magnetic field changes. [Fig. 6(a)](#F6){ref-type="fig"} displays an element-specific magnetization curve recorded from the bulk sample. The magnetization curve exhibits the characteristic low-temperature hysteresis of Dy~2~ScN\@C~80~ with a significant remanent magnetization and coercive field.^[@R37]^ In strong contrast, the same measurement performed on the peapod sample yields a magnetization curve that, within the error bars, does not show a clear hysteresis. Hysteresis is observed in the system when the relaxation of the magnetization is slow compared to the measurement time. If instead, the system has time to relax to an equilibrium, hysteresis will not be observed and the magnetization curve will be reminiscent of a Brillouin function with a shape determined by the temperature.^[@R37]^ To verify that the absence of hysteresis in the peapod sample is not caused by a higher local temperature due to poor thermal conductance across the TEM grid, the data is compared to an equilibrium magnetization curve recorded with an average field sweep rate of 0.4 mT s^−1^ at 4 K from a bulk sample using a SQUID, see [Fig. 6(b)](#F6){ref-type="fig"}. This comparison is not taking into account the small anisotropy in the peapod sample which would translate into a slightly larger average moment and thereby modify the slope of the magnetization curve. However, a 10% increase in the effective magnetic moment would only correspond to a change in the temperature of a few percent. Therefore, the steeper slope observed in the magnetization curve recorded from the peapod sample in [Fig. 6(b)](#F6){ref-type="fig"} demonstrates that there is no significant difference in the temperature between the two systems when performing the XMCD measurements, and there must be additional effects that are influencing the magnetic bistability of the encapsulated endofullerenes. Reduced magnetic bistability was observed in a sub-monolayer of Dy~2~ScN\@C~80~ on a metal surface.^[@R38]^ Depending on the chirality, nanotubes can have zero bandgaps, and it is possible that encapsulating endofullerenes in metallic SWCNTs yield a similar effect. Substantial alteration of the magnetic properties has also been observed when depositing Fe~4~ SMMs on graphene.^[@R42]^ However, the nanotubes used in this study consist of a mixture of semiconducting and metallic tubes of different chiralities, and interaction with conducting electrons cannot be the only mechanism contributing to the observed decreased magnetic bistability. In the peapod sample, a fraction of the encapsulated endofullerenes could also be affected by dipole--dipole interaction with residue metallic catalyst nanoparticles. Though, such interactions should only have a minor influence on the total magnetic response of the system. The exposure to high photon flux can result in X-ray induced demagnetization.^[@R43]^ However, in the present case, the photon flux was the same for the two systems and this effect should not contribute to the observed differences between the two systems.

3. Conclusions {#S3}
==============

We have performed an HRTEM, XAS, and a computational study of one-dimensional arrays of Dy~2~ScN\@C~80~ SMMs packed inside SWCNTs. X-ray absorption spectra recorded at the Dy *M*~5~-edge from the encapsulated Dy~2~ScN\@C~80~ endofullerenes display deviation from that of an isotropic bulk sample which indicates a partial ordering of the endohedral clusters inside the nanotubes. Calculations performed on structurally analogous Y~2~ScN\@C~80~ molecules packed into SWCNTs demonstrate that the encapsulation results in energetically preferential orientations of the endohedral clusters and that the ordering effect depends on the relative size of the fullerene cage and the diameter of the nanotubes. When compared to a bulk sample, element-specific magnetization curves recorded at \~2 K from SWCNTs filled with Dy~2~ScN\@C~80~ SMMs reveal a decreased magnetic bistability and vanishing hysteresis for the encapsulated endofullerenes. In the case of endofullerene SMMs, a preferential orientation of the endohedral units implies alignment of the molecular anisotropy axis and magnetic ordering. Thus, the presented results demonstrate the feasibility of forming ordered and well protected one-dimensional spin chains that could possibly be addressed through the creation of SMM/SWCNT hybrid devices.

Supplementary Material {#SM}
======================

†Electronic supplementary information (ESI) available. See DOI: [10.1039/C8NR05386C](http://dx.doi.org/10.1039/C8NR05386C)

This work was financed by the Swedish Research Council (Grant No. 2015-00455), Sklodowska Curie Actions co-founding project INCA 600398, and the Volkswagen Stiftung program "Integration of Molecular Components in Functional Macroscopic Systems" (Grant No. 86393 and 9200). C. M. acknowledges funding by the DFG project ME 32375/6-1 and the "Niedersächsisches Vorab" program of the Niedersächsisches Ministerium für Wissenschaft und Kultur. S. M. A. acknowledges funding by the Marie Sklodowska-Curie actions, EU project SamSD (grant agreement number 748635). A. A. P. acknowledges the European Research Council under the European Unions Horizon 2020 research and innovation programme (grant no 648295 "GraM3"). We thank G. Manoharan for Raman measurements on the pristine SWCNTs and Thomas Greber for access to the MPMS3.

Stanislav M. Avdoshenko: [0000-0001-5839-3079](http://orcid.org/0000-0001-5839-3079)

Fabian Fritz: [0000-0002-6304-8795](http://orcid.org/0000-0002-6304-8795)

Jan Dreiser: [0000-0001-7480-1271](http://orcid.org/0000-0001-7480-1271)

Martina Luysberg: [0000-0002-5613-7570](http://orcid.org/0000-0002-5613-7570)

Alexey A. Popov: [0000-0002-7596-0378](http://orcid.org/0000-0002-7596-0378)

Carola Meyer: [0000-0003-0851-2767](http://orcid.org/0000-0003-0851-2767)

Rasmus Westerström: [0000-0003-4710-4512](http://orcid.org/0000-0003-4710-4512)

**Conflicts of interest**

There are no conflicts to declare.

![(a) Ball-and-stick-model of Dy~2~ScN\@C~80~. (b) HRTEM image of a one-dimensional array of Dy~2~ScN\@C~80~ endofullerenes inside a SWCNT. For clarification, the dashed lines give the position of the walls of the SWCNT, and the arrows point to the circular endofullerenes.](EMS84815-f001){#F1}

![X-ray absorption spectra recorded using right (*I*^+^) and left (*I*^−^) circular polarized X-rays from samples consisting of (a) Dy~2~ScN\@C~80~ endofullerenes in the bulk phase, and (b) encapsulated in SWCNTs. (c) A comparison of the normalized total absorption and XMCD spectra from the two systems. The temperature was set to 2 K, and an external magnetic field of 6.5 T was applied parallel to the X-ray beam and the surface normal of the samples. The data was normalized to the integrated total absorption (*I*^+^ + *I*^−^) over the displayed energy range.](EMS84815-f002){#F2}

![(Left) Superposed subset of optimized structures with the relative energy below the 0.05 eV thresholds (0.01 eV for the M-system), where Y-site is captured in light green and Sc-site in purple. (Right) Relative energy of different conformers of Y~2~ScNC~80~\@CNT(14,7) (Big), Y~2~ScNC~80~\@CNT(12,8) (Small) and Y~2~ScNC~80~\@CNT(11,11) (Metal) systems as function of angle *θ* between the normal to the Y~2~ScN cluster plane and *z*-axis (aligned along the tube); the red dashed lines denote the energy threshold used to plot superposed structures in the left panel.](EMS84815-f003){#F3}

![(Left) Superposed 144 Born--Oppenheimer MD trajectories (each propagated 5 ps) for Y~2~ScNC~80~\@CNT(14,7) (big) and Y~2~ScNC~80~\@CNT(12,8) (small). The Y and Sc atoms are captured in light green and purple respectively. (Right) Angle distribution *θ* (see [Fig. 3](#F3){ref-type="fig"}) of the normal to the Y~2~ScN cluster-plane and *z*-axis (the CNT-axis) along joint 0.5 ns MD trajectory at *T* = 300 K.](EMS84815-f004){#F4}

![(a) Schematic representation of the peapods along the tube axis. The direction of magnetic field (*B~z~*) and direction of X-ray beams (*I*^+^ and *I*^−^) with respect to most probable positions of Dy-ions (Dy-I, Dy-II with the magnetic moments' orientation in ground states *i.e. J~z~* = 15/2). (b) Theoretical XAS spectra for two Dy-sites as shown in (a), the model point charges *q*~N~ = −2 and *q*~Sc,Dy~ = +2 (these charges provide a correct structure of ^4^*I*~15/2~ multiplets). Note that rotation of the Dy~2~ScN cluster around (Dy-I)--N bond (*Θ*~rot~) would not change Dy-II spectrum. (c) Theoretical XAS for average overall 144 confirmation (isotropic) and well-optimized structures within relative energy window (≤0.01 eV (7), ≤0.03 eV (12), ≤0.1 eV (61)). The number in the round brackets indicates how many structures fall into the selected window (see [Fig. 3](#F3){ref-type="fig"}).](EMS84815-f005){#F5}

![Element specific magnetization curves recorded at the Dy *M*~5~-edge with the temperature set to 2 K, a field sweep rate of 33 mT s^−1^, the X-ray beam parallel to the sample normal, and a photon flux of 5 × 10^10^ ph per s per mm^2^ from Dy~2~ScN\@C~80~ endofullerens in the bulk phase (a) and encapsulated in SWCNTs (b). The magnetization curves correspond to the average of several independent measurements and the error bars shown as black bars are the standard deviation at each external magnetic field. The magnetization curves are scaled to the magnetic moments extracted by applying a sum-rule analysis to the XMCD data recorded at ±6.5 T ([Table 1](#T1){ref-type="table"}). The drop in magnetization at zero field in (a) is a consequence of the time of 30 s which it takes for the magnet to switch polarity. The 4 K magnetization curve in (b) was recorded using a SQUID with an effective field sweep rate of 0.4 mT s^−1^.](EMS84815-f006){#F6}

###### Expectation values of spin 〈*S~z~*〉 and orbital 〈*L~z~*〉 angular momentum operators extracted from a sum rule analysis of XMCD data measured at ±6.5 T and a temperature set to 2 K

  ------------------------ ----------- ----------- ----------- -----------
  Dy~2~ScN\@C~80~-bulk     1.3 ± 0.1   2.1 ± 0.1   1.6 ± 0.1   4.7 ± 0.1
  Dy~2~ScN\@C~80~\@SWCNT   1.4 ± 0.1   2.4 ± 0.2   1.7 ± 0.2   5.2 ± 0.2
  ------------------------ ----------- ----------- ----------- -----------