Skip to content

Commit

Permalink
Allow user to modify and visualize the potential OTF.
Browse files Browse the repository at this point in the history
  • Loading branch information
Taylor-96 committed Oct 12, 2023
1 parent 6e6f287 commit 97c04d0
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions notebook/quantum-mechanics/msoft.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 8,
"id": "af938e9c",
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\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",
Expand All @@ -102,7 +102,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 9,
"id": "e04d5db5",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -274,7 +274,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 10,
"id": "8056c5b0",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -325,7 +325,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 11,
"id": "9fd44a50",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -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
},
Expand All @@ -397,7 +397,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9738d2f57db2421e923a92913f85630a",
"model_id": "cdafe23deb834e7eb633251c48452c35",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -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",
Expand All @@ -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
},
Expand Down Expand Up @@ -690,7 +692,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 14,
"id": "30286f7c",
"metadata": {
"tags": []
Expand All @@ -706,7 +708,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "818118610dd44191a74310c72993e0bf",
"model_id": "518d73fad551454882ec94287e7faead",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -731,7 +733,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "59280bcfc1fa4370bc09718703991588",
"model_id": "0ff114d986e844fab740d2f00ce5ac02",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -745,7 +747,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "62887066e63741ba8479efb064f17c01",
"model_id": "c7d8d84df2024e6e84d555705772c748",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -1030,7 +1032,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 97c04d0

Please sign in to comment.