{'fraction_non_alphanumeric': 0.03073392431264906, 'fraction_numerical': 0.007492237771677991, 'mean_word_length': 4.517939168218498, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Spin-polarized edge currents and Majorana fermions in one- and two-dimensional topological superconductors

We investigate the persistent currents, spin-polarized local density of states, and spectral functions of topological superconductors constructed by placing ferromagnetic impurities on top of an s-wave superconductor with Rashba spin-orbit interaction. We solve self-consistently for the superconducting order parameter and investigate both two-dimensional blocks and one-dimensional wires of ferromagnetic impurities, with the magnetic moments pointing both perpendicular and parallel to the surface. We find that the topologically protected edge states of ferromagnetic blocks give rise to spin-polarized edge currents, but that the total persistent current flows in opposite direction to what is expected from the dispersion relation of the edge states. We also show that the Majorana fermions at the end points of one-dimensional wires are spin-polarized, which can be directly related to the spin-polarization of the edge currents of two-dimensional blocks. Connections are also made to the physics of the Yu-Shiba-Rusinov states for zero-dimensional impurities.


I. INTRODUCTION
During the past one and a half decade, topology has come to play an important role in several different but related aspects of condensed matter physics. In 2001, Kitaev proposed that a one-dimensional (1D) spinless pwave superconductor can provide a route towards topological quantum computation, since it can host topologically protected Majorana fermions. 1 A few years later the subject of topological insulators was born, with the essential feature being an insulating bulk and topologically protected metallic interface states inside the bulk gap. [2][3][4][5][6][7][8][9] The close connection between Majorana fermions and the edge states in topological insulators was explicitly made clear through the application of topological band theory to superconductors. 10,11 An early proposal of such a topological superconductor involved interfacing a topological insulator with a conventional s-wave superconductor. 12 This was followed by proposals to construct a related setup using more conventional building blocks, such as s-wave superconductivity, magnetism, and Rashba spinorbit interaction. [13][14][15][16][17][18] This latter approach is particularly interesting because it can physically be realized in many different ways and therefore leaves plenty of room for experimental implementation.
One of the most recent experimental investigations of Majorana fermions involves putting ferromagnetic impurities on top of a superconductor to create a 1D topological superconductor wire, where surface effects give rise to the needed Rashba spin-orbit interaction. [19][20][21] The same setup can also be used to assemble structures such as 2D ferromagnetic islands or blocks, which have attracted attention because of their topologically protected edge states. 22,23 With this particular approach in mind, but also knowing that the system can be implemented in a variety of ways, [24][25][26] we here investigate both block and wire configurations of magnetic moments on top of a Rashba spin-orbit coupled superconductor. To accurately model these systems, we solve self-consistently for the superconducting order parameter.
In particular, we investigate the persistent currents, local density of states (LDOS), and the spectral functions. We recently investigated the current patterns for a magnetic point impurity, 27 providing insight into the properties of the individual atoms in ferromagnetic domains and also connecting to the well-known physics of Yu-Shiba-Rusinov states of magnetic impurities in superconductors. Here, we instead start from the topological band theory of a 2D ferromagnetic block and investigate the resulting edge states, which are shown to be spin-polarized. We then study 1D wires and connect their properties to the 2D blocks, by considering them as blocks with a width of a single site. Specifically, the endpoint Majorana fermions are shown to be spin-polarized with a spin-polarization directly related to that of the edge states of the block. Through this approach we are able to fully elucidate the close connection between the topological states in 2D and 1D, as well as the connection to the Yu-Shiba-Rusinov states in 0D. In addition, we find persistent currents around the ferromagnetic block, which surprisingly flows in opposite direction to what is expected from the dispersion relation of the topologically protected edge states. This apparent contradiction is resolved as the gap-crossing edge states are indeed found to give rise to a current compatible with their dispersion relation, but lower energy quasiparticles are found to produce even stronger counter-propagating currents, a phenomenon known in other superconductors. 28,29 This has important experimental consequences, since physical probes such as superconducting quantum interference devices (SQUIDs), which measure the magnetic field generated from the total persistent currents, will give opposite results to probes measuring transport properties involving only states close to the Fermi level.

II. MODEL
Motivated by the presence of Rashba spin-orbit interaction, s-wave superconductivity, and magnetic impurities in recent experimental setups, [19][20][21] we consider the following Hamiltonian The most essential property of topologically nontrivial systems is the appearance of gapless edge states. In the case of quantum Hall systems, these give rise to persistent currents along the edges, while for topological insulators they instead result in persistent spin-currents. Likewise, topological superconductors have gapless edge states, and it is therefore of interest to investigate the persistent currents in these systems. In fact, we find that a study of these currents help us understand also the spin-polarization of Majorana fermions at the end points of 1D wires. We thus need not only expressions for calculating currents, but the spin-polarized currents for any given spin-polarization axis.
To derive expressions for the currents, we consider the time rate of change of the spin-density operatorρ iσ = c † iσ c iσ : Because we are interested in arbitrary spin directions, the operators have to be understood to be written in the basis of the particular spin direction of interest. If σ is in the direction (θ, ϕ) in spherical coordinates, the operators are related to the operators in the basis of the Hamiltonian according to Now letσ denote the opposite spin direction to σ and defineŜ where the sum runs over all bonds b for which there is a term in the Hamiltonian (for Eq. (1) only nearest neighbor bonds). It is clear from Eq. (4) thatŜ iσ is an onsite source operator which convertsσ-spins into σ-spins. This operator is unrelated to currents and is thus of no further interest here. Next,Ĵ ibσσ is a current operator for σ-spins moving away from site i along bond b, and is from Eq. (5) seen to be responsible for decreasing the number of σ-spins on site i. Finally, alsoĴ ibσσ is responsible for transferring σ-spins away from site i along bond b, but it flips the spin in the process. WhileĴ ibσσ allows us to investigate spin-polarized currents, the total current is obtained by adding all contributions to the current and we are therefore also interested in the operatorĴ ib = σσ Ĵ ibσσ . Here the summation over σ ensures that we add both spin-polarized currents as well as 'spin-flipping' currents, while the summation over σ ensures that we consider the outflow of both types of spins. To be able to represent the current as a vector field, we also construct the on-site current operator by adding the currents along the bonds away from site i into the directed-average vector operatorĴ i = 1 2 b bĴ ib , and similarly for the spin-polarized and spin-flipping currents.
To fully construct the current operators we also need to evaluate the a-coefficients in Eq. (4). This is complicated by the fact that we are interested in spin-polarized currents for arbitrary spin-polarization axes. In addition, the final expressions for the currents are obtained by evaluating expectation values Ĵ i and Ĵ iσσ , where the calculation also needs to be done in the particular basis. A detailed derivation of the method used to calculate currents is provided in Appendix B. In the following we present the current in two complementary ways. First of all, max i | Ĵ i | as a function of the magnetic moment allows us to identify the onset of persistent currents in the material. However, because the maximum is taken over the whole sample, it gives no information about where these currents appear. Therefore, for selected parameters we also show the current vector field.

B. Spin-polarized LDOS
For 1D wires the topologically protected edge states manifest themselves in the form of Majorana fermions. For this reason we are interested in calculating the LDOS for a cut along the wire. As we want to relate the spin-polarization of these Majorana fermions to the spinpolarization of the edge currents of 2D blocks, we are further interested in the spin-polarized LDOS for a given spin-polarization axis. This is calculated using the expression The total LDOS is obtained by adding the spin-polarized LDOS for two opposite spin-polarizations.

C. Spectral function
The edge states of the 2D block also appear in the spectral function. Due to the limited size of the simulated system it is important to single out the contribution to the spectral function coming from the edge states, otherwise bulk states pollute the edge spectrum. We do this by introducing a state classification function C(ν), which is one for every state classified as an edge state, and zero otherwise. We here define a state to be an edge state if more than 50% of its probability amplitude is located inside a region, six sites wide and symmetrically positioned across the boundary. With this definition, the contribution to the spectral function coming from edge states can be calculated as where u νkxσ is the Fourier transform of u νxσ , and u νxσ is the restriction of u νiσ to the y-coordinate at which the bottom of the ferromagnetic block is located.

III. DIMENSIONAL REDUCTION
For a homogeneous bulk it is possible to write the 2D model of Eq. (1) as 14 where This Hamiltonian have been topologically classified and the relevant condition for being in a topologically nontrivial phase is 14,30 where the last equality follows because µ = −4t. Moreover, making the restriction k y = 0 in Eq. (9) and definingμ = µ + 2t, we obtain which describes a 1D superconducting wire oriented along the x-direction, recently intensively studied in e.g. Refs. [17,18,31]. It can easily be confirmed that this model, just like the 2D case, goes through a topological phase transition at |∆| 2 = V 2 z − (2t +μ) 2 . This is one example of a dimensional reduction from two to one dimension, and similar relations play an important role in this work. Note, however, that if the 1D wire is embedded in a 2D surface, this type of dimensional reduction makes little sense physically. First of all, setting k y = 0 corresponds to considering wave-functions that are completely delocalized in the y-direction. Second, a 1D infinite wire is produced by setting V z (i) = V z δ y , not by ignoring the ydirection. A proper dimensional reduction would rather involve integrating out the y-dependence to arrive at an equation of similar form as Eq. (14). This would potentially renormalize the parameters, and the condition for being in the nontrivial phase should then be understood in terms of these renormalized parameters. We explicitly point this out here, because, while we have the strict condition in Eq. (13) to rely on for identifying the topological phase transition of a 2D geometry, we have no such condition for a 1D wire. Instead, we have to rely on a range of consequences, such as the appearance of Majorana fermions and other indicators related to the current, in order to identify the nontrivial phase of the wire.

A. Block with magnetic moments perpendicular to surface
We begin our investigation with a quadratic ferromagnetic block, with the magnetic moments perpendicular to the surface (n =ẑ). In Fig. 1 the maximum value of the current density and the size of the order parameter at the center of the ferromagnetic block is plotted as a function of the Zeeman term, which quantify the strength of the magnetic impurity moments. The condition for being in the topologically nontrivial phase, given in Eq. (13), is fulfilled in the shaded regions. It is clear that the maximum current density is comparatively small in the trivial phase, raises up inside the topologically nontrivial phase, and then falls off as superconductivity is destroyed in the ferromagnetic block. We also plot the spatial distribution of the persistent currents in Figs. 2-4 for the three points marked 1-3 in Fig. 1. For small Zeeman splitting the current flows anti-clockwise along the edge of the block, in agreement with a recent Ginzburg-Landau calculation for a circular disk geometry. 27 Next, in Fig. 3, the persistent current in the nontrivial phase is seen to not only be much larger, but it also flows in the opposite direction to that in the trivial phase. We also note that this current is located mainly inside the ferromagnetic region. Below we show that these currents are related to the appearance of edge states, but surprisingly propagates in the direction opposite to what is expected from the edge state spectrum. However, before we move on to a more detailed study of the currents in the nontrivial phase, which is the main focus of this work, we also say a few  words about the currents in the third region.
We see that the maximum current density remains fairly large even after superconductivity is destroyed in the ferromagnetic block region, and these currents are also located around the edge of the block. Strong edge currents therefore remain even after the superconducting gap has been destroyed, even though it is not possible to motivate their presence using topological arguments for the block region. A few spikes also appear in the maximum current density, and these are due to the formation of vortex-like currents inside the block region, as illustrated in Fig. 4. The exact occurrence of these peaks as a function of the magnetization is dependent on the size of the block and these current patterns result from the  interplay of the Zeeman term, Rashba spin-orbit interaction, and boundary conditions. A complete study of the currents in this regime is beyond the scope of this work, and we here only mention these effects to clarify the properties of the non-zero current in the third region.

Reversed persistent current
Having covered the basic behavior of the currents, we now investigate in detail the current in the nontrivial phase and relate it to the topologically protected edge states. In Fig. 5 we plot the contribution to the spectral function from states classified as edge states for a cut along the lower edge of the ferromagnetic block. The left and the right figure corresponds to the nontrivial phase that occurs for negative and positive Zeeman term, re-spectively. It is clear that the edge states have opposite dispersion, in agreement with the two phases having opposite Chern numbers. We now note that the slope of the edge state in panel (2) of Fig. 5 implies that the edge state has a propagation direction to the right, since v ∼ dE/dk. However, this is in contradiction to the direction of the persistent current plotted in Fig. 3, which flows to the left along the lower edge.
The apparent contradiction is resolved once the contribution to the current from the edge states is singled out. In Fig. 6 we plot the contribution to the current from eigenstates with energy in the narrow interval −0.1 < E < 0 around the Fermi level, and the current is seen to flow in opposite direction to the total current in Fig. 3. The somewhat unexpected conclusion is therefore that the persistent currents flows in opposite direction to the current carried by the topologically protected gapcrossing edge states. This have important experimental consequences as the measured current direction will depend on the physical probe used. If for example a SQUID is used to measure the magnetic field generated by the total persistent current, the current will be found to flow in opposite direction compared to the dispersion of the edge states. On the other hand, any transport measurement relying on excitations close to the Fermi level will find a propagation direction in agreement with the edge state dispersion.
The reason for the reversed flow of the persistent currents compared to the edge state currents can be understood by considering why an ordinary bulk is free from persistent currents. This is not due to zero contribution to the current from individual charge carriers, but rather because the sum of all such contributions cancel each other out. The total current carried by the system is obtained by integrating the product of the occupied charge carriers charge and velocity: Here the first step follows because the charge of each quasiparticle state is the same, while the second step follows because the spectrum is continuous and periodic in k. Neither of these assumptions are true at the edge of a topological superconductor. First of all, a branch in the spectral function which crosses the Fermi level an odd number of times cannot be described by a simultaneously continuous and periodic spectrum. Second, the quasiparticles in a superconductor are mixtures of electrons and holes and do not all carry the same charge. Considering the persistent current carried by the edge states, we now note that only half of the branch corresponds to occupied states. Further, the occupied edge states are strong mixtures of electrons and holes because they are close to the Fermi level. The total current carried by this band is therefore much smaller than what would be expected if the band corresponded to a fully occupied electron band. It is this lack of occupied electron states associated with the gap-crossing band which fails to cancel the counter-propagating currents coming from the low energy states. This phenomenon of total currents  adding up from contributions of quasiparticle currents of states "inside the gap" and deep states that contribute to overall condensate flow is known in unconventional superconductors and superfluids. 28,29 2. Spin-polarized current Next we study the spin-polarization of the currents. In particular, the x and y spin-polarization axes are of interest because the Rashba spin-orbit interaction couples these axes differently to the momentum. In Fig. 7 we plot the total spin-polarized current as well as that carried by eigenstates in the energy interval −0.1 < E < 0 for spins polarized along the x-axis. The spin-polarized currents for y-up, x-down, and y-down spins are identical to these under a spatial rotation of π/2, π, and 3π/2, respectively. It is clear from Fig. 7(a) that strong spin-polarized currents flow through the block, but the total current in the bulk cancels, since the spins polarized along the negative x-axis flow in opposite direction. However, in the edge regions the two currents flow in the same direction and, together with the 'spin-flipping' currents, these gives rise to the total edge currents in Fig. 3.
We also note the partial depletion of x-up spin currents towards the right end of the block in Fig. 7(a). The picture is radically different in Fig. 7(b), where only contributions to the currents from states close to the Fermi level are included. Here, the x-up spins are located on the right side, and with a similar argument to that in Sec. IV A 1, we can understand the depletion of the total x-up spin current in Fig. 7(a) as a partial, but incomplete, cancellation by the states close to the Fermi level.
It is clear from both the total current in the bulk region and the edge currents in Fig. 7(b) that x-up spins favor motion along the positive y-axis. This can be understood as a consequence of the presence of Rashba spinorbit interaction. The Rashba spin-orbit interaction couples momentum and spin through k × σ, which leads to spin-momentum locking for the currents. 27 This spinmomentum locking and localization of different spins on different edges are, as we will discuss next, also important for understanding 1D wire systems.

B. Wire with magnetic moments perpendicular to surface
We now move on to an investigation of a 1D wire with the magnetic moments still perpendicular to the surface, which corresponds to the 1D model in Eq. (14). As explained in Sec. III, we no longer have a simple condition, such as Eq. (13), to rely on to identify the topological phase transition, because the system is embedded in a 2D surface rather than being truly 1D. However, we find that this present little problem since we have several other means to identify the nontrivial phase.

Partial gap collapse and topological phase transition
In Fig. 8 we plot the maximum current density and the value of the order parameter at the midpoint of a wire. First of all, we note that compared to Fig. 1 the horizontal axis has been rescaled and, compared to the block, a roughly twice as strong magnetization is required to suppress superconductivity on the wires sites. A similar calculation for a point impurity reveals that the magnetization has to be about four times as large as as that of the block geometry in order to destroy superconductivity. This can be understood from the fact that each edge site in a block is connected to a single nonmagnetic superconducting site, while each site in the wire and for the single impurity is connected to two and four such superconducting sites, respectively.
Next, we note that the partial collapse of the order parameter in itself does not imply a topological phase transition, even though we numerically always see these The current pattern is related to the spin-polarized current for y-up, x-down, and y-down spins by a spatial rotation of π/2, π, and 3π/2, respectively.  Fig. 1, but for a 1D wire along the x-axis and magnetic moments along the direction n =ẑ. The topologically nontrivial phase is identified using the discontinuous onset of strong edge currents as well as the appearance of Majorana fermions. occurring at the same time. There are, however, good reasons for why these can be expected to occur at the same time. First of all, the topological phase transition occurs when ∆ and V z are related according to an expression similar to Eq. (13), even though we can no longer rely on the last equality sign or the exact values of t and µ. The inequality is clearly valid when making the Zeeman term large enough, but also if the order parameter is small enough. A sudden drop in the order parameter will therefore likely induce the topological phase transition. Thus, assuming no a priori knowledge of the value of ∆ at which the transition occurs, the likelihood of the transition to occur is proportional to the size of the drop in the order parameter.
An even stronger argument for why the two phenomena should occur in tandem can be made if we instead consider the drop in the order parameter to be induced by the topological phase transition. This relies on the fact that a topological phase transition is fundamentally related to the interchange of energy levels across the Fermi level, also known as a band inversion. Because the order parameter is calculated using eigenstates below the Fermi level, the value of the order parameter can be expected to experience discontinuous changes each time a pair of eigenstates are interchanged across the Fermi level. Moreover, because the size of the order parameter in turn affects the eigenstates, this has enhancing feedback effects, which are only captured in fully self-consistent calculations such as those performed here. Discontinuous changes in the order parameter and the topological phase transition are therefore intimately tied to each other. We note that this is closely related to the physics of single magnetic impurities. The associated Yu-Shiba-Rusinov states, which in non-self-consistent calculations cross the Fermi level continuously, cross discontinuously in self-consistent models because of the feedback effect of the occupation numbers of these states on the order parameter. 27,32

Signatures of nontrivial topology
So far we have discussed the relation between the collapse of the gap and the topological phase transition, arguing that there are strong reasons to expect them to occur at the same time. We have also mentioned that they always occur at the same time in our calculations, but so far not said what signatures we have used to identify the topological phase transition. The first signature is the strong peak in the maximum current density in Fig. 8. Just like for the square block, the onset of the peak is also associated with a reversal of the direction of the persistent current, as can be seen in Fig. 9. Most important though, this is also the point where Majorana fermions appear at the end points of the wire, as shown in Fig. 10. The Majorana fermion nature of these zeroenergy states have been confirmed by checking that they appear as locally non-degenerate Bogoliubov-de Gennes quasiparticles.

Majorana spin-polarization and block edge currents
An interesting feature of the Majorana fermions seen in Fig. 10  If the edge is made infinitely long the spectrum is continuous, but for any finite length, the spectrum becomes discrete. For a 1D wire placed along the x-axis, the Majorana fermion at its end point can be understood as the single state that remains when the length of the y-edge becomes a single site.
a 2D ferromagnetic block. In Fig. 7(b) it was shown that the contribution to the x-up polarized current coming from states close to the Fermi level is located on the right edge. This is in complete agreement with the x-up polarized Majorana fermion localized on the right end of the wire. This demonstrates the intimate connection between the topologically protected edge states of a 2D and 1D system. The connection between edge states and Majorana fermions can be made even clearer by considering the edge states plotted in Fig. 5. For simplicity of argument, we first consider an infinite ferromagnetic strip rather than a square block and let the infinite dimension be along the y-direction. On each of the two edges one spectral branch cuts the Fermi level, one of which is schematically depicted in the leftmost picture of Fig. 11. Next, consider the y-dimension wrapped around a cylinder, such that it is still translationally invariant but with finite length. This results in a discretization of the spectral function as shown in the middle picture of Fig. 11. By finally making the cylinder small enough such that the y-direction consists of a single site, a 1D wire with a single Majorana fermion at each edge results, as depicted to the right in Fig. 11. This procedure closely resembles the dimensional reduction performed in Sec. III, and explicitly shows the close relation between Majorana fermions in 1D and edge states in 2D. However, this dimensional reduction does not, just like that performed in Sec. III, correspond to the actual physical situation. This is important to recognize because it might otherwise give the false impression that it is enough to discretize the edge spectrum to obtain a localized Majorana fermion. After all, the state at E = 0 in the middle panel of Fig. 11 is also a Majorana fermion.
The reason why the relation between the 2D block and the 1D wire is slightly more complicated is that the two x-edges, which can be treated completely independent for the infinite strip, is joined by two y-edges. The spectral branches of the different edges therefore join into one single branch with eigenstates delocalized over the whole boundary. In particular, the Majorana fermions that otherwise would have existed at the right and left edge over-lap and hybridize. It is only once the y-dimension becomes small enough, such that the two y-edges start hybridizing and thereby gaps out the spectrum along these edges, that the two x-edges becomes independent of each other. It is therefore clear why it is not enough to have a discrete spectrum, such as for a block with finite edge length, to obtain localized Majorana fermions, and why a (quasi-)1D wire is required in spite of the close connection between the two systems.

C. Block with magnetic moments parallel to surface
Having investigated magnetic moments perpendicular to the surface, we now turn to a ferromagnetic block with the magnetic moments pointing along the x-direction (n =x). This system does not have a topologically nontrivial phase, but is of interest because of its relation to the corresponding 1D wires.
In Fig. 12 we plot the order parameter and maximum current density. Interestingly, a strong peak is observed also in this case, even though there is no topological phase transition. However, the build up of the peak is not discontinuous as in the previous cases. Instead, the maximum current density is sizable already before superconductivity starts to collapse in the ferromagnetic block. In fact, it is not only the maximum current density that is large, but also the total persistent current. This is clear from Fig. 13, where it is seen that the current flows through the whole sample, rather than being limited to the boundary of the ferromagnetic block. A similar behavior is predicted using a Ginzburg-Landau model in Appendix A.
The current flowing through the bulk region of the ferromagnetic block can be understood as a consequence of x-up and x-down spins moving in opposite direction because of spin-orbit interaction, similar to what was seen in Fig. 7. The addition of a Zeeman term in the x-direction creates an imbalance between the two spinspecies and thereby also a total current through the sample. The current continues to increase until the ferromagnetic region enters the normal state. The peak in the total current density is therefore not due to a sudden onset of new physics, but rather because the continuous build up of current comes to an end as superconductivity is destroyed. We also note that the region following the partial collapse of the order parameter and up is complicated by the presence of vortex like currents inside the ferromagnetic bulk region. See for example Fig. 14 Fig. 10, but for ferromganetic wire magnetized along the wire (n =x and wire alonĝ x). Note that the Majorana fermions are spin-polarized along the z-axis rather than the x-axis.

D. Wire with magnetic moments along wire
We now consider a wire with the magnetic moments along the wire. This is the dimensional reduction of the block in the previous section, where the width of the block has been set to one along the y-direction. This system can, just like the wire in Sec. IV B, be described by a Hamiltonian of the form in Eq. (14), if the substitution σ z → σ x is made. This substitution presents no problem because the two Pauli matrices in Eq. (14) remain orthogonal, and the topological properties therefore remain the same. It is in fact appropriate to think of the substitution as a rotation of spin indices around the y-axis; σ x , σ z → −σ z , σ x . In Fig. 15 we plot the LDOS and spin-polarized LDOS using the z-axis as spinpolarization axis. It is clear that the Majorana fermions spin-polarization that previously showed up in the xcomponent is now present in the z-component. Moreover, direct comparison to Fig. 10 reveals that the x-up component goes into the z-down components and vice versa, exactly as implied by the rotation of spin-indices.
Finally, the maximum current density and the value of the order parameter at the wires midpoint are shown in Fig. 16. The strong discontinuity in the maximum current density is correlated with the appearance of Majorana fermions. We also mention that the current pattern for the wire closely resembles that for the ferromagnetic block in Fig. 13. The current flows through the wire perpendicular to the direction of the wire, and the two patterns are so similar that we refrain from showing it in a figure of its own.  Fig. 1, but for a ferromagnetic wire magnetized along the wire (n =x and wire alongx). The topologically nontrivial region has been identified using the discontinuous onset of strong edge currents, as well as the appearance of Majorana fermions.  Fig. 1, but for wire with in-plane magnetization perpendicular to wire (n =x and wire alongŷ).

E. Wire with in plane magnetic moments perpendicular to wire
The final setup we consider is a wire with in plane magnetic moments perpendicular to the wire. Similarly as above, this system can be obtained by making the width of the ferromagnetic block in Sec. IV C equal to one in the x-direction. However, because the dimension is reduced in a different direction, the substitution of Pauli matrices needed to obtain an effective equation of the form in Eq. 14 is different. This time the substitution k x , σ y , σ z → k y , −σ x , σ x is required, and the two Pauli matrices for the spin-orbit and Zeeman term become the same. The consequence is that the system has no topologically nontrivial phase, and no Majorana fermions appear. The maximum current density and order parameter at the midpoint of the wire is presented in Fig. 17.

V. SUMMARY
We have studied ferromagnetic impurities on top of a conventional s-wave superconductor with Rashba spinorbit interaction. We find a close relation between the topological properties of 2D blocks and 1D wires of the ferromagnetic impurities, as well as the physics of Yu-Shiba-Rusinov states of 0D point impurities. 27 When the magnetic moments are directed perpendicular to the surface, both the 2D block and 1D wire has topologically nontrivial phases. For a 2D block the nontrivial phase gives rise to spin-polarized edge currents. Interestingly, the total persistent current flows in opposite direction to the current contribution from the topologically protected gap-crossing edge states. This means that different experimental probes will observe different current directions, depending on if they measure the total persistent current or only that carried by low-energy excitations. The Majorana fermions that appear at the end points of 1D wires are spin-polarized, and their spin-polarization direction are directly related to the spin-polarized edge currents of the 2D block. The spin-polarization of the Majorana fermions is along the direction of the wire.
When the magnetic moments are parallel to the surface the ferromagnetic block does not have a topologically nontrivial phase. However, 1D wires can still have a topologically nontrivial phase, depending on if the wire is aligned with the magnetic moments or not. When the wire is parallel with the magnetic moments, a topologically nontrivial phase exist and the corresponding Majorana fermions are spin-polarized along the z-axis. For both the ferromagnetic block and the two wire directions, a substantial amount of current flows through the bulk, as long as superconductivity is present in the ferromagnetic region.

Appendix A: Ginzburg Landau approach
To complement the self-consistent calculations on a lattice, we here also provide the results of a Ginzburg-Landau (GL) treatment. The GL method gives an approximate description of the system, but is unable to capture microscopic details such as spin-polarization, edge states, density of states etc.. Nevertheless, it may be interesting to compare the GL results with the exact numerical diagonalization discussed throughout the paper. We consider the following dimensionless GL free energy functional Here, ψ(r) describes the superconducting order parameter in a 2D box, i.e. r = (x, y) and −L/2 < x, y < L/2, where L = 1. The magnetic block of size d = 0.3L is placed in the center with the magnetization along the x axis, i.e. S(r) = Sx for −d/2 < x, y < d/2. The ferromagnetic vector S is analogous to the Zeeman term V z used throughout the main text. The first term in Eq. (A1) is conventional and favors the superconducting order at |ψ| = 1, whereas the second term describes the diamagnetic Pauli energy disfavoring superconducting order. The superconducting order is destroyed when the Pauli energy exceeds the the superconducting condensation energy (the so-called Chandrasekhar-Clogston limit), which occurs for S > S p = 1 in Eq. (A1). In order to smoothly interpolate the Pauli term between the superconducting and metallic phases we introduced a sigmoid function Note that g ψ ≈ 1 (0) in the absence (presence) of the superconductivity, i.e. if ψ ≈ 0 (ψ = 0). To avoid possible spurious numerical effects, we also add a boundary term with a large coefficient a(r) ∼ 100, which destroys superconductivity at the boundary of the 2D box. The terms on the second line of Eq. (A1) describe the kinetic energy. The term proportional to b = 0.0001 describes the conventional superfluid kinetic energy, which defines the characteristic coherence length ξ ∼ √ b = 0.01. The last term, proportional to c = 0.003, describes the magnetoelectric coupling 27 between the current and magnetization S.
We search for the minimum of the free energy (A1) numerically. We employ the gradient descent method in which the order parameter evolves in imaginary time τ δψ = 0, which, thus, minimizes the free energy.
In Fig. 18 we plot the order parameter magnitude |ψ|, phase Arg |ψ|, and the current The panels in the top (bottom) row correspond to the field S = 0.9 (S = 2), which is below (above) the Pauli limit S p = 1. For the smaller field (top row), the superconducting order |ψ| is uniform, whereas the superconducting phase is non-uniform and is distributed in such a way that the total current is continuous. In contrast, for the large field (bottom row), the superconducting order is destroyed in the region covered with the ferromagnetic block. The superconducting phase is strongly uniform outside the ferromagnetic block. The current is suppressed everywhere, except in small vicinity of the ferromagnetic block.
In general, the GL modeling agrees qualitatively with those discussed in Section IV C: the current grows linearly with the magnetic field until superconductivity is destroyed. At the same time, we are not able to capture the non-linear peak of the current shown in Fig. 12 as well as the appearance of the vortex structure in Fig. 14. flipping currentĴ b σσ on b, which together satisfies To derive these operators, we need to find a certain set of coefficients a λλ κκ s+b,η,s,η .

B 4: Arbitrary basis
General expressions are derived for how to calculate the a λλ κκ s+b,η,s,η coefficients in an arbitrary basis from the knowledge of those same coefficients in the basis of the Hamiltonian.

B 5: Calculate sink-sources and currents
Expressions for the expectation values of the sinksource and current operators are derived.

B 6: Summary of method
An algorithmic summary of the method is provided.

B 7: Tabulating relevant a's
The exact number of a λλ κκ s+b,η,s,η that needs to be evaluated in the basis of the Hamiltonian are determined, and a useful way of tabulating them is introduced.

B 8: Evaluating tables
Tables are evaluated for the following types of terms in the Hamiltonian: chemical potential, kinetic, Zeeman, and Rashba spin-orbit interaction. The total table for a Hamiltonian containing all these terms is also provided.

B 9: Note on superconductivity
It is shown that the introduction of an s-wave superconducting term in the Hamiltonian does not modify the method described in the rest of this appendix.

Notation
Here we introduce useful notation and show relations which will be important later on. This section is purely algebraic, and no physical motivation will be provided. The usefulness of the expressions will only become clear once general currents are treated in Section B 3.

Consider a general quadratic Hamiltonian
where Here i, j are site indices, λ, λ are spin indices, and α is an index distinguishing between different terms in the Hamitlonian such as kinetic, chemical potential, Zeeman, etc..
We now consider expressions of the form The summation in the last expression is said to run over all bonds b connected to site s, where a bond between site s and s + b is said to exist if the Hamiltonian contains a product of creation and annihilation operators with these two indices. In particular, the set of bonds has to be understood to include the bond between a site and itself if any on-site terms are included in the Hamiltonian. Using Eq. (B4), it is possible to decompose the commutator for the complete Hamiltonian as Defining a λλ κκ i,η,j,η =δ λη δ κ η δ λ κ  In Eq. (B6) explicit expressions for how to calculate a λλ κκ iηjη were provided. It will also be useful to have a way of extracting coefficients from a general quadratic expression, also when the explicit expression for these coefficients are not known. To this end we consider a general quadratic expression where µ and ν are some arbitrary set of indices. It is clear that Applying this to Eq. (B10) we can for b = 0 write 0|c s+b,η i H, c † sκ c sκ c † sη |0 = λλ a λλ κκ s+b,η,s,η = a ηκκκ s+b,η,s,η , while for b = 0 we have 0|c sη i H, c † sκ c sκ c † sη |0 =a ηκκκ s,η,s,η + a η κ κ κ * s,η ,s,η , (B16) which can also be written as if η = κ and η = κ , a ηκκκ sηsη if η = κ and η = κ , a η κ κ κ * sη sη if η = κ and η = κ , a ηκκκ s,η,s,η + a η κ κ κ * s,η ,s,η if η = κ and η = κ . (B17)

Generalized current operators
With the notation introduced in the previous section, we are now ready to formulate the problem in a way that eventually will allow us to calculate spin-polarized currents in any given basis. To this end we consider the local density operator for particles of spin σ on site s, which can be written asρ sσ = c † sσ c sσ . The time rate of change of this operator is The right hand side of this expression is of the form considered in the previous section, and we therefore know from Eq. (B10) that it can be written as dρ sσ dt = bλ a λσσσ s+b,λ,s,σ c † s+b,λ c sσ + a λσσσ * s+b,λ,s,σ c † sσ c s+b,λ = a σσσσ s,σ,s,σ + a σσσσ * s,σ,s,σ c † sσ c sσ + aσ σσσ s,σ,s,σ c † sσ c sσ + aσ σσσ * s,σ,s,σ c † sσ c sσ + b =0 a σσσσ s+b,σ,s,σ c † s+b,σ c sσ + a σσσσ * s+b,σ,s,σ c † sσ c s+b,σ aσ σσσ s+b,σ,s,σ c † s+b,σ c sσ + aσ σσσ * s+b,σ,s,σ c † sσ c s+b,σ , whereσ is the opposite spin of σ. In the last step the on-site terms have been singled out of the expression, and the remaining sum over the bonds have been divided into one part free of spin-flips, and one involving spinflips. Using Eq. (B11) we can further conclude that the first term is zero. The next two terms converts σ-and σ-spins into each other on-site. When considering the density of a single spin species such as σ, these terms therefore acts as sink and source terms, respectively. We therefore define the sink-source operator on site s aŝ therefore that the a coefficients in the expansion of the commutators on the right hand side have been evaluated. We denote these coefficients by a capital A, to distinguish them from the a coefficients in the expansion in the basis of the expression on the left hand side. We will now show how a coefficients in any basis can be calculated from a knowledge of the A coefficients. To this end, we remind ourselves that we in fact are only interested in calculating the three a's in Eq. (B24). Further, using Eq. (B15) and (B17), these can be written as aσ σσσ s,σ,s,σ = 0|c s,σ a σσσσ s+b,σ,s,σ = 0|c s+b,σ aσ σσσ s+b,σ,s,σ = 0|c s+b,σ The two last expressions can be simplified straightforwardly by using Eq. (B15) and then summing over indices appearing in δ-functions in Eq. (B6), which gives a σσσσ s+b,σ,s,σ = κκ κ b * κ |b κ | 2 b κ A κ κκκ s+b,κ ,s,κ , aσ σσσ s+b,σ,s,σ = κκ κ b * κ |b κ | 2b κ A κ κκκ s+b,κ ,s,κ .
The on-site term is slightly more complicated due to the special cases in Eq. (B17): Here also the expectation values on the right hand side have been expanded in the basis of the Hamiltonian, which is indicated by the subscript H. Using that c † sκ c s+b,κ = c † s+b,κ c sκ * , this can finally be written