Exemplo n.º 1
0
def func(rho, h0, c_ops, l_ops):
    """
    right-hand side of the master equation
    """
    rhs = -1j * commutator(h0, rho)

    for i in range(len(c_ops)):
        c_op = c_ops[i]
        l_op = l_ops[i]
        rhs -= commutator(c_op, l_op.dot(rho) - rho.dot(dag(l_op)))
    return rhs
Exemplo n.º 2
0
def make_lambda(ns, h0, S, T, cutfreq, reorg):

    tmax = 1000.0
    print(
        'time range to numericall compute the bath correlation function = [0, {}]'
        .format(tmax))
    print('Decay of correlation function at {} fs = {} \n'.format(tmax * au2fs, \
          corr(tmax, T, cutfreq, reorg)/corr(0., T, cutfreq, reorg)))
    print('!!! Please make sure this is much less than 1 !!!')

    time = np.linspace(0, tmax, 10000)
    dt = time[1] - time[0]
    dt2 = dt / 2.0

    l = np.zeros((ns, ns), dtype=np.complex128)

    #t = time[0]
    #phi = hop * t - Delta * np.sin(omegad * t)/omegad
    #Lambda += corr(t) * (np.sin(2. * phi) * sigmay + np.cos(2. * phi) * sigmaz) * dt2

    #h0 = Hamiltonian()
    Sint = S.copy()

    for k in range(len(time)):

        t = time[k]

        Sint += -1j * commutator(S, h0) * (-dt)
        l += dt * Sint * corr(t, T, cutfreq, reorg)


#    t = time[len(time)-1]
#    phi = hop * t + Delta * np.sin(omegad * t)/omegad
#    Lambda += corr(t) * (np.sin(2. * phi) * sigmay + np.cos(2. * phi) * sigmaz) * dt2
#    Lambda = cy * sigmay + cz * sigmaz

    return l
Exemplo n.º 3
0
def _heom_dl(H, rho0, c_ops, e_ops, temperature, cutoff, reorganization,\
             nado, dt, nt, fname=None, return_result=True):
    '''

    terminator : ado[:,:,nado] = 0

    INPUT:
        T: in units of energy, kB * T, temperature of the bath
        reorg: reorganization energy
        nado : auxiliary density operators, truncation of the hierachy
        fname: file name for output

    '''
    nst = H.shape[0]
    ado = np.zeros((nst, nst, nado),
                   dtype=np.complex128)  # auxiliary density operators
    ado[:, :, 0] = rho0  # initial density matrix

    gamma = cutoff  # cutoff frequency of the environment, larger gamma --> more Makovian
    T = temperature / au2k
    reorg = reorganization
    print('Temperature of the environment = {}'.format(T))
    print('High-Temperature check gamma/(kT) = {}'.format(gamma / T))

    if gamma / T > 0.8:
        print('WARNING: High-Temperature Approximation may fail.')

    print('Reorganization energy = {}'.format(reorg))

    # D(t) = (a + ib) * exp(- gamma * t)
    a = np.pi * reorg * T  # initial value of the correlation function D(0) = pi * lambda * kB * T
    b = 0.0
    print('Amplitude of the fluctuations = {}'.format(a))

    #sz = np.zeros((nstate, nstate), dtype=np.complex128)
    sz = c_ops  # collapse opeartor

    f = open(fname, 'w')
    fmt = '{} ' * 5 + '\n'

    # propagation time loop - HEOM
    t = 0.0
    for k in range(nt):

        t += dt  # time increments

        ado[:,:,0] += -1j * commutator(H, ado[:,:,0]) * dt - \
            commutator(sz, ado[:,:,1]) * dt

        for n in range(nado - 1):
            ado[:,:,n] += -1j * commutator(H, ado[:,:,n]) * dt + \
                        (- commutator(sz, ado[:,:,n+1]) - n * gamma * ado[:,:,n] + n * \
                        (a * commutator(sz, ado[:,:,n-1]) + \
                         1j * b * anticommutator(sz, ado[:,:,n-1]))) * dt

        # 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]