Пример #1
0
def test_br_term_mult(secular):
    "BR Tools : br_term_mult"
    dimension = 10
    time = 1.0
    atol = 1e-12
    for _ in range(10):
        H = qutip.rand_herm(dimension, 0.5)
        basis = H.eigenstates()[1]
        L_diagonal = qutip.liouvillian(H.transform(basis))
        evals = np.empty((dimension,), dtype=np.float64)
        evecs = _test_zheevr(H.full('F'), evals)
        operator = qutip.rand_herm(dimension, 0.5)
        a_ops = [[operator, lambda w: 1.0]]
        vec = np.ones((dimension*dimension,), dtype=np.complex128)
        br_tensor, _ = qutip.bloch_redfield_tensor(H, a_ops,
                                                   use_secular=secular)
        target = (br_tensor - L_diagonal).data.dot(vec)
        calculated = np.zeros_like(target)
        _test_br_term_mult(time, operator.full('F'), evecs, evals, vec,
                           calculated, secular, 0.1, atol)
        assert np.allclose(target, calculated)
Пример #2
0
def test_pull_572_error():
    """
    brmesolve: Check for #572 bug.
    """
    w1, w2, w3 = 1, 2, 3
    gamma2, gamma3 = 0.1, 0.1
    id2 = qutip.qeye(2)

    # Hamiltonian for three uncoupled qubits
    H = (w1 / 2. * qutip.tensor(qutip.sigmaz(), id2, id2) +
         w2 / 2. * qutip.tensor(id2, qutip.sigmaz(), id2) +
         w3 / 2. * qutip.tensor(id2, id2, qutip.sigmaz()))

    # White noise
    def S2(w):
        return gamma2

    def S3(w):
        return gamma3

    qubit_2_x = qutip.tensor(id2, qutip.sigmax(), id2)
    qubit_3_x = qutip.tensor(id2, id2, qutip.sigmax())
    # Bloch-Redfield tensor including dissipation for qubits 2 and 3 only
    R, ekets = qutip.bloch_redfield_tensor(H,
                                           [[qubit_2_x, S2], [qubit_3_x, S3]])
    # Initial state : first qubit is excited
    grnd2 = qutip.sigmam() * qutip.sigmap()  # 2x2 ground
    exc2 = qutip.sigmap() * qutip.sigmam()  # 2x2 excited state
    ini = qutip.tensor(exc2, grnd2, grnd2)  # Full system

    # Projector on the excited state of qubit 1
    proj_up1 = qutip.tensor(exc2, id2, id2)

    # Solution of the master equation
    times = np.linspace(0, 10. / gamma3, 1000)
    sol = qutip.bloch_redfield_solve(R, ekets, ini, times, [proj_up1])
    np.testing.assert_allclose(sol[0], np.ones_like(times))
Пример #3
0
delta = 0.2 * 2 * np.pi
eps0 = 1.0 * 2 * np.pi
gamma1 = 0.5

H = -delta / 2.0 * qt.sigmax() - eps0 / 2.0 * qt.sigmaz()


def ohmic_spectrum(w):
    if w == 0.0:  # dephasing inducing noise
        return gamma1
    else:  # relaxation inducing noise
        return gamma1 / 2 * (w / (2 * np.pi)) * (w > 0.0)


R, ekets = qt.bloch_redfield_tensor(H, [qt.sigmax()], [ohmic_spectrum])
"""
Last part
"""

tlist = np.linspace(0, 15.0, 1000)

psi0 = qt.rand_ket(2)
e_ops = [qt.sigmax(), qt.sigmay(), qt.sigmaz()]
expt_list = qt.bloch_redfield_solve(R, ekets, psi0, tlist, e_ops)

sphere = qt.Bloch()
sphere.add_points([expt_list[0], expt_list[1], expt_list[2]])
sphere.vector_color = ['r']
sphere.add_vectors(np.array([delta, 0, eps0]) / np.sqrt(delta**2 + eps0**2))
sphere.make_sphere()