From 97c04d0f2546b4cf2e70231944a4ad06d12be288 Mon Sep 17 00:00:00 2001 From: Taylor Date: Thu, 12 Oct 2023 16:12:41 +0200 Subject: [PATCH] Allow user to modify and visualize the potential OTF. --- notebook/quantum-mechanics/msoft.ipynb | 38 ++++++++++++++------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/notebook/quantum-mechanics/msoft.ipynb b/notebook/quantum-mechanics/msoft.ipynb index cb8501a..95bb6d6 100644 --- a/notebook/quantum-mechanics/msoft.ipynb +++ b/notebook/quantum-mechanics/msoft.ipynb @@ -76,7 +76,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 8, "id": "af938e9c", "metadata": {}, "outputs": [], @@ -84,7 +84,7 @@ "\"\"\"\n", "Notebook demonstrating the use of the MSOFT algorithm for quantum dynamics.\n", "\"\"\"\n", - "%matplotlib ipympl\n", + "%matplotlib widget\n", "import numpy as np\n", "from math import pi\n", "from numpy.fft import fft as fft\n", @@ -102,7 +102,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 9, "id": "e04d5db5", "metadata": {}, "outputs": [], @@ -243,7 +243,7 @@ " def _get_potential_energy(self, Nsteps):\n", " epot = sum(np.conj(self.psi_x[:,0])*self.h[:,0,0]*self.psi_x[:,0] + \\\n", " np.conj(self.psi_x[:,0])*self.h[:,0,1]*self.psi_x[:,1] + \\\n", - " np.conj(self.psi_x[:,1])*self.h[:,0,1]*self.psi_x[:,0] + \\\n", + " np.conj(self.psi_x[:,1])*self.h[:,1,0]*self.psi_x[:,0] + \\\n", " np.conj(self.psi_x[:,1])*self.h[:,1,1]*self.psi_x[:,1] )*self.dx\n", " self.epot[int(self.t/self.dt)] = np.real(epot)\n", "\n", @@ -274,7 +274,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 10, "id": "8056c5b0", "metadata": {}, "outputs": [], @@ -325,7 +325,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 11, "id": "9fd44a50", "metadata": {}, "outputs": [], @@ -376,14 +376,14 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 15, "id": "2b699f3d", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "36ab3f1aab3f480e96b8b453ceb610be", + "model_id": "5d395b2b21c24046ad6d6361add28e98", "version_major": 2, "version_minor": 0 }, @@ -397,7 +397,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "9738d2f57db2421e923a92913f85630a", + "model_id": "cdafe23deb834e7eb633251c48452c35", "version_major": 2, "version_minor": 0 }, @@ -584,13 +584,15 @@ " # pot_prev_V2_ad_x_line, = pot_ax.plot(S.x, S.E_eigvals[:,1], c='cyan')#, label=r'$V_{ad}(x)$')\n", " # pot_prev_V1_di_x_line, = pot_ax.plot(S.x, S.h[:,0,0], c='green', label=r'$V_{di}(x)$')\n", " # pot_prev_V2_di_x_line, = pot_ax.plot(S.x, S.h[:,1,1], c='green')#, label=r'$V_{di}(x)$')\n", - " # pot_prev_V2_di_coupling_x_line, = pot_ax.plot(S.x,S.h[:1,0], c='red', label='$h_{12}(x)$')#, label=r'$V_{di}(x)$')\n", + "# pot_prev_V2_di_coupling_x_line, = pot_ax.plot(S.x,S.h[:,1,0], c='red', label='$h_{12}(x)$')#, label=r'$V_{di}(x)$')\n", " # pot_ax.legend()\n", + " pot_prev_V2_di_coupling_x_line.set_data(S.x,S.h[:,1,0])#, label=r'$V_{di}(x)$')\n", + "\n", " pot_prev_V1_ad_x_line.set_data(S.x, S.E_eigvals[:,0])#, c='purple', label=r'$V_{ad}(x)$')\n", " pot_prev_V2_ad_x_line.set_data(S.x, S.E_eigvals[:,1])#,c='purple')\n", " pot_prev_V1_di_x_line.set_data(S.x, S.h[:,0,0])#, c='green', label=r'$V_{di}(x)$')\n", " pot_prev_V2_di_x_line.set_data(S.x, S.h[:,1,1])#,c ='green')\n", - " #pot_prev_V2_di_coupling_x_line.set_data(S.x,0.1*np.ones(len(S.h)))#, c='red', label='$h_{12}(x)$')\n", + "# pot_prev_V2_di_coupling_x_line.set_data(S.x,0.1*np.ones(len(S.h)))#, c='red', label='$h_{12}(x)$')\n", " S.evolution(1)\n", "\n", "\n", @@ -610,14 +612,14 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 13, "id": "b19b0ff6", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "10835ccaa2b8438a9b2f8282ef552bc2", + "model_id": "e102426b9323454c8710d188dd555974", "version_major": 2, "version_minor": 0 }, @@ -690,7 +692,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 14, "id": "30286f7c", "metadata": { "tags": [] @@ -706,7 +708,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "818118610dd44191a74310c72993e0bf", + "model_id": "518d73fad551454882ec94287e7faead", "version_major": 2, "version_minor": 0 }, @@ -731,7 +733,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "59280bcfc1fa4370bc09718703991588", + "model_id": "0ff114d986e844fab740d2f00ce5ac02", "version_major": 2, "version_minor": 0 }, @@ -745,7 +747,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "62887066e63741ba8479efb064f17c01", + "model_id": "c7d8d84df2024e6e84d555705772c748", "version_major": 2, "version_minor": 0 }, @@ -1030,7 +1032,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.11.6" } }, "nbformat": 4,