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

.. only:: html

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

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

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

.. _sphx_glr_examples_05-other_plot_bandgap.py:


.. _ref_example_bandgap:

Example of finding the bandgap
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The bandgap of a calculation can be found by:

.. code-block::
   :caption: General Format

   pyprocar.bandgap(procar="PROCAR", outcar="OUTCAR", code="vasp")


NOTE:
The bandgap calculation should be done for non-self consistent (band structure) calculations. 

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

    data_dir = pyprocar.download_example(save_dir='', 
                                material='Fe',
                                code='vasp', 
                                spin_calc_type='non-spin-polarized',
                                calc_type='bands')

.. GENERATED FROM PYTHON SOURCE LINES 28-32

.. code-block:: Python


    # sphinx_gallery_thumbnail_number = 1









.. GENERATED FROM PYTHON SOURCE LINES 33-34

importing pyprocar and specifying local data_dir

.. GENERATED FROM PYTHON SOURCE LINES 34-46

.. code-block:: Python


    import os

    import numpy as np

    import pyprocar

    data_dir = os.path.join(
        pyprocar.utils.DATA_DIR, "examples", "Fe", "vasp", "non-spin-polarized", "bands"
    )

    band_gap = pyprocar.bandgap(dirname=data_dir, code="vasp")




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

 .. code-block:: none

    Band Gap = 0 eV 





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

   **Total running time of the script:** (0 minutes 0.119 seconds)


.. _sphx_glr_download_examples_05-other_plot_bandgap.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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