Exemplo n.º 1
0
def test_cutoff_limited():
    H = HierarchyStructure(3, 3, pop_modes=2, cutoff=[-1, -1, 1])
    vecind = [tuple(k) for k in H.vecind]

    assert (0, 0, 0) in vecind

    assert (0, 0, 1) in vecind
    assert (0, 1, 0) in vecind
    assert (0, 2, 0) in vecind
    assert (0, 3, 0) in vecind
    assert (1, 0, 0) in vecind
    assert (2, 0, 0) in vecind
    assert (3, 0, 0) in vecind

    assert (0, 1, 1) in vecind
    assert (0, 2, 1) in vecind

    assert (1, 0, 1) in vecind
    assert (2, 0, 1) in vecind

    assert (1, 1, 0) in vecind
    assert (1, 2, 0) in vecind
    assert (2, 1, 0) in vecind

    assert (1, 1, 1) not in vecind
    assert (2, 1, 1) not in vecind
    assert (0, 1, 4) not in vecind
    assert (1, 0, 2) not in vecind
    assert (1, 1, 2) not in vecind

    assert H.entries == 15
Exemplo n.º 2
0
    def __init__(self, depth, bath, h_sys, couplops):
        """@todo: to be defined1. """
        MasterIntegrator.__init__(self, bath, h_sys, couplops)

        struct = HierarchyStructure(2 * self._modes, depth)
        self._nr_aux_states = struct.entries
        self._prop = self._setup_propagator(struct)
Exemplo n.º 3
0
    def __init__(self, bath, h_sys, couplops, pop_modes=None):
        """@todo: to be defined1.

        :param bath: @todo
        :param h_sys: @todo
        :param pop_modes: @todo

        """
        MasterIntegrator.__init__(self, bath, h_sys, couplops)

        self._pop_modes = pop_modes if pop_modes is not None else self._modes
        struct = HierarchyStructure(2 * self._modes, 1, mode='quadratic',
                                    pop_modes=2 * self._pop_modes)
        self._nr_aux_states = struct.entries
        self._prop = self._setup_propagator(struct)
Exemplo n.º 4
0
def test_coupling():
    H = HierarchyStructure(2, 3)
    print(H)
    vecind = [tuple(k) for k in H.vecind]

    i = vecind.index((1, 1))
    assert (1, 1) == tuple(H.vecind[i])
    assert (2, 1) == tuple(H.vecind[H.indab[i, 0]])
    assert (1, 2) == tuple(H.vecind[H.indab[i, 1]])
    assert (0, 1) == tuple(H.vecind[H.indbl[i, 0]])
    assert (1, 0) == tuple(H.vecind[H.indbl[i, 1]])

    i = vecind.index((3, 0))
    assert (3, 0) == tuple(H.vecind[i])
    assert INVALID_INDEX == H.indab[i, 0]
    assert INVALID_INDEX == H.indab[i, 1]
    assert (2, 0) == tuple(H.vecind[H.indbl[i, 0]])
    assert INVALID_INDEX == H.indbl[i, 1]
Exemplo n.º 5
0
def test_cutoff():
    H = HierarchyStructure(3, 2, cutoff=[-1, 1, 0])
    vecind = [tuple(k) for k in H.vecind]
    print(vecind)

    assert (0, 0, 0) in vecind

    assert (0, 1, 0) in vecind

    assert (1, 0, 0) in vecind
    assert (1, 1, 0) in vecind
    assert (2, 0, 0) in vecind

    assert (3, 0, 0) not in vecind
    assert (0, 0, 1) not in vecind
    assert (1, 1, 1) not in vecind
    assert (2, 1, 1) not in vecind
    assert (0, 1, 4) not in vecind
    assert (1, 0, 2) not in vecind

    assert H.entries == 5
Exemplo n.º 6
0
def test_quad_completeness():
    H = HierarchyStructure(2, 2, mode='quadratic')
    vecind = [tuple(k) for k in H.vecind]

    assert (0, 0) in vecind
    assert (0, 1) in vecind
    assert (0, 2) in vecind

    assert (1, 0) in vecind
    assert (1, 1) in vecind
    assert (1, 2) in vecind

    assert (2, 0) in vecind
    assert (2, 1) in vecind
    assert (2, 2) in vecind

    assert (1, 3) not in vecind
    assert (0, 8) not in vecind
    assert (4, 3) not in vecind

    assert H.entries == 9
Exemplo n.º 7
0
def simple_spectrum_hierarchy(depth, g, gamma, omega, h_sys, **kwargs):
    """Spectrum hierarchy with identical, independent baths with bcf
            alpha_i(t) = sum_j g_j * exp(-gamma_j|t| - ii * Omega_j * t)

    depth          -- depth of the hierarchy
    g[modes]       -- coupling strengths of the modes
    gamma[modes]   -- damping sof the modes
    omega[modes]   -- central frequencies of the modes
    h_sys[dim,dim] -- system hamiltonian

    Usage:
    hier = simple_spectrum_hierarchy(4, [1], [2], [3], [[1, 2], [2, 1]])
    psi = hier.get_trajectory(100, 20000)

    """
    dim = np.shape(h_sys)[0]
    struct = HierarchyStructure(len(g) * dim, depth)
    bath = {'g': [g for _ in range(dim)],
            'gamma': [gamma for _ in range(dim)],
            'Omega': [omega for _ in range(dim)]}

    return SpectrumHierarchyIntegrator(struct, bath, h_sys, **kwargs)
Exemplo n.º 8
0
def test_completeness():
    H = HierarchyStructure(2, 3)
    vecind = [tuple(k) for k in H.vecind]

    assert (0, 0) in vecind

    assert (1, 0) in vecind
    assert (0, 1) in vecind

    assert (2, 0) in vecind
    assert (1, 1) in vecind
    assert (0, 2) in vecind

    assert (3, 0) in vecind
    assert (2, 1) in vecind
    assert (1, 2) in vecind
    assert (0, 3) in vecind

    assert (1, 3) not in vecind
    assert (0, 8) not in vecind
    assert (4, 3) not in vecind

    assert H.entries == 10
Exemplo n.º 9
0
def test_quad_limited():
    H = HierarchyStructure(3, 2, pop_modes=2, mode='quadratic')
    vecind = [tuple(k) for k in H.vecind]

    assert (0, 0, 0) in vecind
    assert (0, 0, 1) in vecind
    assert (0, 0, 2) in vecind
    #-------------------------
    assert (0, 1, 0) in vecind
    assert (0, 1, 1) in vecind
    assert (0, 1, 2) in vecind

    assert (0, 2, 0) in vecind
    assert (0, 2, 1) in vecind
    assert (0, 2, 2) in vecind
    #-------------------------
    assert (1, 0, 0) in vecind
    assert (1, 0, 1) in vecind
    assert (1, 0, 2) in vecind

    assert (2, 0, 0) in vecind
    assert (2, 0, 1) in vecind
    assert (2, 0, 2) in vecind
    #-------------------------
    assert (1, 1, 0) in vecind
    assert (1, 2, 0) in vecind

    assert (2, 1, 0) in vecind
    assert (2, 2, 0) in vecind
    #-------------------------

    assert (1, 1, 1) not in vecind
    assert (2, 1, 1) not in vecind
    assert (0, 1, 4) not in vecind

    assert H.entries == 19