Exemplo n.º 1
0
def basic_spin_rotations_spin1():
    ''' define some simple spin rotations'''

    ### m1 transition pulses
    ssx = qutip.qutrit_ops(
    )[0] + qutip.qutrit_ops()[4] / 2 + qutip.qutrit_ops()[4].dag() / 2
    ssy = qutip.qutrit_ops()[0] - qutip.qutrit_ops(
    )[4] / 2 * 1j + qutip.qutrit_ops()[4].dag() / 2 * 1j
    ssz = qutip.qutrit_ops(
    )[0] + qutip.qutrit_ops()[1] / 2 - qutip.qutrit_ops()[2].dag() / 2

    ## Spin 1/2
    X = (-1j * ssx * np.pi).expm()
    mX = (1j * ssx * np.pi).expm()
    Y = (-1j * ssy * np.pi).expm()
    mY = (1j * ssy * np.pi).expm()
    Z = (-1j * ssz * np.pi).expm()
    mZ = (1j * ssz * np.pi).expm()
    x = (-1j * ssx * np.pi / 2).expm()
    mx = (1j * ssx * np.pi / 2).expm()
    y = (-1j * ssy * np.pi / 2).expm()
    my = (1j * ssy * np.pi / 2).expm()
    z = (-1j * ssz * np.pi / 2).expm()
    mz = (1j * ssz * np.pi / 2).expm()

    return X, Y, Z, x, y, z, mX, mY, mZ, mx, my, mz
Exemplo n.º 2
0
def Evolution(H, tau_list, N):
    ''' H is the hamiltonian'''

    ### Initial states
    psi_electron = (qutip.basis(3, 1) + qutip.basis(3, 2)) * 1. / np.sqrt(2)
    rho_electron = psi_electron * psi_electron.dag()

    # print 'electron state is'
    # print rho_electron

    rho_14N = qutip.basis(3, 1) * qutip.basis(3, 1).dag()

    # print '14N state is'
    # print rho_14N

    rho_tot = qutip.tensor(rho_electron, rho_14N)

    # print 'tot state is'
    # print rho_tot

    ### Pi-pulses
    pi_pulse_electron = qutip.qutrit_ops()[0] + qutip.qutrit_ops(
    )[4] + qutip.qutrit_ops()[4].dag()
    pi_pulse = qutip.tensor(pi_pulse_electron, Id1)

    # print 'pi pulse is'
    # print pi_pulse

    #sequence and RO
    S = np.zeros(len(tau_list))
    for i, tau in enumerate(tau_list):

        ### Free evolution
        expH = (-1j * H * tau).expm()

        U = expH * pi_pulse * expH * expH * pi_pulse * expH
        U_tot = U**(N / 2)

        rho_final = U_tot * rho_tot * U_tot.dag()

        rho_el_final = rho_final.ptrace(0)  # Trace out the nuclear spin
        S[i] = qutip.fidelity(rho_electron, rho_el_final)**2

    ## plot ##
    f, ax = plt.subplots(1)
    ax.plot(tau_list, S, 'o-', lw=1)
    ax.set_title('P(ms=0)')
    ax.set_xlabel('tau (us)')
    plt.show()
    return S[i]
Exemplo n.º 3
0
def test_qutrit_ops():
    ops = qutip.qutrit_ops()
    assert qutip.qeye(3) == sum(ops[:3])
    np.testing.assert_allclose(np.diag([1, 1], k=1), sum(ops[3:5]).full())
    expected = np.zeros((3, 3))
    expected[2, 0] = 1
    np.testing.assert_allclose(expected, ops[5].full())
Exemplo n.º 4
0
def test_qtrit_type():
    "Operator CSR Type: qutrit ops"
    ops = qutrit_ops()
    for k in ops:
        assert_equal(isspmatrix_csr(k.data), True)
Exemplo n.º 5
0
def test_qtrit_type():
    "Operator CSR Type: qutrit ops"
    ops = qutrit_ops()
    for k in ops:
        assert_equal(isspmatrix_csr(k.data), True)