I'm ultimately aiming to use experimental data for a simulation, but I'm starting with a constructed case to check that I'm setting things up correctly. This isn't giving the results that I expect, however, and I can't figure out where I'm going wrong. Here's my test code (I'm open to tips on how to format code for group posts, since I'm new to them):
import time
import numpy as np
import qutip as qt
import matplotlib.pyplot as plt
tstart = time.time()
h = 1
hbar = h/2/np.pi
E1 = h*2.291e9 #Excitation energy in Hz
A = 1e12 #1e10
f = E1/h
phi = 0.0
N = int(1e5)
t_int = np.linspace(0, 1e-8, N)
#sinusoidal pulse in middle half
def V(t, args):
out = A*np.sin(2*np.pi*f*t+phi)*(t>t_int[-1]/4)*(t<3*t_int[-1]/4)
return out
state_init = qt.Qobj([[1],[0]])
H0 = qt.Qobj([[E1, 0], [0, 0]])
H1 = qt.Qobj([[0, 1], [1, 0]])
H = [H0, [H1, V]]
exp1 = qt.Qobj([[1,0],[0,0]])
exp2 = qt.Qobj([[0,0],[0,1]])
out = qt.sesolve(H, state_init, t_int, e_ops=[exp1, exp2])
#%%
plt.close('all')
fig, ax = qt.plot_expectation_values(out)
I would expect to get constant frequency rabi oscillations shifting the population entirely from one state to the other since I'm setting f=f0, but for a wide range of parameters I get results similar to this. I've tried things like rescaling the frequency and time to GHz and ns to make them ~=1, but it makes little difference. Smaller amplitude values also result in the oscillations only being between 0 and say 0.04 population in the unpopulated state, but if I remember correctly as long as the drive is on resonance the population should shift between 0 and 1, just at a lower frequency for lower amplitudes.