widget-bzvisualizer: A Jupyter widget to visualize the 1st Brillouin zone and band paths

widget-bzvisualizer: A Jupyter widget to visualize the 1st Brillouin zone and band paths#

Source code: osscar-org/widget-bzvisualizer

Introduction: A Jupyter widget to plot the 1st Brillouin zone and band paths. It uses the Javascript package tools-seekpath developed by Materials Cloud.

1. Import the widget from the package#

from widget_bzvisualizer import BZVisualizer

2. Initialize the parameters for the widget#

  • cell: the cell vectors a, b, c

  • rel_coods: the coordinates of the atoms in unit vectors

  • atom_numbers: element numbers of the atoms

from widget_bzvisualizer import BZVisualizer

cell = [
    [5.0, 0.0, 0.0],
    [0.0, 5.0, 0.0],
    [0.0, 0.0, 5.0],
]
# atomic coordinates in terms of unit vectors
rel_coords = [[0.0, 0.0, 0.0]]
# element numbers of atoms
atom_numbers = [6]

bz = BZVisualizer(
    cell, rel_coords, atom_numbers,
    width="100%", height="400px",
    show_axes=True,
    show_bvectors=True,
    show_pathpoints=True,
    disable_interact_overlay=True,
)
display(bz)
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['std_lattice']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
  warnings.warn(
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['std_positions']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
  warnings.warn(
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['std_types']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
  warnings.warn(
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['number']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
  warnings.warn(
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['transformation_matrix']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
  warnings.warn(
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['international']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
  warnings.warn(
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['std_rotation_matrix']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
  warnings.warn(