diff --git a/widgets/.ipynb_checkpoints/widget_bzvisualizer-checkpoint.ipynb b/widgets/.ipynb_checkpoints/widget_bzvisualizer-checkpoint.ipynb index 3ff2253..6496ac0 100644 --- a/widgets/.ipynb_checkpoints/widget_bzvisualizer-checkpoint.ipynb +++ b/widgets/.ipynb_checkpoints/widget_bzvisualizer-checkpoint.ipynb @@ -6,7 +6,8 @@ "metadata": {}, "source": [ "# `widget-bzvisualizer`: A Jupyter widget to visualize the 1st Brillouin zone and band paths\n", - "**Source code**: https://github.com/osscar-org/widget-bzvisualizer\n", + "\n", + "**Source code**: [https://github.com/osscar-org/widget-bzvisualizer](https://github.com/osscar-org/widget-bzvisualizer) \n", "\n", "**Introduction**: A Jupyter widget to plot the 1st Brillouin zone and band paths. \n", "It uses the Javascript package [tools-seekpath](https://seekpath.readthedocs.io) developed \n", @@ -52,10 +53,27 @@ "metadata": {}, "outputs": [], "source": [ - "lattice = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])\n", + "from widget_bzvisualizer import BZVisualizer\n", + "\n", + "cell = [\n", + " [5.0, 0.0, 0.0],\n", + " [0.0, 5.0, 0.0],\n", + " [0.0, 0.0, 5.0],\n", + "]\n", + "# atomic coordinates in terms of unit vectors\n", + "rel_coords = [[0.0, 0.0, 0.0]]\n", + "# element numbers of atoms\n", + "atom_numbers = [6]\n", "\n", - "w = BZVisualizer(lattice, [[0.0, 0.0, 0.0]], [1], True)\n", - "display(w)" + "bz = BZVisualizer(\n", + " cell, rel_coords, atom_numbers,\n", + " width=\"100%\", height=\"400px\",\n", + " show_axes=True,\n", + " show_bvectors=True,\n", + " show_pathpoints=True,\n", + " disable_interact_overlay=True,\n", + ")\n", + "display(bz)" ] }, { @@ -86,7 +104,7 @@ "metadata": {}, "outputs": [], "source": [ - "w.kpts = (monkhorst_pack((8, 8, 8))*2*np.pi).tolist()" + "bz.kpts = (monkhorst_pack((8, 8, 8))*2*np.pi).tolist()" ] }, { @@ -95,6 +113,16 @@ "id": "stretch-animal", "metadata": {}, "outputs": [], + "source": [ + "bz.kpts" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5157f61b-e6da-4167-83f8-771d3eea6e0b", + "metadata": {}, + "outputs": [], "source": [] } ], @@ -114,7 +142,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.11.5" } }, "nbformat": 4, diff --git a/widgets/widget_bzvisualizer.ipynb b/widgets/widget_bzvisualizer.ipynb index af42ff3..6496ac0 100644 --- a/widgets/widget_bzvisualizer.ipynb +++ b/widgets/widget_bzvisualizer.ipynb @@ -53,10 +53,27 @@ "metadata": {}, "outputs": [], "source": [ - "lattice = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])\n", + "from widget_bzvisualizer import BZVisualizer\n", + "\n", + "cell = [\n", + " [5.0, 0.0, 0.0],\n", + " [0.0, 5.0, 0.0],\n", + " [0.0, 0.0, 5.0],\n", + "]\n", + "# atomic coordinates in terms of unit vectors\n", + "rel_coords = [[0.0, 0.0, 0.0]]\n", + "# element numbers of atoms\n", + "atom_numbers = [6]\n", "\n", - "w = BZVisualizer(lattice, [[0.0, 0.0, 0.0]], [1], True)\n", - "display(w)" + "bz = BZVisualizer(\n", + " cell, rel_coords, atom_numbers,\n", + " width=\"100%\", height=\"400px\",\n", + " show_axes=True,\n", + " show_bvectors=True,\n", + " show_pathpoints=True,\n", + " disable_interact_overlay=True,\n", + ")\n", + "display(bz)" ] }, { @@ -87,7 +104,7 @@ "metadata": {}, "outputs": [], "source": [ - "w.kpts = (monkhorst_pack((8, 8, 8))*2*np.pi).tolist()" + "bz.kpts = (monkhorst_pack((8, 8, 8))*2*np.pi).tolist()" ] }, { @@ -96,6 +113,16 @@ "id": "stretch-animal", "metadata": {}, "outputs": [], + "source": [ + "bz.kpts" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5157f61b-e6da-4167-83f8-771d3eea6e0b", + "metadata": {}, + "outputs": [], "source": [] } ], @@ -115,7 +142,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.11.5" } }, "nbformat": 4,