
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples\00-band_structure\plot_unfolding.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_unfolding.py>`
        to download the full example code.

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

.. _sphx_glr_examples_00-band_structure_plot_unfolding.py:


.. _ref_plot_unfolding:

Unfolding Band Structure
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Unfolding Band Structure example.

First download the example files with the code below. Then replace data_dir below.

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

    supercell_dir = pyprocar.download_example(save_dir='', 
                                material='MgB2',
                                code='vasp', 
                                spin_calc_type='non-spin-polarized',
                                calc_type='supercell_bands')

    primitive_dir = pyprocar.download_example(save_dir='', 
                                material='MgB2',
                                code='vasp', 
                                spin_calc_type='non-spin-polarized',
                                calc_type='primitive_bands')

.. GENERATED FROM PYTHON SOURCE LINES 29-30

importing pyprocar and specifying local data_dir

.. GENERATED FROM PYTHON SOURCE LINES 30-39

.. code-block:: Python

    import os
    import pyprocar

    import numpy as np

    supercell_dir = f"{pyprocar.utils.ROOT}{os.sep}data{os.sep}examples{os.sep}MgB2_unfold{os.sep}vasp{os.sep}non-spin-polarized{os.sep}supercell_bands"
    primitive_dir = f"{pyprocar.utils.ROOT}{os.sep}data{os.sep}examples{os.sep}MgB2_unfold{os.sep}vasp{os.sep}non-spin-polarized{os.sep}primitive_bands"









.. GENERATED FROM PYTHON SOURCE LINES 40-42

Plotting primitive bands
+++++++++++++++++++++++++++++++++++++++

.. GENERATED FROM PYTHON SOURCE LINES 42-51

.. code-block:: Python


    pyprocar.bandsplot(
                    code='vasp', 
                    mode='plain',
                    fermi=4.993523,
                    elimit=[-15,5],
                    dirname=primitive_dir)





.. image-sg:: /examples/00-band_structure/images/sphx_glr_plot_unfolding_001.png
   :alt: plot unfolding
   :srcset: /examples/00-band_structure/images/sphx_glr_plot_unfolding_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 the configuration file. 
                You can change these configurations by passing the keyword argument to the function.
                To print a list of all plot options set `print_plot_opts=True`

                Here is a list modes : plain , parametric , scatter , atomic , overlay , overlay_species , overlay_orbitals
                ----------------------------------------------------------------------------------------------------------
            
    C:\Users\lllang\miniconda3\envs\pyprocar_dev\lib\site-packages\spglib\spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['wyckoffs']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
      warnings.warn(

    (<Figure size 900x600 with 1 Axes>, <Axes: xlabel='K vector', ylabel='E - E$_F$ (eV)'>)



.. GENERATED FROM PYTHON SOURCE LINES 52-59

Unfolding of the supercell bands
+++++++++++++++++++++++++++++++++++++++

Here we do unfolding of the supercell bands. In this calculation, 
the POSCAR and KPOINTS will be different from the primitive cell
For the POSCAR, we create a 2 2 2 supercell from the primitive.
For the KPOINTS, the paths need to be changed to reflect the change in the unitcell

.. GENERATED FROM PYTHON SOURCE LINES 59-69

.. code-block:: Python


    pyprocar.unfold(
            code='vasp',
            mode='plain',
            unfold_mode='both',
            fermi=5.033090,
            dirname= supercell_dir,
            elimit=[-15,5],
            supercell_matrix=np.diag([2, 2, 2]))
        
        


.. image-sg:: /examples/00-band_structure/images/sphx_glr_plot_unfolding_002.png
   :alt: plot unfolding
   :srcset: /examples/00-band_structure/images/sphx_glr_plot_unfolding_002.png
   :class: sphx-glr-single-img


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

 .. code-block:: none

     ____        ____
    |  _ \ _   _|  _ \ _ __ ___   ___ __ _ _ __ 
    | |_) | | | | |_) | '__/ _ \ / __/ _` | '__|
    |  __/| |_| |  __/| | | (_) | (_| (_| | |   
    |_|    \__, |_|   |_|  \___/ \___\__,_|_|
           |___/
    A Python library for electronic structure pre/post-processing.

    Version 6.3.1 created on Jun 10th, 2021

    Please cite:
     Uthpala Herath, Pedram Tavadze, Xu He, Eric Bousquet, Sobhit Singh, Francisco Muñoz and Aldo Romero.,
     PyProcar: A Python library for electronic structure pre/post-processing.,
     Computer Physics Communications 251 (2020):107080.


    Developers:
    - Francisco Muñoz
    - Aldo Romero
    - Sobhit Singh
    - Uthpala Herath
    - Pedram Tavadze
    - Eric Bousquet
    - Xu He
    - Reese Boucher
    - Logan Lang
    - Freddy Farah
    

                --------------------------------------------------------
                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 , scatter , atomic , overlay , overlay_species , overlay_orbitals
                --------------------------------------------------------
            
    C:\Users\lllang\miniconda3\envs\pyprocar_dev\lib\site-packages\spglib\spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['wyckoffs']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
      warnings.warn(
    C:\Users\lllang\miniconda3\envs\pyprocar_dev\lib\site-packages\spglib\spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['wyckoffs']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
      warnings.warn(

    (<Figure size 900x600 with 2 Axes>, <Axes: xlabel='K vector', ylabel='E - E$_F$ (eV)'>)




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

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


.. _sphx_glr_download_examples_00-band_structure_plot_unfolding.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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