Пример #1
0
def spin_fock(spin_state):
    n = spin_state.shape[0]
    j = dim_spin(n)
    bases = []
    for m in np.arange(-1 * j, j + 1, 1):
        amp = spin_state.overlap(qt.spin_state(j, m))
        bases.append(amp * spin_fockBASIS(j, m))
    return sum(bases)
Пример #2
0
def tensor_clebsch(j1, j2):
    J3 = possible_j3s(j1, j2)
    states = []
    labels = []
    for j3 in J3:
        substates = []
        sublabels = []
        for m3 in np.arange(-j3, j3 + 1):
            terms = []
            for m1 in np.arange(-j1, j1 + 1):
                for m2 in np.arange(-j2, j2 + 1):
                    terms.append(\
                        qt.clebsch(j1, j2, j3, m1, m2, m3)*\
                        qt.tensor(qt.spin_state(j1, m1),\
                                    qt.spin_state(j2, m2)))
            substates.append(sum(terms))
            sublabels.append((j3, m3))
        states.extend(substates[::-1])
        labels.append(sublabels[::-1])
    return qt.Qobj(np.array([state.full().T[0] for state in states])), labels
Пример #3
0
def coupling_(a, b):
    particle_types = []
    for a_i in np.arange(-1 * a, a + 1, 1):
        for b_j in np.arange(-1 * b, b + 1, 1):
            c = abs(a_i + b_j)
            c2 = abs(abs(a_i) + abs(b_j))
            if c != c2:
                particle_types.append(c2)
            particle_types.append(c)

    T = {}
    for particle in particle_types:
        particle_dict = {}
        if particle == 0:
            states = []
            for a_i in np.arange(-1 * a, a + 1, 1):
                for b_j in np.arange(-1 * b, b + 1, 1):
                    state = qt.clebsch(a, b, 0, a_i, b_j, 0)*\
                        qt.tensor(qt.spin_state(a, a_i), qt.spin_state(b, b_j))
                    states.append(state)
            STATE = sum(states)
            particle_dict[particle] = (qt.spin_state(0, 0), STATE)
        else:
            for c_m in np.arange(-1 * particle, particle + 1, 1):
                states = []
                for a_i in np.arange(-1 * a, a + 1, 1):
                    for b_j in np.arange(-1 * b, b + 1, 1):
                        state = qt.clebsch(a, b, particle, a_i, b_j, c_m)*\
                            qt.tensor(qt.spin_state(a, a_i), qt.spin_state(b, b_j))
                        states.append(state)
                STATE = sum(states)
                particle_dict[c_m] = (qt.spin_state(particle, c_m), STATE)
        T[particle] = particle_dict
    return T
Пример #4
0
def test_spinstate_type():
    "State CSR Type: spin_state"
    st = spin_state(5,3)
    assert_equal(isspmatrix_csr(st.data), True)
Пример #5
0
def fock_spinBASIS(n1, n2):
    j = (n1 + n2) / 2.
    m = n1 - j
    return qt.spin_state(j, m)  #, (j, m)