def methodeQuTip(self, sort): self.Hfwo = sm.lambdify('eps0', self.H0, modules="numpy") self.H = [self.H0] T = 2 * np.pi / self.w list_eps0 = np.arange(0, 8 * self.w, 0.01 * self.w) args_eps = {} f_energies_list = [] for eps0 in list_eps0: args_eps['eps0'] = eps0 # progress_bar = int(eps0*self.w * 800) # if progress_bar%10==1: # print("%", progress_bar) #H0 = - eps0/2.0 * qt.sigmaz() H0 = Qobj(self.Hfwo(eps0)) if self.Nb_drives == 1: H = [ H0, [ Qobj(self.list_perturbations[0]), lambda t, args: np.cos(self.frequencies[0] * t) ] ] elif self.Nb_drives == 2: H = [ H0, [ Qobj(self.list_perturbations[0]), lambda t, args: np.cos(self.frequencies[0] * t) ], [ Qobj(self.list_perturbations[1]), lambda t, args: np.cos(self.frequencies[1] * t) ] ] f_modes_0, f_energies = qt.floquet_modes(H, T, args_eps, sort=sort) f_energies_list.append(f_energies) llist_eps0 = np.transpose(np.matrix([list_eps0 for i in f_energies])) #plt.plot(llist_delta, f_energies_list ) #plt.show() return llist_eps0, f_energies_list
def testFloquetMasterEquation1(self): """ Test Floquet-Markov Master Equation for a driven two-level system without dissipation. """ delta = 1.0 * 2 * np.pi eps0 = 1.0 * 2 * np.pi A = 0.5 * 2 * np.pi omega = np.sqrt(delta**2 + eps0**2) T = (2 * np.pi) / omega tlist = np.linspace(0.0, 2 * T, 101) psi0 = rand_ket(2) H0 = -eps0 / 2.0 * sigmaz() - delta / 2.0 * sigmax() H1 = A / 2.0 * sigmax() args = {'w': omega} H = [H0, [H1, lambda t, args: np.sin(args['w'] * t)]] e_ops = [num(2)] gamma1 = 0 # Collapse operator for Floquet-Markov Master Equation c_op_fmmesolve = sigmax() # Collapse operators for Lindblad Master Equation def noise_spectrum(omega): if omega > 0: return 0.5 * gamma1 * omega / (2 * np.pi) else: return 0 ep, vp = H0.eigenstates() op0 = vp[0] * vp[0].dag() op1 = vp[1] * vp[1].dag() c_op_mesolve = [] gamma = np.zeros([2, 2], dtype=complex) for i in range(2): for j in range(2): if i != j: gamma[i][j] = 2 * np.pi * c_op_fmmesolve.matrix_element( vp[j], vp[i]) * c_op_fmmesolve.matrix_element( vp[i], vp[j]) * noise_spectrum(ep[j] - ep[i]) for i in range(2): for j in range(2): c_op_mesolve.append( np.sqrt(gamma[i][j]) * (vp[i] * vp[j].dag())) # Find the floquet modes f_modes_0, f_energies = floquet_modes(H, T, args) # Precalculate mode table f_modes_table_t = floquet_modes_table(f_modes_0, f_energies, np.linspace(0, T, 500 + 1), H, T, args) # Solve the floquet-markov master equation output1 = fmmesolve(H, psi0, tlist, [c_op_fmmesolve], [], [noise_spectrum], T, args, floquet_basis=True) # Calculate expectation values in the computational basis p_ex = np.zeros(np.shape(tlist), dtype=complex) for idx, t in enumerate(tlist): f_modes_t = floquet_modes_t_lookup(f_modes_table_t, t, T) f_states_t = [ np.exp(-1j * t * f_energies[0]) * f_modes_t[0], np.exp(-1j * t * f_energies[1]) * f_modes_t[1] ] p_ex[idx] = expect(num(2), output1.states[idx].transform(f_states_t, True)) # Compare with mesolve output2 = mesolve(H, psi0, tlist, c_op_mesolve, [], args) p_ex_ref = expect(num(2), output2.states) np.testing.assert_allclose(np.real(p_ex), np.real(p_ex_ref), atol=1e-4)
def testFloquetRates(self): """ Compare rate transition and frequency transitions to analytical results for a driven two-level system, for different drive amplitudes. """ # Parameters wq = 5.4 * 2 * np.pi wd = 6.7 * 2 * np.pi delta = wq - wd T = 2 * np.pi / wd tlist = np.linspace(0.0, 2 * T, 101) array_A = np.linspace(0.001, 3 * 2 * np.pi, 10, endpoint=False) H0 = Qobj(wq / 2 * sigmaz()) arg = {'wd': wd} c_ops = sigmax() gamma1 = 1 delta_ana_deltas = [] array_ana_E0 = [-np.sqrt((delta / 2)**2 + a**2) for a in array_A] array_ana_E1 = [np.sqrt((delta / 2)**2 + a**2) for a in array_A] array_ana_delta = [2 * np.sqrt((delta / 2)**2 + a**2) for a in array_A] def noise_spectrum(omega): if omega > 0: return 0.5 * gamma1 * omega / (2 * np.pi) else: return 0 idx = 0 for a in array_A: # Hamiltonian H1_p = Qobj(a * sigmap()) H1_m = Qobj(a * sigmam()) H = [ H0, [H1_p, lambda t, args: np.exp(-1j * arg['wd'] * t)], [H1_m, lambda t, args: np.exp(1j * arg['wd'] * t)] ] # Floquet modes fmodes0, fenergies = floquet_modes(H, T, args={}, sort=True) f_modes_table_t = floquet_modes_table(fmodes0, fenergies, tlist, H, T, args={}) # Get X delta DeltaMatrix, X, frates, Amat = floquet_master_equation_rates( fmodes0, fenergies, c_ops, H, T, {}, noise_spectrum, 0, 5) # Check energies deltas = np.ndarray.flatten(DeltaMatrix) # deltas and array_ana_delta have at least 1 value in common. assert (min(abs(deltas - array_ana_delta[idx])) < 1e-4) # Check matrix elements Xs = np.ndarray.flatten(X) normPlus = np.sqrt(a**2 + (array_ana_E1[idx] - delta / 2)**2) normMinus = np.sqrt(a**2 + (array_ana_E0[idx] - delta / 2)**2) Xpp_p1 = (a / normPlus**2) * (array_ana_E1[idx] - delta / 2) assert (min(abs(Xs - Xpp_p1)) < 1e-4) Xpp_m1 = (a / normPlus**2) * (array_ana_E1[idx] - delta / 2) assert (min(abs(Xs - Xpp_m1)) < 1e-4) Xmm_p1 = (a / normMinus**2) * (array_ana_E0[idx] - delta / 2) assert (min(abs(Xs - Xmm_p1)) < 1e-4) Xmm_m1 = (a / normMinus**2) * (array_ana_E0[idx] - delta / 2) assert (min(abs(Xs - Xmm_m1)) < 1e-4) Xpm_p1 = (a / (normMinus * normPlus)) * (array_ana_E0[idx] - delta / 2) assert (min(abs(Xs - Xmm_p1)) < 1e-4) Xpm_m1 = (a / (normMinus * normPlus)) * (array_ana_E1[idx] - delta / 2) assert (min(abs(Xs - Xpm_m1)) < 1e-4) idx += 1
tlist = np.linspace(0.0, 20 * T, 101) psi0 = basis(2,0) H0 = - delta/2.0 * qt.sigmax() - eps0/2.0 * qt.sigmaz() H1 = A/2.0 * qt.sigmax() args = {"w": omega} H = [H0, [H1, lambda t,args: np.sin(args["w"] * t)] gamma1 = 0.1 def noise_spectrum(omega): """ Noise power spectrum for angular frequency omega. """ return 0.5 * gamma1 * omega/(2*np.pi) # find the floquet modes for the time-dependent hamiltonian f_modes_0, f_energies = qt.floquet_modes(H, T, args) # precalculate mode table f_modes_table_t = qt.floquet_modes_table(f_modes_0, f_energies, np.linspace(0, T, 500 + 1), H, T, args) # solve the floquet-markov master equation output = qt.fmmesolve(H, psi0, tlist, [sigmax()], [], [noise_spectrum], T, args) # calculate expectation values in the computational basis p_ex = np.zeros(np.shape(tlist), dtype=complex) for idx, t in enumerate(tlist): f_modes_t = floquet_modes_t_lookup(f_modes_table_t, t, T) p_ex[idx] = expect(num(2), output.states[idx].transform(f_modes_t, True)) # For reference: calculate the same thing with mesolve output = qt.mesolve(H, psi0, tlist, [np.sqrt(gamma1) * qt.sigmax()], [num(2)], args)
def floquet_esys(ampl): H1 = ampl * (1. - 4. * q**2).sqrtm() * p.cosm() H = [H0, [H1, lambda t, args: np.cos(args["w"] * t)]] f_modes_0, f_energies = floquet_modes(H, time_period, args, True) return f_energies
from matplotlib import pyplot import qutip delta = 0.2 * 2*np.pi eps0 = 0.0 * 2*np.pi omega = 1.0 * 2*np.pi A_vec = np.linspace(0, 10, 100) * omega T = 2*np.pi/omega tlist = np.linspace(0.0, 10 * T, 101) psi0 = qutip.basis(2, 0) q_energies = np.zeros((len(A_vec), 2)) H0 = delta/2.0 * qutip.sigmaz() - eps0/2.0 * qutip.sigmax() args = omega for idx, A in enumerate(A_vec): H1 = A/2.0 * qutip.sigmax() H = [H0, [H1, lambda t, w: np.sin(w*t)]] f_modes,f_energies = qutip.floquet_modes(H, T, args, True) q_energies[idx,:] = f_energies # plot the results pyplot.plot( A_vec/omega, np.real(q_energies[:, 0]) / delta, 'b', A_vec/omega, np.real(q_energies[:, 1]) / delta, 'r', ) pyplot.xlabel(r'$A/\omega$') pyplot.ylabel(r'Quasienergy / $\Delta$') pyplot.title(r'Floquet quasienergies') pyplot.show()