{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n\n# Plotting 2D band structure\n\nPlotting 2D band structure example.\n\nFirst, specify the data directory where the band structure data is located.\n\n.. code-block::\n   :caption: Downloading example\n\n    data_dir = pyprocar.download_example(save_dir='', \n                                material='graphene',\n                                code='vasp', \n                                spin_calc_type='non-spin-polarized',\n                                calc_type='2d_bands')\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "importing pyprocar and specifying local data_dir\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import os\n\nimport pyprocar\n\ndata_dir = os.path.join(\n    pyprocar.utils.DATA_DIR,\n    \"examples\",\n    \"graphene\",\n    \"vasp\",\n    \"non-spin-polarized\",\n    \"2d_bands\",\n)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Plain mode\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "spins = [0]\nhandler = pyprocar.BandStructure2DHandler(\n    code=\"vasp\",\n    dirname=data_dir,\n    fermi=-0.795606,\n    apply_symmetry=False,\n)\nhandler.plot_band_structure(\n    mode=\"plain\",\n    add_fermi_plane=True,\n    bands=[3, 4],\n    fermi_plane_size=4,\n    energy_lim=[-2.5, 0.8],\n    extended_zone_directions=[\n        [1, 0, 0],\n        [0, 1, 0],\n        [-1, 0, 0],\n        [0, -1, 0],\n        [1, -1, 0],\n        [-1, 1, 0],\n        [-1, -1, 0],\n        [[1, 1, 0]],\n    ],\n    spins=spins,\n)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Parametric mode\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "atoms = [0, 1]\norbitals = [1, 2, 3]\nspins = [0]\nhandler = pyprocar.BandStructure2DHandler(\n    code=\"vasp\", dirname=data_dir, fermi=-0.795606, apply_symmetry=False\n)\nhandler.plot_band_structure(\n    mode=\"parametric\", atoms=atoms, orbitals=orbitals, spins=spins\n)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Property Projection mode\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "handler = pyprocar.BandStructure2DHandler(\n    code=\"vasp\", dirname=data_dir, fermi=-0.795606, apply_symmetry=False\n)\nhandler.plot_band_structure(\n    mode=\"property_projection\",\n    property_name=\"band_velocity\",\n    bands=[3, 4],\n    fermi_plane_size=4,\n    scalar_bar_position_x=0.3,\n    energy_lim=[-2.5, 0.8],\n    scalar_bar_title=r\"Band Velocity ($\\frac{m}{s}$)\",\n    add_fermi_plane=True,\n)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Spin Texture mode\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "data_dir = os.path.join(\n    pyprocar.utils.DATA_DIR,\n    \"examples\",\n    \"BiSb_monolayer\",\n    \"vasp\",\n    \"non-colinear\",\n    \"fermi\",\n)\n\n\natoms = [0]\norbitals = [4, 5, 6, 7, 8]\nhandler = pyprocar.BandStructure2DHandler(\n    code=\"vasp\", dirname=data_dir, fermi=-1.1904, apply_symmetry=False\n)\nhandler.plot_band_structure(\n    mode=\"spin_texture\",\n    spin_texture=True,\n    atoms=atoms,\n    orbitals=orbitals,\n    add_fermi_plane=True,\n    fermi_plane_size=2,\n    energy_lim=[-2, 2],\n    fermi_text_position=[0, 0.5, 0],\n    scalar_bar_position_x=0.3,\n    clip_brillouin_zone_factor=1,\n    surface_clim=[-0.5, 0.5],\n)"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.9.20"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}