Пример #1
0
 def vacuum_dm(self):
     """
     get initial density matrix for cavity vacuum state
     """
     vac = np.zeros(self.n_cav)
     vac[0] = 1.
     return ket2dm(vac)
Пример #2
0
def coherent_dm(N, alpha):
    """Density matrix representation of a coherent state.

    Constructed via outer product of :func:`qutip.states.coherent`

    Parameters
    ----------
    N : int
        Number of Fock states in Hilbert space.

    alpha : float/complex
        Eigenvalue for coherent state.

    offset : int (default 0)
        The lowest number state that is included in the finite number state
        representation of the state.

    method : string {'operator', 'analytic'}
        Method for generating coherent density matrix.

    Returns
    -------
    dm : qobj
        Density matrix representation of coherent state.

    Examples
    --------
    >>> coherent_dm(3,0.25j)
    Quantum object: dims = [[3], [3]], \
shape = [3, 3], type = oper, isHerm = True
    Qobj data =
    [[ 0.93941695+0.j          0.00000000-0.23480733j -0.04216943+0.j        ]
     [ 0.00000000+0.23480733j  0.05869011+0.j          0.00000000-0.01054025j]
     [-0.04216943+0.j          0.00000000+0.01054025j  0.00189294+0.j\
        ]]

    Notes
    -----
    Select method 'operator' (default) or 'analytic'. With the
    'operator' method, the coherent density matrix is generated by displacing
    the vacuum state using the displacement operator defined in the
    truncated Hilbert space of size 'N'. This method guarantees that the
    resulting density matrix is normalized. With 'analytic' method the coherent
    density matrix is generated using the analytical formula for the coherent
    state coefficients in the Fock basis. This method does not guarantee that
    the state is normalized if truncated to a small number of Fock states,
    but would in that case give more accurate coefficients.

    """
    #if method == "operator":
    psi = coherent(N, alpha)

    return ket2dm(psi)
Пример #3
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)

    # from lime.style import subplots
    # fig, ax = subplots()
    # times = np.arange(Nt) * dt
    # ax.imshow(corr.real)
Пример #4
0
    # l = h.to_super() + 1j * c_op.to_linblad(gamma=gamma)
    # l = liouvillian(H, c_ops=[gamma*c_op])

    # ntrans = 3 * nstates # number of transitions
    # eigvals1, U1 = eigs(l, k=ntrans, which='LR')

    # eigvals1, U1 = sort(eigvals1, U1)

    # print(eigvals1.real)

    # omegas = np.linspace(0.1 , 10.5, 200)

    from lime.phys import ket2dm
    from lime.style import matplot, subplots

    rho0 = ket2dm(np.array([1.0, 0.0]))
    # rho0.data[0,0] = 1.0

    ops = [sx, sx]

    # out = correlation_2p_1t(omegas, rho0, ops, L)
    # print(eigvecs)
    # eigvals2, U2 = eigs(dag(l), k=ntrans, which='LR')

    # eigvals2, U2 = sort(eigvals2, U2)

    # #idx = np.where(eigvals2.real > 0.2)[0]
    # #print(idx)

    # norm = [np.vdot(U2[:,n], U1[:,n]) for n in range(ntrans)]
Пример #5
0
    s0, sx, sy, sz = pauli()

    # set up the molecule
    H0 = 1. / au2ev * 0.5 * (s0 - sz)
    H1 = sx.astype(complex)

    # def coeff1(t):
    #     return np.exp(-t**2)*np.cos(1./au2ev * t)

    pulse = Pulse(tau=2 / au2fs, omegac=1. / au2ev, delay=0, amplitude=0.05)

    # H = [H0.astype(complex), [H1.astype(complex), pulse.field]]
    H = H0.astype(complex)

    psi0 = basis(2, 0)
    rho0 = ket2dm(psi0).astype(complex)

    mesolver = Redfield_solver(H, c_ops=[sz.astype(complex)])
    Nt = 800
    dt = 0.5

    result = mesolver.evolve(rho0, dt=dt, Nt=Nt, e_ops=[H1])
    #corr = mesolver.correlation_3op_2t(rho0, [sz, sz, sz], dt, Nt, Ntau=Nt)

    # print(result.observables)
    import proplot as plt
    fig, ax = plt.subplots()
    times = np.arange(Nt) * dt
    ax.plot(times, result.observables[:, 0])
    ax.format(ylabel='Coherence')