<jupyter_start><jupyter_text>Dynamics through spectral density A spin in a spin bath Consider the example of simulating the Markovian dynamics of a spin in a spin bath at thermal equilibrium. Assume the global system Hamiltonian is of the form:$$H= H_S + H_B + H_I = -\frac12 Z_0-\frac12\sum_{k=1}^8\omega_kZ_k+\frac12X\otimes\sum_{k=1}^8c_kX_k\newcommand{\ket}[1]{\left|{1}\right\rangle} \newcommand{\bra}[1]{\left\langle{1}\right|}$$where the index $0$ refers to the system spin and indexes $k=1,...,8$ refer to the bath spins. The $(\omega_k)$ coefficients are the frequencies of the environment modes and $(c_k)$ the coupling constants. Assume the spectral density of the spin bath is expressed as:$$J(\omega)=2\pi\alpha\omega e^{-\omega/\omega_c}$$Set $\alpha = 2\cdot10^{-4}$, $\omega_c/\Delta_0=100$, $\beta\Delta_0=1$. Furthermore, $\omega_k/\Delta_0=0.8+0.05k$ and $\Delta_0\tau=30$ where $\tau$ is the time length for a single updation. The density matrix could be initialised to a purely excited state of $H_S = -\frac{1}{2}Z_0$: $\ket{1}\bra{1}$. For simplicity, choose $\Delta_0$ = 1.  1. Initial density matrixWith the help of Qiskit's quantum_info module, create a DensityMatrix corresponding to a purely excited state $\ket{1}\bra{1}$.  2. Computation of coupling constantsDefine a function taking as input an environment mode frequency and returning the coupling between this mode and the system. You may use: $$\int_{\omega_k-\Delta\omega/2}^{\omega_k+\Delta\omega/2}J(\omega)d\omega=\pi c_k^2$$with $\Delta\omega/\Delta_0=0.05$ in this case.<jupyter_code>def coupling():
    return 0.<jupyter_output><empty_output><jupyter_text>3. Thermalised bath density matrixCompute the temperature $T$ dependent thermalised density matrix $\rho_B(T)$, following a Boltzmann distribution. The following relation may be useful:$$ \rho_B(T) = \bigotimes_{k=1}^d \rho^{(k)}_B(T)$$where $$\rho^{(k)}_B(T) = (1-p_k)\ket{0}\bra{0}+p_k\ket{1}\bra{1} $$with $p_k=(1+e^{\beta\omega_k})^{-1}$. The .tensor method may be useful.<jupyter_code>def environment_density_matrix():
    return 0.<jupyter_output><empty_output><jupyter_text>4. Global System evoluiton operator U(t) in Trotter-Suzuki formula Construct the evolution operator that applies on the global system for time length $\tau$, which is denoted by U($\tau$). It could be decomposed to simpler rotation terms with the formula:$$U(\tau) = exp[-iH\tau] = \lim_{n->\infty} \left[e^{-i\frac{H_S}{\tau}}e^{-i\frac{H_{B_1}}{\tau}}e^{-i\frac{H_{I_1}}{\tau}}...e^{-i\frac{H_{B_8}}{\tau}}e^{-i\frac{H_{I_8}}{\tau}}\right]$$with$$H_S = -\frac{1}{2}Z_0, H_{B_k} = -\frac{1}{2}\omega_k Z_k, H_{I_k} = \frac{1}{2}X\otimes c_kX_k$$You may use Qiskit's QuantumCircuit or Operator to compose an approximate evolution operator with finite n.<jupyter_code>def Evolution_Operator():
    return 0.<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16201117318435754, 'fraction_numerical': 0.027932960893854747, 'mean_word_length': 5.2967032967032965, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '359586', 'license': 'Apache-2.0', 'n_tokens_mistral': 990, 'n_tokens_neox': 951, 'n_words': 284, 'path': 'Guided_exercises/Dissipative_dynamics.ipynb', 'repo_name': 'Sager611/Quantum_Hackathon_2021', 'size': '2864'}