Skip to content

Commit

Permalink
update the bz visualizer notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
Dou Du committed Jun 6, 2024
1 parent 1af8153 commit 9fbff87
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 11 deletions.
40 changes: 34 additions & 6 deletions widgets/.ipynb_checkpoints/widget_bzvisualizer-checkpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)"
]
},
{
Expand Down Expand Up @@ -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()"
]
},
{
Expand All @@ -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": []
}
],
Expand All @@ -114,7 +142,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
37 changes: 32 additions & 5 deletions widgets/widget_bzvisualizer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
]
},
{
Expand Down Expand Up @@ -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()"
]
},
{
Expand All @@ -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": []
}
],
Expand All @@ -115,7 +142,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 9fbff87

Please sign in to comment.