
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples\00-band_structure\plot_2d_bands.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_examples_00-band_structure_plot_2d_bands.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_examples_00-band_structure_plot_2d_bands.py:


.. _ref_plotting_2d_bands:

Plotting 2D band structure
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Plotting 2D band structure example.

First, specify the data directory where the band structure data is located.

.. code-block::
   :caption: Downloading example

    data_dir = pyprocar.download_example(save_dir='', 
                                material='graphene',
                                code='vasp', 
                                spin_calc_type='non-spin-polarized',
                                calc_type='2d_bands')

.. GENERATED FROM PYTHON SOURCE LINES 24-25

importing pyprocar and specifying local data_dir

.. GENERATED FROM PYTHON SOURCE LINES 25-39

.. code-block:: Python

    import os

    import pyprocar

    data_dir = os.path.join(
        pyprocar.utils.DATA_DIR,
        "examples",
        "graphene",
        "vasp",
        "non-spin-polarized",
        "2d_bands",
    )









.. GENERATED FROM PYTHON SOURCE LINES 40-42

Plain mode
+++++++++++++++++++++++++++++++++++++++

.. GENERATED FROM PYTHON SOURCE LINES 42-68

.. code-block:: Python

    spins = [0]
    handler = pyprocar.BandStructure2DHandler(
        code="vasp",
        dirname=data_dir,
        fermi=-0.795606,
        apply_symmetry=False,
    )
    handler.plot_band_structure(
        mode="plain",
        add_fermi_plane=True,
        bands=[3, 4],
        fermi_plane_size=4,
        energy_lim=[-2.5, 0.8],
        extended_zone_directions=[
            [1, 0, 0],
            [0, 1, 0],
            [-1, 0, 0],
            [0, -1, 0],
            [1, -1, 0],
            [-1, 1, 0],
            [-1, -1, 0],
            [[1, 1, 0]],
        ],
        spins=spins,
    )




.. image-sg:: /examples/00-band_structure/images/sphx_glr_plot_2d_bands_001.png
   :alt: plot 2d bands
   :srcset: /examples/00-band_structure/images/sphx_glr_plot_2d_bands_001.png
   :class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

 .. code-block:: none


                    ----------------------------------------------------------------------------------------------------------
                    There are additional plot options that are defined in a configuration file. 
                    You can change these configurations by passing the keyword argument to the function
                    To print a list of plot options set print_plot_opts=True

                    Here is a list modes : plain , parametric , spin_texture , overlay
                    Here is a list of properties: fermi_speed , fermi_velocity , harmonic_effective_mass
                    ----------------------------------------------------------------------------------------------------------
                

                WARNING : Make sure the kmesh has kz points with kz=0 +- 0.0001
                ----------------------------------------------------------------------------------------------------------
            
    C:\Users\lllang\miniconda3\envs\pyprocar_dev\lib\site-packages\pyvista\core\utilities\points.py:55: UserWarning: Points is not a float type. This can cause issues when transforming or applying filters. Casting to ``np.float32``. Disable this by passing ``force_float=False``.
      warnings.warn(




.. GENERATED FROM PYTHON SOURCE LINES 69-71

Parametric mode
+++++++++++++++++++++++++++++++++++++++

.. GENERATED FROM PYTHON SOURCE LINES 71-82

.. code-block:: Python


    atoms = [0, 1]
    orbitals = [1, 2, 3]
    spins = [0]
    handler = pyprocar.BandStructure2DHandler(
        code="vasp", dirname=data_dir, fermi=-0.795606, apply_symmetry=False
    )
    handler.plot_band_structure(
        mode="parametric", atoms=atoms, orbitals=orbitals, spins=spins
    )




.. image-sg:: /examples/00-band_structure/images/sphx_glr_plot_2d_bands_002.png
   :alt: plot 2d bands
   :srcset: /examples/00-band_structure/images/sphx_glr_plot_2d_bands_002.png
   :class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

 .. code-block:: none


                    ----------------------------------------------------------------------------------------------------------
                    There are additional plot options that are defined in a configuration file. 
                    You can change these configurations by passing the keyword argument to the function
                    To print a list of plot options set print_plot_opts=True

                    Here is a list modes : plain , parametric , spin_texture , overlay
                    Here is a list of properties: fermi_speed , fermi_velocity , harmonic_effective_mass
                    ----------------------------------------------------------------------------------------------------------
                

                WARNING : Make sure the kmesh has kz points with kz=0 +- 0.0001
                ----------------------------------------------------------------------------------------------------------
            




.. GENERATED FROM PYTHON SOURCE LINES 83-85

Property Projection mode
+++++++++++++++++++++++++++++++++++++++

.. GENERATED FROM PYTHON SOURCE LINES 85-99

.. code-block:: Python

    handler = pyprocar.BandStructure2DHandler(
        code="vasp", dirname=data_dir, fermi=-0.795606, apply_symmetry=False
    )
    handler.plot_band_structure(
        mode="property_projection",
        property_name="band_velocity",
        bands=[3, 4],
        fermi_plane_size=4,
        scalar_bar_position_x=0.3,
        energy_lim=[-2.5, 0.8],
        scalar_bar_title=r"Band Velocity ($\frac{m}{s}$)",
        add_fermi_plane=True,
    )




.. image-sg:: /examples/00-band_structure/images/sphx_glr_plot_2d_bands_003.png
   :alt: plot 2d bands
   :srcset: /examples/00-band_structure/images/sphx_glr_plot_2d_bands_003.png
   :class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

 .. code-block:: none


                    ----------------------------------------------------------------------------------------------------------
                    There are additional plot options that are defined in a configuration file. 
                    You can change these configurations by passing the keyword argument to the function
                    To print a list of plot options set print_plot_opts=True

                    Here is a list modes : plain , parametric , spin_texture , overlay
                    Here is a list of properties: fermi_speed , fermi_velocity , harmonic_effective_mass
                    ----------------------------------------------------------------------------------------------------------
                

                WARNING : Make sure the kmesh has kz points with kz=0 +- 0.0001
                ----------------------------------------------------------------------------------------------------------
            
    ij,uvwabj->uvwabi
    C:\Users\lllang\miniconda3\envs\pyprocar_dev\lib\site-packages\pyvista\core\utilities\points.py:55: UserWarning: Points is not a float type. This can cause issues when transforming or applying filters. Casting to ``np.float32``. Disable this by passing ``force_float=False``.
      warnings.warn(




.. GENERATED FROM PYTHON SOURCE LINES 100-102

Spin Texture mode
+++++++++++++++++++++++++++++++++++++++

.. GENERATED FROM PYTHON SOURCE LINES 102-131

.. code-block:: Python


    data_dir = os.path.join(
        pyprocar.utils.DATA_DIR,
        "examples",
        "BiSb_monolayer",
        "vasp",
        "non-colinear",
        "fermi",
    )


    atoms = [0]
    orbitals = [4, 5, 6, 7, 8]
    handler = pyprocar.BandStructure2DHandler(
        code="vasp", dirname=data_dir, fermi=-1.1904, apply_symmetry=False
    )
    handler.plot_band_structure(
        mode="spin_texture",
        spin_texture=True,
        atoms=atoms,
        orbitals=orbitals,
        add_fermi_plane=True,
        fermi_plane_size=2,
        energy_lim=[-2, 2],
        fermi_text_position=[0, 0.5, 0],
        scalar_bar_position_x=0.3,
        clip_brillouin_zone_factor=1,
        surface_clim=[-0.5, 0.5],
    )



.. image-sg:: /examples/00-band_structure/images/sphx_glr_plot_2d_bands_004.png
   :alt: plot 2d bands
   :srcset: /examples/00-band_structure/images/sphx_glr_plot_2d_bands_004.png
   :class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

 .. code-block:: none


                    ----------------------------------------------------------------------------------------------------------
                    There are additional plot options that are defined in a configuration file. 
                    You can change these configurations by passing the keyword argument to the function
                    To print a list of plot options set print_plot_opts=True

                    Here is a list modes : plain , parametric , spin_texture , overlay
                    Here is a list of properties: fermi_speed , fermi_velocity , harmonic_effective_mass
                    ----------------------------------------------------------------------------------------------------------
                

                WARNING : Make sure the kmesh has kz points with kz=0 +- 0.0001
                ----------------------------------------------------------------------------------------------------------
            





.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (2 minutes 44.356 seconds)


.. _sphx_glr_download_examples_00-band_structure_plot_2d_bands.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: plot_2d_bands.ipynb <plot_2d_bands.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: plot_2d_bands.py <plot_2d_bands.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: plot_2d_bands.zip <plot_2d_bands.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
