# Issue with Majorana Wavefunction Calculation in a Topological Superconducting System

**URL:** https://itensor.discourse.group/t/issue-with-majorana-wavefunction-calculation-in-a-topological-superconducting-system/2214
**Category:** DMRG and Numerical Methods
**Tags:** mps
**Created:** [January 27, 2025, 5:59pm UTC](https://itensor.discourse.group/t/issue-with-majorana-wavefunction-calculation-in-a-topological-superconducting-system/2214 "2025-01-27T17:59:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ejmukha1](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/ejmukha1/32/681_2.png) [@ejmukha1](https://itensor.discourse.group/u/ejmukha1)
#### Post date: [January 27, 2025, 5:59pm UTC](https://itensor.discourse.group/t/issue-with-majorana-wavefunction-calculation-in-a-topological-superconducting-system/2214/1 "2025-01-27T17:59:56Z")

</div>

Hi,  
I’m trying to plot the Majorana wavefunctions \phi\_i^{1,2} for a topological superconducting system. The wavefunctions are calculated using the following expressions:

\phi\_{is}^{(1)}=e^{i\theta}\bra{1}c^\dagger\_{is}\ket{0}+e^{-i\theta}\bra{0}c^\dagger\_{is}\ket{1}\\ \phi\_{is}^{(2)}=ie^{i\theta}\bra{1}c^\dagger\_{is}\ket{0}-ie^{-i\theta}\bra{0}c^\dagger\_{is}\ket{1}

Where \ket{0} and \ket{1} are the ground and first excited states, respectively.  
I am confident that my DMRG-acquired states are accurate because they satisfy key criteria such as:

- Energy degeneracy: Ground and excited states are degenerate as expected for the topological phase.
- Entanglement spectrum degeneracy: The expected degeneracies in the spectrum are observed.
- Consistency between quantum number conserving and non-conserving methods, which yield the same results.

However, when I attempt to plot \phi\_i^1 and \phi\_i^2, the results are inconsistent with the expected localized wavefunctions at the ends of the chain (fig 3.) , as shown in the paper ([https://arxiv.org/pdf/1104.5493](https://arxiv.org/pdf/1104.5493)). Instead, I get the following plots:

 ![majorana_wavefunctions](https://global.discourse-cdn.com/free1/uploads/itensor/original/1X/a821a4d4b1c45e7291fc7a34bc613b324f1e0fa2.png)

This is the code how I calculate the wavefunctions.

```julia
using ITensors
for i=1:N
    append!(data1,abs(inner(psi1, apply(op("Cdagup", sites, i), psi0))+inner(psi0, apply(op("Cdagup", sites, i), psi1)))^2+
                  abs(inner(psi1, apply(op("Cdagdn", sites, i), psi0))+inner(psi0, apply(op("Cdagdn", sites, i), psi1)))^2)
end

for i=1:N
    append!(data2,abs(inner(psi1, apply(op("Cdagup", sites, i), psi0))-inner(psi0, apply(op("Cdagup", sites, i), psi1)))^2+
                  abs(inner(psi1, apply(op("Cdagdn", sites, i), psi0))-inner(psi0, apply(op("Cdagdn", sites, i), psi1)))^2)
end

```

My question is: Do you think the issue lies in my DMRG calculation or in the post-processing step?

Any advice or suggestions would be greatly appreciated!

Thank you in advance for your help!

---

<div class="post-metadata">

### Author: ![ryanlevy](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/ryanlevy/32/150_2.png) [@ryanlevy](https://itensor.discourse.group/u/ryanlevy)
#### Post date: [January 27, 2025, 7:29pm UTC](https://itensor.discourse.group/t/issue-with-majorana-wavefunction-calculation-in-a-topological-superconducting-system/2214/2 "2025-01-27T19:29:35Z")

</div>

Without looking too closely, I suspect it’s the lack of Jordan-Wigner strings. For an in depth discussion see

> [@Fermion site-type operator \`c\`: \`inner()\` indicates \`c\` on different sites commute](https://itensor.discourse.group/t/fermion-site-type-operator-c-inner-indicates-c-on-different-sites-commute/1851/2):
>
> You should assume that odd numbers of fermion operators will need their strings handled manually (OpSum doesn’t support this yet). Another important thing to note, once you write c1 = op("c", ss[1]), then c1 is an ITensor and has no knowledge of being fermionic as it has no QNs. The strings are handled at an operator level, so OpSum and some of correlation\_matrix can insert JW strings. See the discussion here for some more: [Proper way to construct fermion gates](https://itensor.discourse.group/t/proper-way-to-construct-fermion-gates/172)

You should try inserting `F` operators, see more [here](https://itensor.org/docs.cgi?page=tutorials/fermions)

---

<div class="post-metadata">

### Author: ![ejmukha1](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/ejmukha1/32/681_2.png) [@ejmukha1](https://itensor.discourse.group/u/ejmukha1)
#### Post date: [January 29, 2025, 10:44pm UTC](https://itensor.discourse.group/t/issue-with-majorana-wavefunction-calculation-in-a-topological-superconducting-system/2214/3 "2025-01-29T22:44:32Z")

</div>

Thank you so much for your reply, it solved my issue.

---

<div class="post-metadata">

### Author: ![system](https://global.discourse-cdn.com/free1/uploads/itensor/original/1X/d3072b13e047cd06df7f3981547c0917d940dfa4.png) [@system](https://itensor.discourse.group/u/system)
#### Post date: [February 8, 2025, 10:44pm UTC](https://itensor.discourse.group/t/issue-with-majorana-wavefunction-calculation-in-a-topological-superconducting-system/2214/4 "2025-02-08T22:44:42Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
