def QRM(omega0, omegac, ncav=2): ''' Quantum Rabi model / Jaynes-Cummings model Parameters ---------- omega0 : float atomic transition frequency omegac : float cavity frequency g : float cavity-molecule coupling strength Returns ------- rabi: object ''' s0, sx, sy, sz = pauli() hmol = 0.5 * omega0 * (-sz + s0) mol = Mol(hmol, sx) # atom cav = Cavity(omegac, ncav) # cavity return Polariton(mol, cav)
def test_sesolver(): s0, sx, sy, sz = pauli() H = (-0.05) * sz - 0. * sx solver = SESolver(H) Nt = 1000 dt = 4 psi0 = (basis(2, 0) + basis(2, 1)) / np.sqrt(2) start_time = time.time() result = solver.evolve(psi0, dt=dt, Nt=Nt, e_ops=[sx]) print("--- %s seconds ---" % (time.time() - start_time)) start_time = time.time() times = np.arange(Nt) * dt r = _ode_solver(H, psi0, dt=dt, Nt=Nt, nout=2, e_ops=[sx]) print("--- %s seconds ---" % (time.time() - start_time)) # test correlation functions # corr = solver.correlation_3p_1t(psi0=psi0, oplist=[s0, sx, sx], # dt=0.05, Nt=Nt) # # times = np.arange(Nt) # import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.plot(times, result.observables[:, 0]) ax.plot(r.times, r.observables[:, 0], '--') # ax.plot(times, corr.real) plt.show()
# store the reduced density matrix f.write( fmt.format(t, ado[0, 0, 0], ado[0, 1, 0], ado[1, 0, 0], ado[1, 1, 0])) #sz += -1j * commutator(sz, H) * dt f.close() return ado[:, :, 0] if __name__ == '__main__': from lime.phys import pauli s0, sx, sy, sz = pauli() H = 2 * np.pi * 0.1 * sx psi0 = basis(2, 0) rho0 = ket2dm(psi0) mesolver = Lindblad_solver(H, c_ops=[0.2 * sx], e_ops=[sz]) Nt = 200 dt = 0.05 L = mesolver.liouvillian() #result = mesolver.evolve(rho0, dt, Nt=Nt, return_result=True) #corr = mesolver.correlation_3op_2t(rho0, [sz, sz, sz], dt, Nt, Ntau=Nt)