From 6c3c0c24325f6d4e8aa6a03691c0487aa92acc83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Meyer-M=C3=B6lleringhof?= Date: Tue, 19 Nov 2024 17:48:22 +0900 Subject: [PATCH 01/16] Added first version of floquet speed test - added driven single qubit simulation with sesolve and floquet - added driven ising chain for specific dimension N --- .../024_v5_paper-floquet-speed-test.md | 320 ++++++++++++++++++ 1 file changed, 320 insertions(+) create mode 100644 tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md diff --git a/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md b/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md new file mode 100644 index 00000000..fa9f18ee --- /dev/null +++ b/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md @@ -0,0 +1,320 @@ +--- +jupyter: + jupytext: + text_representation: + extension: .md + format_name: markdown + format_version: '1.3' + jupytext_version: 1.13.8 + kernelspec: + display_name: qutip-tutorials-v5 + language: python + name: python3 +--- + +# QuTiPv5 Paper Example: Floquet Speed Test + +Authors: Maximilian Meyer-Mölleringhof + +## Introdcution + +In this example we will discuss Hamiltonians with period time-dependence and how we can solve the time evolution of the system in QuTiP. +A natural approach to this is using the Floquet theorem. +Similar to the Block theorem (for spatial periodicity), this method helps to drastically simplify the problem. +Let $H$ be a Hamiltonian periodic in time with period $T$, such that + +$H(t) = H(t + T)$ + +The Floquet theorem states that there exist solutions to the Schrödinger equation that take the form + +$\ket{\psi_\alpha (t)} = \exp(-i \epsilon_\alpha t / \hbar) \ket{\Psi_\alpha (t)}$, + +where $\epsilon_\alpha$ are the quasi-energies and $\ket{\Psi_\alpha (t)} = \ket{\Psi_\alpha (t + T)}$ the Floquet modes. +We can then write any solution of the time-dependent Schrödinger equation as a linear combination of them + +$\ket{\psi(t)} = \sum_\alpha c_\alpha \ket{\Psi_\alpha}$, + +where the constants $c_\alpha$ are determined by the initial conditions. + +Inserting the Floquet states above into the Schrödinger equation, we can define the Floquet Hamiltonian, + +$H_F(t) = H(t) - i \hbar \dfrac{\partial}{\partial t}$, + +which renders the problem time-independent, + +$H_F(t) \ket{\Psi_\alpha(t)} = \epsilon_\alpha \ket{\Psi_\alpha(t)}$. + +Solving this equation then allows us to find $\ket{\psi (t)}$ at any large $t$. + +Our goal in this notebook is to show, how this prcedure is done in QuTiP and how it compares to the standard `sesolve` method - specifically in terms of computation time. + +```python +import time + +import matplotlib.pyplot as plt +import numpy as np +from qutip import (CoreOptions, FloquetBasis, basis, expect, qeye, qzero_like, + sesolve, sigmax, sigmay, sigmaz, tensor) + +%matplotlib inline +``` + +## Two-level system with periodic drive + +We consider a two-level system that is exposed to a periodic drive: + +$H(t) = - \dfrac{\epsilon}{2} \sigma_z - \dfrac{\Delta}{2} \sigma_x + \dfrac{A}{2} \sin(\omega_d t) \sigma_x$, + +where $\epsilon$ is the energy splitting, $\Delta$ the coupling strength and $A$ the drive amplitude. + +```python +delta = 0.2 * 2 * np.pi +epsilon = 1.0 * 2 * np.pi +A = 2.5 * 2 * np.pi +omega = 1.0 * 2 * np.pi +T = 2 * np.pi / omega + +H0 = -1 / 2 * (epsilon * sigmaz() + delta * sigmax()) +H1 = A / 2 * sigmax() +args = {"w": omega} +H = [H0, [H1, lambda t, w: np.sin(w * t)]] +``` + +```python +psi0 = basis(2, 0) # initial condition + +# Numerical parameters +dt = 0.01 +N_T = 10 # Number of periods +tlist = np.arange(0.0, N_T * T, dt) +``` + +```python +computational_time_floquet = np.zeros_like(tlist) +computational_time_sesolve = np.zeros_like(tlist) + +expect_floquet = np.zeros_like(tlist) +expect_sesolve = np.zeros_like(tlist) +``` + +```python +# Running the simulation +for n, t in enumerate(tlist): + # Floquet basis + # -------------------------------- + tic_f = time.perf_counter() + floquetbasis = FloquetBasis(H, T, args) + # Decomposing inital state into Floquet modes + f_coeff = floquetbasis.to_floquet_basis(psi0) + # Obtain evolved state in the original basis + psi_t = floquetbasis.from_floquet_basis(f_coeff, t) + p_ex = expect(sigmaz(), psi_t) + toc_f = time.perf_counter() + + # Saving data + computational_time_floquet[n] = toc_f - tic_f + expect_floquet[n] = p_ex + + # sesolve + # -------------------------------- + tic_f = time.perf_counter() + psi_se = sesolve(H, psi0, tlist[: n + 1], e_ops=[sigmaz()], args=args) + p_ex_ref = psi_se.expect[0] + toc_f = time.perf_counter() + + # Saving data + computational_time_sesolve[n] = toc_f - tic_f + expect_sesolve[n] = p_ex_ref[-1] +``` + +```python +fig, axs = plt.subplots(1, 2, figsize=(13.6, 4.5)) +axs[0].plot(tlist / T, computational_time_floquet, "-") +axs[0].plot(tlist / T, computational_time_sesolve, "--") + +axs[0].set_yscale("log") +axs[0].set_yticks(np.logspace(-3, -1, 3)) +axs[1].plot(tlist / T, np.real(expect_floquet), "-") +axs[1].plot(tlist / T, np.real(expect_sesolve), "--") + +axs[0].set_xlabel(r"$t \, / \, T$") +axs[1].set_xlabel(r"$t \, / \, T$") +axs[0].set_ylabel(r"Computational Time [$s$]") +axs[1].set_ylabel(r"$\langle \sigma_z \rangle$") +axs[0].legend(("Floquet", "sesolve")) + +xticks = np.rint(np.linspace(0, N_T, N_T + 1, endpoint=True)) +axs[0].set_xticks(xticks) +axs[0].set_xlim([0, N_T]) +axs[1].set_xticks(xticks) +axs[1].set_xlim([0, N_T]) + +plt.show() +``` + +## One Dimensional Ising Chain + +As a second use case for the Floquet method, we look at the one-dimensional Ising chain with a periodic drive. +We describe such a system using the Hamiltonian + +$H(t) = g_0 \sum_{n=1}^N \sigma_z^{(n)} - J_0 \sum_{n=1}^{N - 1} \sigma_x^{(n)} \sigma_x^{(n+1)} + A \sin (\omega_d t) \sum_{n=1}^N \sigma_x^{(n)}$, + +where $g_0$ is the level splitting, $J_0$ is the nearest-neighbour coupling constant and $A$ is the drive amplitude. + +As outlined in the QuTiPv5 paper, it educational to study the dimensional scaling of the Floquet method compared to the standard `sesolve`. +Specifically how the crossing time (so when the Floquet method becomes faster) depends on the dimensions $N$. +Although we will not reproduce the whole plot, we implement the solution for one specific choice of $N$ and give the user the freedom to play with the paramteres. + +```python +N = 4 # number of spins +g0 = 1 # energy-splitting +J0 = 1.4 # coupling strength +A = 1.0 # drive strength +omega = 1.0 * 2 * np.pi # drive frequency +T = 2 * np.pi / omega # drive period +``` + +```python +# For Hamiltonian Setup +def setup_Ising_drive(N, g0, J0, A, omega, data_type="CSR"): + """ + # N : number of spins + # g0 : splitting, + # J0 : couplings + # A : drive amplitude + # omega: drive frequency + """ + with CoreOptions(default_dtype=data_type): + + sx_list, sy_list, sz_list = [], [], [] + for i in range(N): + op_list = [qeye(2)] * N + op_list[i] = sigmax().to(data_type) + sx_list.append(tensor(op_list)) + op_list[i] = sigmay().to(data_type) + sy_list.append(tensor(op_list)) + op_list[i] = sigmaz().to(data_type) + sz_list.append(tensor(op_list)) + + # Hamiltonian - Energy splitting terms + H_0 = 0.0 + for i in range(N): + H_0 += g0 * sz_list[i] + + # Interaction terms + H_1 = qzero_like(H_0) + for n in range(N - 1): + H_1 += -J0 * sx_list[n] * sx_list[n + 1] + + # Driving terms + if A > 0: + H_d = 0.0 + for i in range(N): + H_d += A * sx_list[i] + args = {"w": omega} + H = [H_0, H_1, [H_d, lambda t, w: np.sin(w * t)]] + else: + args = {} + H = [H_0, H_1] + + # Defining initial conditions + state_list = [basis(2, 1)] * (N - 1) + state_list.append(basis(2, 0)) + psi0 = tensor(state_list) + + # Defining expectation operator + e_ops = sz_list + return H, psi0, e_ops, args +``` + +```python +H, psi0, e_ops, args = setup_Ising_drive(N, g0, J0, A, omega) +``` + +```python +# Simulation parameters +N_T = 10 +dt = 0.01 +tlist = np.arange(0, N_T * T, dt) +tlist_0 = np.arange(0, T, dt) # One period tlist + +options = {"progress_bar": False, "store_floquet_states": True} +``` + +```python +computational_time_floquet = np.ones(tlist.shape) * np.nan +computational_time_sesolve = np.ones(tlist.shape) * np.nan + +expect_floquet = np.zeros((N, len(tlist))) +expect_sesolve = np.zeros((N, len(tlist))) +``` + +```python +# Running the simulation +for n, t in enumerate(tlist): + # Floquet basis + # -------------------------------- + tic_f = time.perf_counter() + if t < T: + # find the floquet modes for the time-dependent hamiltonian + floquetbasis = FloquetBasis(H, T, args) + else: + floquetbasis = FloquetBasis(H, T, args, precompute=tlist_0) + + # Decomposing inital state into Floquet modes + f_coeff = floquetbasis.to_floquet_basis(psi0) + # Obtain evolved state in the original basis + psi_t = floquetbasis.from_floquet_basis(f_coeff, t) + p_ex = expect(e_ops, psi_t) + toc_f = time.perf_counter() + + # Saving data + computational_time_floquet[n] = toc_f - tic_f + + # sesolve + # -------------------------------- + tic_f = time.perf_counter() + output = sesolve(H, psi0, tlist[: n + 1], e_ops=e_ops, args=args) + p_ex_r = output.expect + toc_f = time.perf_counter() + + # Saving data + computational_time_sesolve[n] = toc_f - tic_f + + for i in range(N): + expect_floquet[i, n] = p_ex[i] + expect_sesolve[i, n] = p_ex_r[i][-1] +``` + +```python +fig, axs = plt.subplots(1, 2, figsize=(12, 5)) +ax = axs[0] +axs[0].plot(tlist / T, computational_time_floquet, "-") +axs[0].plot(tlist / T, computational_time_sesolve, "--") + +axs[0].set_yscale("log") +axs[0].set_yticks(np.logspace(-3, -1, 3)) +lg = [] +for i in range(N): + axs[1].plot(tlist / T, np.real(expect_floquet[i, :]), "-") + lg.append(f"n={i+1}") +for i in range(N): + axs[1].plot(tlist / T, np.real(expect_sesolve[i, :]), "--", color="black") +lg.append("sesolve") + +axs[0].set_xlabel(r"$t \, / \, T$") +axs[1].set_xlabel(r"$t \, / \, T$") +axs[0].set_ylabel(r"$Computational \; Time,\; [s]$") +axs[1].set_ylabel(r"$\langle \sigma_z^{{(n)}} \rangle$") +axs[0].legend(("Floquet", "sesolve")) +axs[1].legend(lg) +xticks = np.rint(np.linspace(0, N_T, N_T + 1, endpoint=True)) +axs[0].set_xticks(xticks) +axs[0].set_xlim([0, N_T]) +axs[1].set_xticks(xticks) +axs[1].set_xlim([0, N_T]) +txt = f"$N={N}$, $g_0={g0}$, $J_0={J0}$, $A={A}$" +axs[0].text(0.0, 1.05, txt, transform=axs[0].transAxes) + +plt.show() +``` From 7b0dede1fcc77e711c22d5ffdeb089d3911a8db2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Meyer-M=C3=B6lleringhof?= Date: Thu, 21 Nov 2024 15:01:22 +0900 Subject: [PATCH 02/16] Added authors, completed standard layout - added authors - added about and test section - corrected kernelspec --- .../024_v5_paper-floquet-speed-test.md | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md b/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md index fa9f18ee..2f9fa6fa 100644 --- a/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md +++ b/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md @@ -7,14 +7,14 @@ jupyter: format_version: '1.3' jupytext_version: 1.13.8 kernelspec: - display_name: qutip-tutorials-v5 + display_name: Python 3 (ipykernel) language: python name: python3 --- # QuTiPv5 Paper Example: Floquet Speed Test -Authors: Maximilian Meyer-Mölleringhof +Authors: Maximilian Meyer-Mölleringhof (m.meyermoelleringhof@gmail.com), Neill Lambert (nwlambert@gmail.com) ## Introdcution @@ -53,8 +53,8 @@ import time import matplotlib.pyplot as plt import numpy as np -from qutip import (CoreOptions, FloquetBasis, basis, expect, qeye, qzero_like, - sesolve, sigmax, sigmay, sigmaz, tensor) +from qutip import (CoreOptions, FloquetBasis, about, basis, expect, qeye, + qzero_like, sesolve, sigmax, sigmay, sigmaz, tensor) %matplotlib inline ``` @@ -318,3 +318,15 @@ axs[0].text(0.0, 1.05, txt, transform=axs[0].transAxes) plt.show() ``` + +## About + +```python +about() +``` + +## Testing + +```python +# TODO +``` From f7d5f00a0049090d9c3c50048f242aaa715a6d7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Meyer-M=C3=B6lleringhof?= Date: Mon, 2 Dec 2024 14:51:33 +0900 Subject: [PATCH 03/16] Added author and tests --- .../time-evolution/024_v5_paper-floquet-speed-test.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md b/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md index 2f9fa6fa..8ea9d600 100644 --- a/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md +++ b/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md @@ -7,14 +7,14 @@ jupyter: format_version: '1.3' jupytext_version: 1.13.8 kernelspec: - display_name: Python 3 (ipykernel) + display_name: Python 3 language: python name: python3 --- # QuTiPv5 Paper Example: Floquet Speed Test -Authors: Maximilian Meyer-Mölleringhof (m.meyermoelleringhof@gmail.com), Neill Lambert (nwlambert@gmail.com) +Authors: Maximilian Meyer-Mölleringhof (m.meyermoelleringhof@gmail.com), Marc Gali (galilabarias.marc@aist.go.jp), Neill Lambert (nwlambert@gmail.com) ## Introdcution @@ -328,5 +328,8 @@ about() ## Testing ```python -# TODO +for i in range(N): + assert np.allclose( + np.real(expect_floquet[i, :]), np.real(expect_sesolve[i, :]), atol=1e-5 + ), f"floquet and sesolve solutions for Ising chain element {i} deviate." ``` From 7defa8ee41128b707d8bd0c45c93479b3795f778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Meyer-M=C3=B6lleringhof?= Date: Mon, 2 Dec 2024 15:11:11 +0900 Subject: [PATCH 04/16] Fixed typos, adjusted instructions - fixed many typos - insttructions resemble the paper less now --- .../024_v5_paper-floquet-speed-test.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md b/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md index 8ea9d600..45fb47b1 100644 --- a/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md +++ b/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md @@ -18,19 +18,19 @@ Authors: Maximilian Meyer-Mölleringhof (m.meyermoelleringhof@gmail.com), Marc G ## Introdcution -In this example we will discuss Hamiltonians with period time-dependence and how we can solve the time evolution of the system in QuTiP. +In this example we will discuss Hamiltonians with periodic time-dependence and how we can solve the time evolution of the system in QuTiP. A natural approach to this is using the Floquet theorem. -Similar to the Block theorem (for spatial periodicity), this method helps to drastically simplify the problem. -Let $H$ be a Hamiltonian periodic in time with period $T$, such that +Similar to the Bloch theorem (for spatial periodicity), this method helps to drastically simplify the problem. +Let $H$ be a time-dependent and periodic Hamiltonian with period $T$, such that $H(t) = H(t + T)$ -The Floquet theorem states that there exist solutions to the Schrödinger equation that take the form +Following Floquet's theorem, there exist solutions to the Schrödinger equation that take the form $\ket{\psi_\alpha (t)} = \exp(-i \epsilon_\alpha t / \hbar) \ket{\Psi_\alpha (t)}$, -where $\epsilon_\alpha$ are the quasi-energies and $\ket{\Psi_\alpha (t)} = \ket{\Psi_\alpha (t + T)}$ the Floquet modes. -We can then write any solution of the time-dependent Schrödinger equation as a linear combination of them +where $\ket{\Psi_\alpha (t)} = \ket{\Psi_\alpha (t + T)}$ are the Floquet modes and $\epsilon_\alpha$ are the quasi-energies. +Any solution of the Schrödinger equation can then be written as a linear combination $\ket{\psi(t)} = \sum_\alpha c_\alpha \ket{\Psi_\alpha}$, @@ -161,9 +161,9 @@ $H(t) = g_0 \sum_{n=1}^N \sigma_z^{(n)} - J_0 \sum_{n=1}^{N - 1} \sigma_x^{(n)} where $g_0$ is the level splitting, $J_0$ is the nearest-neighbour coupling constant and $A$ is the drive amplitude. -As outlined in the QuTiPv5 paper, it educational to study the dimensional scaling of the Floquet method compared to the standard `sesolve`. -Specifically how the crossing time (so when the Floquet method becomes faster) depends on the dimensions $N$. -Although we will not reproduce the whole plot, we implement the solution for one specific choice of $N$ and give the user the freedom to play with the paramteres. +As outlined in the QuTiPv5 paper, it's educational to study the dimensional scaling of the Floquet method compared to the standard `sesolve`. +Specifically how the crossing time (when the Floquet method becomes faster) depends on the dimensions $N$. +Although we will not reproduce the whole plot for computation time reasons, we implement the solution for one specific choice of $N$ and give the user the freedom to play with the paramteres. ```python N = 4 # number of spins From ff7559ad890125a601c70e921220b6902920e0a5 Mon Sep 17 00:00:00 2001 From: Paul Menczel Date: Mon, 2 Dec 2024 16:11:26 +0900 Subject: [PATCH 05/16] Small typos --- .../024_v5_paper-floquet-speed-test.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md b/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md index 45fb47b1..5d38a219 100644 --- a/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md +++ b/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md @@ -5,18 +5,18 @@ jupyter: extension: .md format_name: markdown format_version: '1.3' - jupytext_version: 1.13.8 + jupytext_version: 1.16.4 kernelspec: - display_name: Python 3 + display_name: Python 3 (ipykernel) language: python name: python3 --- # QuTiPv5 Paper Example: Floquet Speed Test -Authors: Maximilian Meyer-Mölleringhof (m.meyermoelleringhof@gmail.com), Marc Gali (galilabarias.marc@aist.go.jp), Neill Lambert (nwlambert@gmail.com) +Authors: Maximilian Meyer-Mölleringhof (m.meyermoelleringhof@gmail.com), Marc Gali (galilabarias.marc@aist.go.jp), Neill Lambert (nwlambert@gmail.com), Paul Menczel (paul@menczel.net) -## Introdcution +## Introduction In this example we will discuss Hamiltonians with periodic time-dependence and how we can solve the time evolution of the system in QuTiP. A natural approach to this is using the Floquet theorem. @@ -32,7 +32,7 @@ $\ket{\psi_\alpha (t)} = \exp(-i \epsilon_\alpha t / \hbar) \ket{\Psi_\alpha (t) where $\ket{\Psi_\alpha (t)} = \ket{\Psi_\alpha (t + T)}$ are the Floquet modes and $\epsilon_\alpha$ are the quasi-energies. Any solution of the Schrödinger equation can then be written as a linear combination -$\ket{\psi(t)} = \sum_\alpha c_\alpha \ket{\Psi_\alpha}$, +$\ket{\psi(t)} = \sum_\alpha c_\alpha \ket{\psi_\alpha(t)}$, where the constants $c_\alpha$ are determined by the initial conditions. @@ -46,7 +46,7 @@ $H_F(t) \ket{\Psi_\alpha(t)} = \epsilon_\alpha \ket{\Psi_\alpha(t)}$. Solving this equation then allows us to find $\ket{\psi (t)}$ at any large $t$. -Our goal in this notebook is to show, how this prcedure is done in QuTiP and how it compares to the standard `sesolve` method - specifically in terms of computation time. +Our goal in this notebook is to show how this procedure is done in QuTiP and how it compares to the standard `sesolve` method - specifically in terms of computation time. ```python import time @@ -163,7 +163,8 @@ where $g_0$ is the level splitting, $J_0$ is the nearest-neighbour coupling cons As outlined in the QuTiPv5 paper, it's educational to study the dimensional scaling of the Floquet method compared to the standard `sesolve`. Specifically how the crossing time (when the Floquet method becomes faster) depends on the dimensions $N$. -Although we will not reproduce the whole plot for computation time reasons, we implement the solution for one specific choice of $N$ and give the user the freedom to play with the paramteres. +Although we will not reproduce the whole plot for computation time reasons, we implement the solution for one specific choice of $N$. +Feel free to play around with the parameters! ```python N = 4 # number of spins From a4a83823fdd711facf0cee0e71c1ea3392f188a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Meyer-M=C3=B6lleringhof?= Date: Mon, 2 Dec 2024 16:26:43 +0900 Subject: [PATCH 06/16] Added references --- .../time-evolution/024_v5_paper-floquet-speed-test.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md b/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md index 5d38a219..fc7ecd63 100644 --- a/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md +++ b/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md @@ -19,7 +19,7 @@ Authors: Maximilian Meyer-Mölleringhof (m.meyermoelleringhof@gmail.com), Marc G ## Introduction In this example we will discuss Hamiltonians with periodic time-dependence and how we can solve the time evolution of the system in QuTiP. -A natural approach to this is using the Floquet theorem. +A natural approach to this is using the Floquet theorem [\[1, 2\]](#References). Similar to the Bloch theorem (for spatial periodicity), this method helps to drastically simplify the problem. Let $H$ be a time-dependent and periodic Hamiltonian with period $T$, such that @@ -320,6 +320,13 @@ axs[0].text(0.0, 1.05, txt, transform=axs[0].transAxes) plt.show() ``` +## References + +[1] [Floquet, Annales scientifiques de l’École Normale Supérieure (1883)](http://www.numdam.org/articles/10.24033/asens.220/) + +[2] [Shirley, Phys.Rev. (1965)](https://link.aps.org/doi/10.1103/PhysRev.138.B979) + + ## About ```python From e733b395f7feb0d0b85c2f710658ef18300c95f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Meyer-M=C3=B6lleringhof?= Date: Mon, 9 Dec 2024 14:21:47 +0900 Subject: [PATCH 07/16] Added v5 paper ref --- tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md b/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md index fc7ecd63..0567b391 100644 --- a/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md +++ b/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md @@ -326,6 +326,8 @@ plt.show() [2] [Shirley, Phys.Rev. (1965)](https://link.aps.org/doi/10.1103/PhysRev.138.B979) +[3] [QuTiP 5: The Quantum Toolbox in Python](https://arxiv.org/abs/2412.04705) + ## About From fd16c0b6f0e45d5134e4c79590f054648b3dd8d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Meyer-M=C3=B6lleringhof?= Date: Mon, 14 Apr 2025 16:58:54 +0900 Subject: [PATCH 08/16] Updated tutorial index html structure, temporary change of download links in workflow --- .github/workflows/notebook_ci.yaml | 16 +++++++++++----- website/index.html.jinja | 20 ++++++++++++-------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.github/workflows/notebook_ci.yaml b/.github/workflows/notebook_ci.yaml index 887e44a7..1f48965b 100644 --- a/.github/workflows/notebook_ci.yaml +++ b/.github/workflows/notebook_ci.yaml @@ -133,15 +133,21 @@ jobs: # Download resources from qutip.github.io repository mkdir css cd css - wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/css/bootstrap.css - wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/css/site.css + # wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/css/bootstrap.css + # wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/css/site.css + wget https://raw.githubusercontent.com/langhaarzombie/langhaarzombie.github.io/develop/css/site.css cd .. mkdir _includes cd _includes - wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/_includes/footer.html - wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/_includes/header.html - wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/_includes/navbar.html + # wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/_includes/head.html + # wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/_includes/navbar.html + # wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/_includes/footer.html + # wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/_includes/scripts.html + wget https://raw.githubusercontent.com/langhaarzombie/langhaarzombie.github.io/develop/_includes/head.html + wget https://raw.githubusercontent.com/langhaarzombie/langhaarzombie.github.io/develop/_includes/navbar.html + wget https://raw.githubusercontent.com/langhaarzombie/langhaarzombie.github.io/develop/_includes/footer.html + wget https://raw.githubusercontent.com/langhaarzombie/langhaarzombie.github.io/develop/_includes/scripts.html cd .. mkdir images diff --git a/website/index.html.jinja b/website/index.html.jinja index 0e403d24..bab00daa 100644 --- a/website/index.html.jinja +++ b/website/index.html.jinja @@ -1,10 +1,10 @@ ---- -title: QuTiP Tutorials ---- -{% raw %} -{% include header.html %} -{% include navbar.html %} -{% endraw %} + + + +{% raw %} {% include head.html %} {% endraw %} + + +
{% raw %} {% include navbar.html %} {% endraw %}
@@ -184,5 +184,9 @@ a complete archive of older versions of the tutorials is maintained there.
{% raw %} -{% include footer.html %} +
{% include footer.html %}
+{% include scripts.html %} {% endraw %} + + + \ No newline at end of file From d94dbc6f838525df2f4ebb5ab3e331c196890c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Meyer-M=C3=B6lleringhof?= Date: Mon, 14 Apr 2025 18:39:21 +0900 Subject: [PATCH 09/16] Temporary worklfow change to trigger page build in fork --- .github/workflows/notebook_ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/notebook_ci.yaml b/.github/workflows/notebook_ci.yaml index 1f48965b..4e06af15 100644 --- a/.github/workflows/notebook_ci.yaml +++ b/.github/workflows/notebook_ci.yaml @@ -110,7 +110,7 @@ jobs: publish: needs: pytests runs-on: ubuntu-latest - if: ${{ github.repository == 'qutip/qutip-tutorials' && github.ref == 'refs/heads/main' }} + # if: ${{ github.repository == 'qutip/qutip-tutorials' && github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 From 6acab30763ad886a8b17870f4d87bc0c01c3b657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Meyer-M=C3=B6lleringhof?= Date: Tue, 15 Apr 2025 11:05:56 +0900 Subject: [PATCH 10/16] re-added liquid header --- website/index.html.jinja | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/website/index.html.jinja b/website/index.html.jinja index bab00daa..62126c3c 100644 --- a/website/index.html.jinja +++ b/website/index.html.jinja @@ -1,3 +1,7 @@ +--- +title: QuTiP Tutorials +--- + From 5fb9229b3ef03515e5e36973918a28c5c8dc7689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Meyer-M=C3=B6lleringhof?= Date: Tue, 15 Apr 2025 13:45:31 +0900 Subject: [PATCH 11/16] Added container for centering, logo for nav bar --- .github/workflows/notebook_ci.yaml | 1 + website/index.html.jinja | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.github/workflows/notebook_ci.yaml b/.github/workflows/notebook_ci.yaml index 4e06af15..d2b5211a 100644 --- a/.github/workflows/notebook_ci.yaml +++ b/.github/workflows/notebook_ci.yaml @@ -153,6 +153,7 @@ jobs: mkdir images cd images wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/images/favicon.ico + wget https://raw.githubusercontent.com/langhaarzombie/langhaarzombie.github.io/develop/images/logo_small.png cd .. # build the website diff --git a/website/index.html.jinja b/website/index.html.jinja index 62126c3c..877bfbac 100644 --- a/website/index.html.jinja +++ b/website/index.html.jinja @@ -10,6 +10,7 @@ title: QuTiP Tutorials
{% raw %} {% include navbar.html %} {% endraw %}
+

{{ title }}


@@ -186,6 +187,7 @@ a complete archive of older versions of the tutorials is maintained there.
+
{% raw %}
{% include footer.html %}
From fc1f20088267dcbf5909763a209a0a74efb611a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Meyer-M=C3=B6lleringhof?= Date: Wed, 16 Apr 2025 11:03:52 +0900 Subject: [PATCH 12/16] Prevent line break before version number --- website/create_index.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/create_index.py b/website/create_index.py index 847dbdb8..1207c565 100644 --- a/website/create_index.py +++ b/website/create_index.py @@ -149,7 +149,7 @@ def main(): root_folder = pathlib.Path(__file__).parent.parent if args.qutip_version == "v4": - title = "Tutorials for QuTiP Version 4" + title = "Tutorials for QuTiP Version 4" tutorials_folder = root_folder / "tutorials-v4" version_note = """ These are the tutorials for QuTiP Version 4. You can @@ -157,7 +157,7 @@ def main(): here. """.strip() elif args.qutip_version == "v5": - title = "Tutorials for QuTiP Version 5" + title = "Tutorials for QuTiP Version 5" tutorials_folder = root_folder / "tutorials-v5" version_note = """ These are the tutorials for QuTiP Version 5. You can From 7fd9e6eb34fa1d953d05d8f5047190f8da3bee3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Meyer-M=C3=B6lleringhof?= Date: Wed, 7 May 2025 17:39:52 +0900 Subject: [PATCH 13/16] Reverted wget to qutip repo files --- .github/workflows/notebook_ci.yaml | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/notebook_ci.yaml b/.github/workflows/notebook_ci.yaml index d2b5211a..b428b698 100644 --- a/.github/workflows/notebook_ci.yaml +++ b/.github/workflows/notebook_ci.yaml @@ -110,7 +110,7 @@ jobs: publish: needs: pytests runs-on: ubuntu-latest - # if: ${{ github.repository == 'qutip/qutip-tutorials' && github.ref == 'refs/heads/main' }} + if: ${{ github.repository == 'qutip/qutip-tutorials' && github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 @@ -133,21 +133,15 @@ jobs: # Download resources from qutip.github.io repository mkdir css cd css - # wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/css/bootstrap.css - # wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/css/site.css - wget https://raw.githubusercontent.com/langhaarzombie/langhaarzombie.github.io/develop/css/site.css + wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/css/site.css cd .. mkdir _includes cd _includes - # wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/_includes/head.html - # wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/_includes/navbar.html - # wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/_includes/footer.html - # wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/_includes/scripts.html - wget https://raw.githubusercontent.com/langhaarzombie/langhaarzombie.github.io/develop/_includes/head.html - wget https://raw.githubusercontent.com/langhaarzombie/langhaarzombie.github.io/develop/_includes/navbar.html - wget https://raw.githubusercontent.com/langhaarzombie/langhaarzombie.github.io/develop/_includes/footer.html - wget https://raw.githubusercontent.com/langhaarzombie/langhaarzombie.github.io/develop/_includes/scripts.html + wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/_includes/head.html + wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/_includes/navbar.html + wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/_includes/footer.html + wget https://raw.githubusercontent.com/qutip/qutip.github.io/master/_includes/scripts.html cd .. mkdir images From c0f2def0eceedc908b496a820cda39752e428371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Meyer-M=C3=B6lleringhof?= Date: Tue, 13 May 2025 13:39:00 +0900 Subject: [PATCH 14/16] Updated file name index --- ...r-floquet-speed-test.md => 025_v5_paper-floquet-speed-test.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tutorials-v5/time-evolution/{024_v5_paper-floquet-speed-test.md => 025_v5_paper-floquet-speed-test.md} (100%) diff --git a/tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md b/tutorials-v5/time-evolution/025_v5_paper-floquet-speed-test.md similarity index 100% rename from tutorials-v5/time-evolution/024_v5_paper-floquet-speed-test.md rename to tutorials-v5/time-evolution/025_v5_paper-floquet-speed-test.md From c3eda9322c2b1cdbc89877c02f975776d68f4730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Meyer-M=C3=B6lleringhof?= Date: Fri, 16 May 2025 13:00:56 +0900 Subject: [PATCH 15/16] Trigger build --- tutorials-v5/time-evolution/025_v5_paper-floquet-speed-test.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials-v5/time-evolution/025_v5_paper-floquet-speed-test.md b/tutorials-v5/time-evolution/025_v5_paper-floquet-speed-test.md index 0567b391..5eb40801 100644 --- a/tutorials-v5/time-evolution/025_v5_paper-floquet-speed-test.md +++ b/tutorials-v5/time-evolution/025_v5_paper-floquet-speed-test.md @@ -18,7 +18,7 @@ Authors: Maximilian Meyer-Mölleringhof (m.meyermoelleringhof@gmail.com), Marc G ## Introduction -In this example we will discuss Hamiltonians with periodic time-dependence and how we can solve the time evolution of the system in QuTiP. +In this example we will discuss Hamiltonians with a periodic time-dependence and how we can solve the time evolution of the system in QuTiP. A natural approach to this is using the Floquet theorem [\[1, 2\]](#References). Similar to the Bloch theorem (for spatial periodicity), this method helps to drastically simplify the problem. Let $H$ be a time-dependent and periodic Hamiltonian with period $T$, such that From 6c6a6d7e300b2a4b42740fbfc97b76e1cf590780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Meyer-M=C3=B6lleringhof?= Date: Fri, 16 May 2025 15:03:26 +0900 Subject: [PATCH 16/16] trigger build --- tutorials-v5/time-evolution/025_v5_paper-floquet-speed-test.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials-v5/time-evolution/025_v5_paper-floquet-speed-test.md b/tutorials-v5/time-evolution/025_v5_paper-floquet-speed-test.md index 5eb40801..0567b391 100644 --- a/tutorials-v5/time-evolution/025_v5_paper-floquet-speed-test.md +++ b/tutorials-v5/time-evolution/025_v5_paper-floquet-speed-test.md @@ -18,7 +18,7 @@ Authors: Maximilian Meyer-Mölleringhof (m.meyermoelleringhof@gmail.com), Marc G ## Introduction -In this example we will discuss Hamiltonians with a periodic time-dependence and how we can solve the time evolution of the system in QuTiP. +In this example we will discuss Hamiltonians with periodic time-dependence and how we can solve the time evolution of the system in QuTiP. A natural approach to this is using the Floquet theorem [\[1, 2\]](#References). Similar to the Bloch theorem (for spatial periodicity), this method helps to drastically simplify the problem. Let $H$ be a time-dependent and periodic Hamiltonian with period $T$, such that