I am currently trying to adapt a code working well with Qutip to Quspin to optimize it.
I managed to create what I believe are the same systems with both libraries, but I don't get the same eigenstates.
I suspect it is just written differently, or maybe Quspin doesn't understand the Hamiltonian the same way (it might have to do with the "dims"), but still I don't get it. In the following output, I print $H$ and then the associated ground state with each library: Qutip vs Quspin for the "same" Hamiltonian

Here is my code:

import qutip as qt
import quspin

N = 3
wx = 1

## Qutip

# x Pauli matrix for the particle k
def SX(N,k):
    return qt.tensor(L)

# initialization of Hi

for k1 in range(N):

STi=Hi.eigenstates()[1][0] # recover the ground state vector

print(Hi) # visualize H
print(STi) # visualize the ground state

## Quspin

# basis for H

# preparing H
x_field=[[wx,i] for i in range(N)]

static = [["x",x_field]]
dynamic = []



print(H.todense()) # visualize sparse matrix H
print(STi2) # visualize the ground state

Thank you


1 Answer 1


It turns out Quspin throws the eigenstates a different way than Qutip does.

  • Qutip shows each eigenstate such as Hi.eigenstates()[1][0] is the ground, Hi.eigenstates()[1][1] is the first excited state, etc....
  • Quspin shows them such as H.eigh()[1][0] are the values the first element of the basis takes for the different states, still with increasing energy, H.eigh()[1][1] is for the second element of the basis, etc...

in order to make it work like Qutip, just do H.eigh()[1].transpose()[0] !


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.