Example #1
0
def get_boson_boson_chain_hamiltonian(omega_0, c0, omega, t, cutoff_dim):
    """
        Returns local and coupling parts of the Spin-Boson model chain Hamiltonian
        used in Sec. 4.4.3 of the thesis.
    :param omega_0: Spin energy
    :param c0: Spin-Bath coupling
    :param omega: Bath energies
    :param t: Bath-bath couplings
    :param cutoff_dim: Local dimension of the impurity and bath
    :returns: List of local Hamiltonians, List of coupling Hamiltonians
    """
    # Local Hamiltonian of the System:
    sys_loc = omega_0 * fock.n(cutoff_dim)

    # Coupling between System and bath:
    sys_coupl = fock.a(cutoff_dim)

    # Local Hamiltonian of the bath
    fock_n = fock.n(cutoff_dim)
    bath_loc = [energy * fock_n for energy in omega]

    # Bath coupling
    bath_coupling_op = np.kron(fock.a(cutoff_dim), fock.a_dag(cutoff_dim)) + \
                       np.kron(fock.a_dag(cutoff_dim), fock.a(cutoff_dim))
    bath_bath_coupl = [coupling * bath_coupling_op for coupling in t]

    # Spin-Bath coupling
    spin_bath_coupl = c0 * (np.kron(sys_coupl, fock.a_dag(cutoff_dim)) +
                            np.kron(sys_coupl.conj().T, fock.a(cutoff_dim)))
    return [sys_loc] + bath_loc, [spin_bath_coupl] + bath_bath_coupl
Example #2
0
def test_unequal_site_dim_thermal_state_generation(L, system_index, beta, nof_steps, mpa_type):
    """
        Pytest test for generating a thermal state via imaginary time evolution for a chain with unequal site dimensions
    :param beta: Inverse temperature of the final state
    :param nof_steps: number of steps in the propagation grid
    :return:
    """
    sys_site_op = fock.n(3)
    bath_site_op = pauli.Z
    sys_couple_op = fock.a(3) + fock.a_dag(3)
    bath_couple_op = pauli.X
    seed = 42
    rank = 1

    exdiag_state, dims, ed_site_ops, ed_bond_ops, tm_state, tm_site_ops, tm_bond_ops = \
        star_test_generator.generate_irregular_mps_test(L, system_index, sys_site_op, bath_site_op,
                                                        sys_couple_op, bath_couple_op, seed=seed, rank=rank)
    op_compression = {'method': 'svd', 'relerr': 1e-12}
    state_compression = {'method': 'svd', 'relerr': 1e-10}
    exdiag_thermal = exdiag.generate_thermal_state(beta, dims, system_index, ed_site_ops, ed_bond_ops)
    # Setup for tMPS evolution
    tmps_thermal, info = thermal.from_hamiltonian(beta, mpa_type, system_index, tm_site_ops, tm_bond_ops,
                                                  nof_steps=nof_steps,
                                                  state_compression_kwargs=state_compression,
                                                  op_compression_kwargs=op_compression)
    if mpa_type == 'pmps':
        tmps_thermal = mp.pmps_to_mpo(tmps_thermal)
    normdiff = np.linalg.norm(exdiag_thermal - tmps_thermal.to_array_global().reshape(np.prod(dims, dtype=int),
                                                                                      np.prod(dims, dtype=int)))
    assert normdiff < 1e-8
Example #3
0
def test_irregular_chain(L, system_index, sot, nof_steps, tau):
    """
        Pytest test for time evolution of a mixed quantum state in mpo form under a Hamiltonian of the form:
        sum_i^L H_{i} + sum_j^(L-1) H_{system_index, j}
        where the H_(i) are called site ops and the H_{i, i+1} are called bond ops, constructed from ladder operators
        and pauli operators.
        The physical dimension of the system site is different from the bath sites
        Tests are performed for different chain lengths and different time discretizations
        The initial state is a random state
    :param L: Chain L
    :param system_index: Index of the system site in the chain
    :param sot: second order trotter evolution switch
    :param nof_steps: Number of time evolution steps
    :param tau: Timestep in each step of the time evolution
    :return:
    """
    sys_site_op = fock.n(3)
    bath_site_op = pauli.Z
    sys_couple_op = fock.a(3) + fock.a_dag(3)
    bath_couple_op = pauli.X
    seed = 42
    rank = 1

    exdiag_state, dims, ed_site_ops, ed_bond_ops, tm_state, tm_site_ops, tm_bond_ops = \
        star_test_generator.generate_irregular_mpo_test(L, system_index, sys_site_op, bath_site_op,
                                                        sys_couple_op, bath_couple_op, seed=seed, rank=rank)
    op_compression = {'method': 'svd', 'relerr': 1e-12}
    state_compression = {'method': 'svd', 'relerr': 1e-10}

    tm_prop = from_hamiltonian(tm_state,
                               'mpo',
                               system_index,
                               tm_site_ops,
                               tm_bond_ops,
                               tau=tau,
                               op_compression_kwargs=op_compression,
                               state_compression_kwargs=state_compression,
                               second_order_trotter=sot)

    ed_prop = StarExDiagPropagator(exdiag_state,
                                   dims,
                                   system_index,
                                   ed_site_ops,
                                   ed_bond_ops,
                                   tau,
                                   state_type='op')
    normdist = []
    for i in range(nof_steps):
        tm_prop.evolve()
        ed_prop.evolve()
        tmps_psi_t_array = mp.MPArray.to_array_global(tm_prop.psi_t).reshape(
            np.prod(dims, dtype=int), np.prod(dims, dtype=int))
        diff = tmps_psi_t_array - ed_prop.psi_t
        normdist.append(np.linalg.norm(diff))
    max_normdist = np.max(np.array(normdist))
    if sot:
        assert np.max(max_normdist) < 1e-6
    else:
        assert np.max(max_normdist) < 1e-8
Example #4
0
def test_pmps_thermal_state(L, dim, beta):
    """
        Pytest test for calculating the norm  of nearest neighbor Hamiltonians
        with equal site dimension
    :param L: Size of the chain
    :return:
    """
    n = fock.n(dim)
    thermal_exact = [np.diag(np.exp(-beta*np.diag(n)))/ np.sum(np.exp(-beta*np.diag(n)))]*L
    thermal_test = get_thermal_state(beta, [n]*L, 'pmps' , as_type='mparray_list', to_cform=None)
    normdist = []
    for exact, test in zip(thermal_exact, thermal_test):
        normdist.append(np.linalg.norm(exact - mp.MPArray.to_array_global(mp.pmps_to_mpo(test))))
    assert np.max(normdist) < 1e-8
Example #5
0
def get_boson_boson_star_hamiltonian(omega_0, system_index, gamma, xi,
                                     cutoff_dim):
    """
        Returns local and coupling parts of the Spin-Boson model star Hamiltonian
        used in Sec. 4.4.3 of the thesis.
    :param omega_0: Spin energy
    :param system_index: Index of the system in the auxiliary chain
    :param gamma: System-Bath couplings
    :param xi: Bath energies
    :param cutoff_dim: Local dimension of the impurity and bath
    :returns: List of local Hamiltonians, List of coupling Hamiltonians
    """
    # Local Hamiltonian of the System:
    sys_loc = omega_0 * fock.n(cutoff_dim)

    # Coupling between System and bath:
    sys_coupl = fock.a(cutoff_dim)

    # Local Hamiltonian of the bath
    fock_n = fock.n(cutoff_dim)
    bath_loc = [energy * fock_n for energy in xi]

    # Coupling operators for the bath to the left of the system
    left_bath_coupling_op = np.kron(fock.a(cutoff_dim), sys_coupl.conj().T) + \
                            np.kron(fock.a_dag(cutoff_dim), sys_coupl)
    left_bath_coupl = [
        coupling * left_bath_coupling_op for coupling in gamma[:system_index]
    ]
    # Coupling operators for the bath to the right of the system
    right_bath_coupling_op = np.kron(sys_coupl.conj().T, fock.a(cutoff_dim)) + \
                             np.kron(sys_coupl, fock.a_dag(cutoff_dim))
    right_bath_coupl = [
        coupling * right_bath_coupling_op for coupling in gamma[system_index:]
    ]
    return bath_loc[:system_index] + [
        sys_loc
    ] + bath_loc[system_index:], left_bath_coupl + right_bath_coupl
Example #6
0
def get_spin_boson_star_hamiltonian(omega_0,
                                    system_index,
                                    gamma,
                                    xi,
                                    bath_local_dim,
                                    finite_T=False):
    """
        Returns local and coupling parts of the Spin-Boson model star Hamiltonian
        used in Sec. 4.4.1 and 4.4.2 of the thesis.
    :param omega_0: Spin energy
    :param system_index: Index of the system in the auxiliary chain
    :param gamma: System-Bath couplings
    :param xi: Bath energies
    :param bath_local_dim: Local dimension of the bath
    :param finite_T: If set True uses the Hamiltonian for Sec. 4.4.2. If False builds the Hamiltonian for Sec. 4.4.1
    :returns: List of local Hamiltonians, List of coupling Hamiltonians
    """
    if not finite_T:
        # Local Hamiltonian of the System:
        spin_loc = omega_0 / 2 * pauli.X

        # Coupling between System and bath:
        spin_coupl = pauli.Z
    else:
        # Local Hamiltonian of the System:
        spin_loc = omega_0 / 2 * pauli.Z

        # Coupling between System and bath:
        spin_coupl = np.array([[0, 0], [1, 0]], dtype=np.complex128)

    # Local Hamiltonian of the bath
    fock_n = fock.n(bath_local_dim)
    bath_loc = [energy * fock_n for energy in xi]

    # Coupling operators for the bath to the left of the system
    left_bath_coupling_op = np.kron(fock.a(bath_local_dim), spin_coupl.conj().T) + \
                            np.kron(fock.a_dag(bath_local_dim), spin_coupl)
    left_bath_coupl = [
        coupling * left_bath_coupling_op for coupling in gamma[:system_index]
    ]
    # Coupling operators for the bath to the right of the system
    right_bath_coupling_op = np.kron(spin_coupl.conj().T, fock.a(bath_local_dim)) + \
                             np.kron(spin_coupl, fock.a_dag(bath_local_dim))
    right_bath_coupl = [
        coupling * right_bath_coupling_op for coupling in gamma[system_index:]
    ]
    return bath_loc[:system_index] + [
        spin_loc
    ] + bath_loc[system_index:], left_bath_coupl + right_bath_coupl
Example #7
0
def get_spin_boson_chain_hamiltonian(omega_0,
                                     c0,
                                     omega,
                                     t,
                                     bath_local_dim,
                                     finite_T=False):
    """
        Returns local and coupling parts of the Spin-Boson model chain Hamiltonian
        used in Sec. 4.4.1 and 4.4.2 of the thesis.
    :param omega_0: Spin energy
    :param c0: Spin-Bath coupling
    :param omega: Bath energies
    :param t: Bath-bath couplings
    :param bath_local_dim: Local dimension of the bath
    :param finite_T: If set True builds the Hamiltonian for Sec. 4.4.2. If False builds the Hamiltonian for Sec. 4.4.1
    :returns: List of local Hamiltonians, List of coupling Hamiltonians
    """
    if not finite_T:
        # Local Hamiltonian of the System:
        spin_loc = omega_0 / 2 * pauli.X

        # Coupling between System and bath:
        spin_coupl = pauli.Z
    else:
        # Local Hamiltonian of the System:
        spin_loc = omega_0 / 2 * pauli.Z

        # Coupling between System and bath:
        spin_coupl = np.array([[0, 0], [1, 0]], dtype=np.complex128)
    # Local Hamiltonian of the bath
    fock_n = fock.n(bath_local_dim)
    bath_loc = [energy * fock_n for energy in omega]

    # Bath coupling
    bath_coupling_op = np.kron(fock.a(bath_local_dim), fock.a_dag(bath_local_dim)) + \
                       np.kron(fock.a_dag(bath_local_dim), fock.a(bath_local_dim))
    bath_bath_coupl = [coupling * bath_coupling_op for coupling in t]

    # Spin-Bath coupling
    spin_bath_coupl = c0 * (
        np.kron(spin_coupl, fock.a_dag(bath_local_dim)) +
        np.kron(spin_coupl.conj().T, fock.a(bath_local_dim)))
    return [spin_loc] + bath_loc, [spin_bath_coupl] + bath_bath_coupl
Example #8
0
# Coupling between System and bath:
spin_coupl = pauli.Z

# Energies and couplings for the ohmic bath (see Chin et al., J. Math. Phys. 51, 092109 (2010)):
n = np.arange(N_bath)
omega = omega_c * (2 * n + 1 + s)
t = omega_c * np.sqrt((n[:-1] + 1) * (n[:-1] + s + 1))

# Spin-Bath coupling
c0 = np.sqrt(alpha * omega_c**2 * gamma(s + 1))

print('Building the Hamiltonian')

# Local Hamiltonian of the bath
fock_n = fock.n(loc_dim)
bath_loc = [energy * fock_n for energy in omega]

# Bath coupling
bath_coupling_op = np.kron(fock.a(loc_dim), fock.a_dag(loc_dim)) + \
                   np.kron(fock.a_dag(loc_dim), fock.a(loc_dim))
bath_bath_coupl = [coupling * bath_coupling_op for coupling in t]

# Spin-Bath coupling
spin_bath_coupl = c0 * (np.kron(spin_coupl, fock.a_dag(loc_dim)) +
                        np.kron(spin_coupl.conj().T, fock.a(loc_dim)))

# Create propagator object:
print('Creating the propagator')
propagator = tmps.chain.from_hamiltonian(
    psi_0,