diff --git a/notebook/lattice-vibration/Molecule_Vibration.ipynb b/notebook/lattice-vibration/Molecule_Vibration.ipynb index 44fa107..e91b7c4 100644 --- a/notebook/lattice-vibration/Molecule_Vibration.ipynb +++ b/notebook/lattice-vibration/Molecule_Vibration.ipynb @@ -10,7 +10,7 @@ "\n", " Go back to index\n", "\n", - "**Source code:** https://github.com/osscar-org/quantum-mechanics/blob/develop/notebook/lattice-vibration/Molecule_Vibration.ipynb\n", + "**Source code:** https://github.com/osscar-org/quantum-mechanics/blob/master/notebook/lattice-vibration/Molecule_Vibration.ipynb\n", "\n", "\n", "With this notebook, the concept of molecular vibration is explored and visualized in an interactive fashion.\n", @@ -338,7 +338,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.12" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/notebook/lattice-vibration/NGLTrajectoryClass2D.py b/notebook/lattice-vibration/NGLTrajectoryClass2D.py index 4dccdd9..bb70b9d 100644 --- a/notebook/lattice-vibration/NGLTrajectoryClass2D.py +++ b/notebook/lattice-vibration/NGLTrajectoryClass2D.py @@ -162,10 +162,16 @@ def __init__(self, trajectory): self.kx_array = np.linspace(-1.5 * np.pi, 1.5 * np.pi, 61) self.ky_array = np.linspace(-1.5 * np.pi, 1.5 * np.pi, 61) self.KX, self.KY = np.meshgrid(self.kx_array, self.ky_array) - # Center of Brillouin zone - self.idx_x = 30 - self.idx_y = 30 + + # Initialize to nontrivial k-point + self.x=np.pi/2 + self.y=np.pi/2 + self.idx_x = (np.abs(self.kx_array - self.x)).argmin() + self.idx_y = (np.abs(self.ky_array - self.y)).argmin() + kx = self.kx_array[self.idx_x] + ky = self.ky_array[self.idx_y] + # kx,ky bounds are 1.5*BZ edge self.kx_array_honey = np.linspace(-1.5 * 2 * np.pi / 3, 1.5 * 2 * np.pi / 3, 61) @@ -176,8 +182,8 @@ def __init__(self, trajectory): self.KX_honey, self.KY_honey = np.meshgrid( self.kx_array_honey, self.ky_array_honey ) - self.idx_x_honey = 30 - self.idx_y_honey = 30 + self.idx_x_honey = 50 + self.idx_y_honey = 50 # View settings self.init_delay = 20 @@ -498,7 +504,15 @@ def initialize_2D_band_plot(self): self.ax.set_yticks(np.linspace(-np.pi, np.pi, 5)) self.ax.set_yticklabels(["$-\pi/a$", "", "0", "", "$\pi/a$"]) - (self.point,) = self.ax.plot([0], [0], ".", c="crimson", markersize=10) + + self.x=np.pi/2 + self.y=np.pi/2 + self.idx_x = (np.abs(self.kx_array - self.x)).argmin() + self.idx_y = (np.abs(self.ky_array - self.y)).argmin() + + kx = self.kx_array[self.idx_x] + ky = self.ky_array[self.idx_y] + (self.point,) = self.ax.plot([kx], [ky], ".", c="crimson", markersize=10) # TODO CHANGE INITIAL MARKER POS self.fig.canvas.mpl_connect("button_press_event", self.onclick) plt.ion() @@ -544,7 +558,20 @@ def initialize_paths_bands(self): self.ax_.plot([20, 20], [0, 10000], "k--") self.ax_.plot([40, 40], [0, 10000], "k--") - (self.point_,) = self.ax_.plot([], [], "r.", markersize=10) + + self.x=np.pi/2 + self.y=np.pi/2 + self.idx_x = (np.abs(self.kx_array - self.x)).argmin() + self.idx_y = (np.abs(self.ky_array - self.y)).argmin() + + kx = self.kx_array[self.idx_x] + ky = self.ky_array[self.idx_y] + + # default chosen to be on gamma-M + idx = np.where(np.all([kx, ky] == np.c_[self.kx_GM, self.ky_GM], axis=1))[ + 0 + ][0] + (self.point_,) = self.ax_.plot([idx], [self.w_long[self.idx_x][self.idx_y]], "r.", markersize=10) # Position of the high symmetry points self.ax_.set_xticks([0, 20, 40, 60]) diff --git a/notebook/lattice-vibration/NGLUtilsClass.py b/notebook/lattice-vibration/NGLUtilsClass.py index 6498d20..243c7c7 100644 --- a/notebook/lattice-vibration/NGLUtilsClass.py +++ b/notebook/lattice-vibration/NGLUtilsClass.py @@ -95,7 +95,7 @@ def __init__(self, trajectory) -> None: r"Arrow amplitude", layout=self.layout_description ) self.slider_amp_arrow = widgets.FloatSlider( - value=0.5, + value=2.0, min=0.1, max=5.01, step=0.1, diff --git a/notebook/lattice-vibration/Phonon_2D.ipynb b/notebook/lattice-vibration/Phonon_2D.ipynb index a929280..04b8f4f 100644 --- a/notebook/lattice-vibration/Phonon_2D.ipynb +++ b/notebook/lattice-vibration/Phonon_2D.ipynb @@ -10,7 +10,7 @@ "\n", " Go back to index\n", "\n", - "**Source code:** https://github.com/osscar-org/quantum-mechanics/blob/develop/notebook/lattice-vibration/Phonon_2D.ipynb\n", + "**Source code:** https://github.com/osscar-org/quantum-mechanics/blob/master/notebook/lattice-vibration/Phonon_2D.ipynb\n", "\n", "This notebook extends the notion of phonons to the 2D case. In this notebook, the link between the reciprocal space and the band dispersion plot along certain path is made explicit. The wave can now be transversal as opposed to longitudinal only in the 1D phonon case. A simple example, the square lattice, and a more complex one, the honeycomb lattice, are presented.\n", "
" @@ -27,6 +27,14 @@ "* Discover the importance of highly symmetrical points." ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## **Background theory** \n", + "[More on the background theory.](./theory/theory_phonon_2d.ipynb)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -100,7 +108,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -122,7 +130,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -135,7 +143,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -149,7 +157,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -186,10 +194,14 @@ "for widget in widgets:\n", " handler.widgetList.append(widget)\n", "\n", - "handler.tick_box_arrows.value = False\n", + "handler.slider_atom_radius.value=0.1\n", + "handler.slider_arrow_radius.value=0.05\n", + "handler.tick_box_arrows.value=True\n", + "handler.addArrows() # add arrows by default\n", + "\n", + "handler.tick_box_arrows.value = True\n", "handler.set_view_parameters(clipDist=1, quality=\"low\")\n", "# handler.slider_atom_radius.value = 0.1\n", - "handler.slider_arrow_radius.value = 0.1\n", "handler.set_player_parameters(delay=handler.init_delay)\n", "handler.set_view_dimensions()\n", "handler.button_lattice.observe(on_lattice_change,\"value\")\n", @@ -335,9 +347,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "%%html\n", "