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

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

.. _sphx_glr_examples_05-other_plot_2dkmesh_generation.py:


.. _example_kmesh_generator:

Example of kmesh_generator 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This utility can be used to generate a 2D :math:`k`-mesh centered at a given :math:`k`-point and in a given :math:`k`-plane. 
This is particularly useful in computing 2D spin-textures and plotting 2D Fermi-surfaces. 
For example, the following command creates a 2D :math:`k_{x}`-:math:`k_{y}` -mesh centered at the :math:`\Gamma` point (:math:`k_{z}= 0`) 
ranging from coordinates (-0.5, -0.5, 0.0) to (0.5, 0.5, 0.0) with 5 grids in the x direction and 7 grids in the y direction

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

   pyprocar.generate2dkmesh(x1,y1,x2,y2,z,num_grids_x,num_grids_y)

This information is automatically written to a KPOINTS file.

.. GENERATED FROM PYTHON SOURCE LINES 20-22

.. code-block:: Python

    # sphinx_gallery_thumbnail_number = 1








.. GENERATED FROM PYTHON SOURCE LINES 23-25

Plotting Kmesh
+++++++++++++++++++++++++++++++++++++++

.. GENERATED FROM PYTHON SOURCE LINES 25-29

.. code-block:: Python

    import pyvista
    # You do not need this. This is to ensure an image is rendered off screen when generating exmaple gallery.
    pyvista.OFF_SCREEN = True








.. GENERATED FROM PYTHON SOURCE LINES 30-31

importing pyprocar and specifying local data_dir

.. GENERATED FROM PYTHON SOURCE LINES 31-42

.. code-block:: Python


    import os
    import pyprocar

    kpoints = pyprocar.generate2dkmesh(-0.5,-0.5,0.5,0.5,0,5,7)

    plotter=pyvista.Plotter()
    plotter.add_mesh(kpoints, color='blue', render_points_as_spheres=True, point_size=20)
    plotter.show_axes()
    plotter.show_grid()
    plotter.show()



.. image-sg:: /examples/05-other/images/sphx_glr_plot_2dkmesh_generation_001.png
   :alt: plot 2dkmesh generation
   :srcset: /examples/05-other/images/sphx_glr_plot_2dkmesh_generation_001.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.2 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
    





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

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


.. _sphx_glr_download_examples_05-other_plot_2dkmesh_generation.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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