示例#1
0
def setup_Dicke(omega,
                omega0,
                U,
                g,
                gp,
                kappa,
                gam_phi,
                gam_dn,
                num_threads=None):
    """Generate Liouvillian for Dicke model
    H = omega*adag*a + omega0*sz  + g*(a*sp + adag*sm) + gp*(a*sm + adag*sp) + U *adag*a*sz
    c_ops = kappa L[a] + gam_phi L[sigmaz] + gam_dn L[sigmam]"""

    from operators import tensor, qeye, destroy, create, sigmap, sigmam, sigmaz
    from basis import nspins, ldim_s, ldim_p, setup_L
    from numpy import sqrt

    num = create(ldim_p) * destroy(ldim_p)

    #note terms with just photon operators need to be divided by nspins
    H = omega * tensor(num, qeye(ldim_s)) / nspins + omega0 * tensor(
        qeye(ldim_p), sigmaz()) + U * tensor(num, sigmaz())
    H = H + g * (tensor(create(ldim_p), sigmam()) +
                 tensor(destroy(ldim_p), sigmap()))
    H = H + gp * (tensor(create(ldim_p), sigmap()) +
                  tensor(destroy(ldim_p), sigmam()))

    c_ops = []
    c_ops.append(sqrt(kappa / nspins) * tensor(destroy(ldim_p), qeye(ldim_s)))
    c_ops.append(sqrt(gam_phi) * tensor(qeye(ldim_p), sigmaz()))
    c_ops.append(sqrt(gam_dn) * tensor(qeye(ldim_p), sigmam()))

    return setup_L(H, c_ops, num_threads)
示例#2
0
def setup_laser(g, Delta, kappa, gam_dn, gam_up, gam_phi, num_threads=None):
    """Generate Liouvillian for laser problem
    H = Delta*sigmaz + g(a*sigmap + adag*sigmam)
    c_ops = kappa L[a] + gam_dn L[sigmam] + gam_up L[sigmap] + gam_phi L[sigmaz]"""

    from operators import tensor, qeye, destroy, create, sigmap, sigmam, sigmaz
    from basis import nspins, ldim_s, ldim_p, setup_L
    from numpy import sqrt

    H = g * (tensor(destroy(ldim_p), sigmap()) + tensor(
        create(ldim_p), sigmam())) + Delta * tensor(qeye(ldim_p), sigmaz())

    c_ops = [
        sqrt(kappa / nspins) * tensor(destroy(ldim_p), qeye(ldim_s)),
        sqrt(gam_dn) * tensor(qeye(ldim_p), sigmam()),
        sqrt(gam_up) * tensor(qeye(ldim_p), sigmap())
    ]
    c_ops.append(sqrt(gam_phi) * tensor(qeye(ldim_p), sigmaz()))

    return setup_L(H, c_ops, num_threads)
示例#3
0
def find_gap(L, init=None, maxit=1e6, tol=None, return_ss=False, k=10):
    """Calculate smallest set of k eigenvalues of L"""
    
    from numpy import sort
    from scipy.sparse.linalg import eigs
    from operators import tensor, qeye
    from basis import ldim_s, ldim_p
    from expect import expect_comp
    import gc
    
    if tol is None:
        tol = 1e-8
    
    gc.collect()
    if init is None:
        val, rho = eigs(L, k=k, which = 'SM', maxiter=maxit, tol=tol)
    else:
        val, rho = eigs(L, k=k, which = 'SM', maxiter=maxit, v0=init, tol=tol)
    gc.collect()

    #shift any spurious positive eignevalues out of the way
    for count in range(k):
        if val[count]>1e-10:
            val[count]=-5.0

    sort_perm = val.argsort()
    val = val[sort_perm]

    rho= rho[:, sort_perm]
    
    #calculate steady state and normalise
    if (return_ss):
        rho = rho[:,k-1]
        rho = rho/expect_comp([rho], [tensor(qeye(ldim_p), qeye(ldim_s))])
        rho = rho[0,:]
        return rho
    
    else:
        return val
示例#4
0
# setup basis with ntls spin, each of Hilbert space dimentsion
# 2 and photon with dimension nphot
setup_basis(ntls, 2, nphot)

#run other setup routines
list_equivalent_elements()
setup_convert_rho()
from basis import nspins, ldim_p, ldim_s

#setup inital state and calculate Liouvillian
L = setup_Dicke(omega, omega0, U, g, gp, kappa, gam_phi, gam_dn, 3)
initial = setup_rho(basis(ldim_p, nphot0), basis(ldim_s, 1))
print "setup L"

#operators to calculate expectation values for
na = tensor(create(ldim_p) * destroy(ldim_p), qeye(ldim_s))
sz = tensor(qeye(ldim_p), sigmaz())

#propagate
t0 = time()
resultscomp = time_evolve(L, initial, tmax, dt, [na, sz])
tf = time() - t0

print "Time evollution complete"
print tf

#plot time evolution
figure()
plot(resultscomp.t, resultscomp.expect[0])
plot(resultscomp.t, resultscomp.expect[1])