Dear all,
I am a complete newb to the coding and programming world and I pre-apologize for my (probably stupid) questions!
I am trying to reproduce the Tavis-Cummings model (M equal 2-level atoms coupled to a single-mode cavity in resonance + dissipation) with the ambition to write a versatile code able to address both individual and collective atomic dynamics.
I am having problem with the tensor product building the matrix representation of the Hamiltonian. As I would like to choose an arbitrary M, I tried with a for-loop for the operators in the composite Hilbert space but when i try to build the collective dipole operator Jm and the sum of sigmap()*sigmam() for all M atoms I end up in the "incompatible Qobj.dims" error.
------------------
# SYSTEM PARAMETERS #
M = 5 # number of atoms
N = 2 # number of cavity fock states
w = 1.0 * 2 * pi # cavity frequency = atom frequency
g = 0.5 # coupling strength, equal for all atoms
pump = 0.05 # atom excitation rate
gamma = 0.05 # atom dissipation rate
kappa = 0.05 # cavity dissipation rate
# OPERATORS #
sm_list = [] # list of M sigmam() operators in the composite Hilbert space
spsm_list = [] # list of M sigmap()*sigmam() operators in the composite Hilbert space
for j in range(1,M+1):
a = 2**(j-1)
b = 2**(M-j)
smj = tensor(qeye(a), sigmam(), qeye(b), qeye(N))
sm_list.append(smj)
spsmj = smj.dag()*smj
spsm_list.append(spsmj)
spsm = sum(spsm_list)
Jm = sum(sm_list) # collective dipole operator
a = tensor (qeye(2**M), destroy(N))
# HAMILTONIAN in RWA #
H = w * a.dag() * a + w * spsm + 1j * g * (a.dag() * Jm + a * Jm.dag())
# DISSIPATION: collapse operators #
c_ops = []
# leakage from the cavity
rate = kappa
if rate > 0.0:
c_ops.append(np.sqrt(rate) * a)
# ALL atom relaxation:
decay_list = [] # list of M Lindblad terms relative to spontaneous emission
rate = gamma
if rate > 0.0:
for j in (sm_list):
decay_list.append(np.sqrt(rate) * j)
c_ops.append(sum(decay_list))
# ALL atom pumping:
pump_list = [] # list of M Lindblad terms relative to the pumping
rate = pump
if rate > 0.0:
for j in (sm_list):
pump_list.append(np.sqrt(rate) * j.dag())
c_ops.append(sum(pump_list))
# DYNAMICS: Lindblad master equation solver ? #
psi0 = tensor(??) # initial state
tlist = np.linspace(0,25,1001)
output = mesolve(H, psi0, tlist, c_ops, [])
------------------
these are my questions:
0. from the computational point of view, does it make sense to deal with an arbitrary big number of subsystems or is more convenient to write different scripts for fixed values of M?
1. can I (re-)define the dims of each smj operator such that it is [[2,2],[2,2],...,[2,2],[N,N]] rather than the uncorrect [[a,a],[2,2],[b,b],[N,N]]?
2. is there any smarter way to write the operators? this will help also in writing of the c_ops and psi0...
3. since the composite Hilbert space dimension scales with M as 2^M*N which quantum dynamics solver is better to use?
thank you for your time!
cheers,
sofia