Final: Fix task 4.3 except for some TODOs and comments
This commit is contained in:
@ -1339,6 +1339,7 @@
|
|||||||
" # And that indeed t[0] = 0*tau = 0.\n",
|
" # And that indeed t[0] = 0*tau = 0.\n",
|
||||||
" assert np.allclose(t[0], 0)\n",
|
" assert np.allclose(t[0], 0)\n",
|
||||||
" \n",
|
" \n",
|
||||||
|
" # TODO: What should the dtype be, should it be complex?\n",
|
||||||
" c = np.zeros(t.shape + c0.shape, dtype=c0.dtype)\n",
|
" c = np.zeros(t.shape + c0.shape, dtype=c0.dtype)\n",
|
||||||
" c[0] = c0\n",
|
" c[0] = c0\n",
|
||||||
" \n",
|
" \n",
|
||||||
@ -1440,16 +1441,7 @@
|
|||||||
"task": false
|
"task": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [],
|
||||||
{
|
|
||||||
"name": "stderr",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"/tmp/ipykernel_2000248/327551893.py:14: ComplexWarning: Casting complex values to real discards the imaginary part\n",
|
|
||||||
" c[j] = U@c[j - 1]\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"n = 100\n",
|
"n = 100\n",
|
||||||
"# TODO: Should one be able to pass a through everything?\n",
|
"# TODO: Should one be able to pass a through everything?\n",
|
||||||
@ -1460,15 +1452,18 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"H = TBHamiltonian(n, sigma)\n",
|
"H = TBHamiltonian(n, sigma)\n",
|
||||||
"U = getU_exact(tau, H)\n",
|
"U = getU_exact(tau, H)\n",
|
||||||
"#c0 = np.zeros(n, dtype=np.complex128)\n",
|
"# TODO: Is c0 complex?\n",
|
||||||
"c0 = np.zeros(n)\n",
|
"c0 = np.zeros(n, dtype=np.complex128)\n",
|
||||||
|
"#c0 = np.zeros(n)\n",
|
||||||
"c0[n//2] = 1\n",
|
"c0[n//2] = 1\n",
|
||||||
"\n",
|
"\n",
|
||||||
"c = timePropagate(U, c0, t)\n",
|
"c = timePropagate(U, c0, t)\n",
|
||||||
"xi = atomic_positions(n, a)\n",
|
"xi = atomic_positions(n, a)\n",
|
||||||
"psi = c@atomic_basis(x, xi, sigma).T\n",
|
"x = np.linspace(-1, 101, 150)\n",
|
||||||
"\n",
|
"# TODO: Does real-space wavefunction mean that it should be real or\n",
|
||||||
"x = np.linspace(-1, 11, 150)"
|
"# that we take the real part?\n",
|
||||||
|
"psi = np.real(c@atomic_basis(x, xi, sigma).T)\n",
|
||||||
|
"\n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1477,6 +1472,8 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"psi\n",
|
||||||
|
"\n",
|
||||||
"# This cell can be deleted!\n",
|
"# This cell can be deleted!\n",
|
||||||
"x = np.linspace(-1, 11, 150)\n",
|
"x = np.linspace(-1, 11, 150)\n",
|
||||||
"xi = atomic_positions(n, a)\n",
|
"xi = atomic_positions(n, a)\n",
|
||||||
@ -1488,8 +1485,8 @@
|
|||||||
"#print(psi)\n",
|
"#print(psi)\n",
|
||||||
"psi.shape\n",
|
"psi.shape\n",
|
||||||
"#psi[t][x]\n",
|
"#psi[t][x]\n",
|
||||||
"plt.plot(x, psi[30])\n",
|
"plt.plot(x, psi[20])\n",
|
||||||
"print(psi[2].shape, x.shape)"
|
"print(psi[100].shape, x.shape)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1521,8 +1518,8 @@
|
|||||||
"# create a figure for the animation\n",
|
"# create a figure for the animation\n",
|
||||||
"fig = plt.figure()\n",
|
"fig = plt.figure()\n",
|
||||||
"plt.grid(True)\n",
|
"plt.grid(True)\n",
|
||||||
"plt.xlim(-1, 11) # fix x limits\n",
|
"plt.xlim(-1, 101) # fix x limits\n",
|
||||||
"plt.ylim(-1e-6, 1e-6) # fix y limits\n",
|
"plt.ylim(-.5, .6) # fix y limits\n",
|
||||||
"plt.xlabel('$x$')\n",
|
"plt.xlabel('$x$')\n",
|
||||||
"plt.ylabel('$\\\\psi(t, x)$')\n",
|
"plt.ylabel('$\\\\psi(t, x)$')\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user