Traceback (most recent call last):
File "/Users/rafaeleb/Desktop/question.py", line 64, in <module>
rho1 = rhot.ptrace(0)
File "/opt/anaconda3/envs/qutip-env/lib/python3.9/site-packages/qutip/qobj.py", line 1382, in ptrace
return _ptrace_dense(self, sel)
File "/opt/anaconda3/envs/qutip-env/lib/python3.9/site-packages/qutip/qobj.py", line 2234, in _ptrace_dense
rhomat = np.trace(Q.full()
ValueError: cannot reshape array of size 64 into shape (3,3,3,3)
----------------------------------------
So my question is, can I somehow get the reduced density matrix in a system with a larger number of particles or is this function restricted to the 2-qubit system? See a sample of the code below.
Best regards,
Rafael
----------------------------------------
from qutip import *
import numpy as np
import matplotlib.pyplot as plt
import sys
nb = 2 #total number of bosons
nH = nb + 1 #dimension of each well
a = enr_destroy([nH,nH], excitations = nH) #list of annihilation operators acting on each site with fixed number of excitations
n1 = a[0].dag()*a[0]
n2 = a[1].dag()*a[1]
h1 = n1*(n1-1)
h2 = n2*(n2-1)
U0 = 0.1 #local interaction
t = 1. #tunneling rate
h0 = h1 + h2
h12 = a[0].dag()*a[1] + a[0]*a[1].dag()
H = - t*h12 + 0.5*U0*h0 #full Hamiltonian
e,v = H.eigenstates()
psi0 = enr_fock([nH,nH], excitations = nH, state = (nb,0))
tfinal = 100
steps = tfinal*10
times = np.linspace(0, tfinal, steps)
g1 = 0.
g2 = 0.1
#dissipation operators
lk1 = np.sqrt(g1)*a[0]
lk2 = np.sqrt(g1)*a[1]
#decoherence operators
dc1 = np.sqrt(g2)*n1
dc2 = np.sqrt(g2)*n2
opts = Options()
opts.store_states = True
result = mesolve(H, psi0, times, [dc1,dc2], [n1,n2], options = opts, progress_bar = True)
fig, ax = plt.subplots()
n1exp = result.expect[0]
n2exp = result.expect[1]
dms = result.states
vnelistt = []
for j in range(len(dms)):
print('Density matrix number '+str(j), end='\r')
rhot = dms[j]
vnet = entropy_vn(rhot)
vnelistt.append(vnet)
print(rhot)
rho1 = rhot.ptrace(0)
--
You received this message because you are subscribed to the Google Groups "QuTiP: Quantum Toolbox in Python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qutip+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qutip/371e40e0-b7e6-45cf-bb9d-586e71cd69b9n%40googlegroups.com.