From 58f899ddbe8de01ca008ca78c2c977381d23989b Mon Sep 17 00:00:00 2001 From: Dou Du Date: Sat, 27 Apr 2024 15:47:56 +0200 Subject: [PATCH] fix the pseudopotential bugs --- notebook/band-theory/pseudopotential.ipynb | 67 +++++++++++++--------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/notebook/band-theory/pseudopotential.ipynb b/notebook/band-theory/pseudopotential.ipynb index 36c4611..a0fdb13 100644 --- a/notebook/band-theory/pseudopotential.ipynb +++ b/notebook/band-theory/pseudopotential.ipynb @@ -277,7 +277,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "scrolled": true + }, "outputs": [], "source": [ "img = plt.figure(tight_layout=True, figsize=(9,9))\n", @@ -395,13 +397,13 @@ " x1 = np.arange(0, 50.0, 0.01)\n", " y1 = rf(x1)*x1\n", " line_rho.set_data([x1, y1])\n", - " line_rc1.set_data(s_rc.value, [-1, 1])\n", + " line_rc1.set_data([s_rc.value], [-1, 1])\n", " ann_rc.set_position((s_rc.value + 1.0, rf(s_rc.value)*s_rc.value))\n", "\n", " x2 = np.arange(0, 50.0, 0.01)\n", " y2 = (rf(x2)*x2)**2\n", " line_rho2.set_data([x2, y2])\n", - " line_rc2.set_data(s_rc.value, [-1, 1])\n", + " line_rc2.set_data([s_rc.value], [-1, 1])\n", " ann_rc2.set_position((s_rc.value + 1.0, (rf(s_rc.value)*s_rc.value)**2))\n", " \n", "\n", @@ -420,17 +422,19 @@ " line_logdr_ps.set_data([],[])\n", " \n", " # line_logdr_rho.set_data([x3, y3])\n", - " line_rc3.set_data(s_rc.value, [-1, 1])\n", - " line_rc4.set_data(s_rc.value, [-1, 1])\n", + " line_rc3.set_data([s_rc.value], [-1, 1])\n", + " line_rc4.set_data([s_rc.value], [-1, 1])\n", "\n", " ann_rc2.set_position((s_rc.value + 1.0, (rf(s_rc.value)*s_rc.value)**2))\n", " \n", - " \n", - "\n", - " ax1.collections.clear()\n", - " ax2.collections.clear()\n", - " ax3.collections.clear()\n", + " for line in ax1.collections:\n", + " line.remove()\n", + " \n", + " for line in ax2.collections:\n", + " line.remove()\n", "\n", + " for line in ax3.collections:\n", + " line.remove()\n", "\n", " ax2.fill_between(x2, y2, 0, where=x2