{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n\n# Plotting bandsdosplot\n\nThis example illustrates how to utilize various configurations for plotting both band structures and density of states (DOS) side by side using the `pyprocar` package. It provides a structured way to explore and demonstrate different configurations for the `bandsdosplot` function.\n\n## Preparation\nBefore diving into plotting, we need to download the example files. Use the following code to do this. Once downloaded, specify the `bands_dir` and `dos_dir` to point to the location of the downloaded data.\n\n.. code-block::\n   :caption: Downloading example\n\n   bands_dir = pyprocar.download_example(save_dir='', \n                                material='Fe',\n                                code='vasp', \n                                spin_calc_type='non-spin-polarized',\n                                calc_type='bands')\n\n   dos_dir = pyprocar.download_example(save_dir='', \n                                material='Fe',\n                                code='vasp', \n                                spin_calc_type='non-spin-polarized',\n                                calc_type='dos')\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import os\n\nimport pyprocar\n\nbands_dir = os.path.join(\n    pyprocar.utils.DATA_DIR, \"examples\", \"Fe\", \"vasp\", \"non-spin-polarized\", \"bands\"\n)\ndos_dir = os.path.join(\n    pyprocar.utils.DATA_DIR, \"examples\", \"Fe\", \"vasp\", \"non-spin-polarized\", \"dos\"\n)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# Section 1: Plain Mode with Default Settings\n# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n#\n# This section demonstrates how to plot both band structures and DOS side by side using default settings.\n# The keywords that work for `bandsplot` and `dosplot` will also work in `bandsdosplot`.\n# These keyword arguments can be set in `bands_settings` and `dos_settings` as demonstrated below.\n#\n\n\nbands_settings = {\n    \"mode\": \"plain\",\n    \"fermi\": 5.599480,  # This will overide the default fermi value found in bands directory\n    \"dirname\": bands_dir,\n}\n\ndos_settings = {\n    \"mode\": \"plain\",\n    \"fermi\": 5.599480,  # This will overide the default fermi value found in dos directory\n    \"dirname\": dos_dir,\n}\n\npyprocar.bandsdosplot(\n    code=\"vasp\",\n    bands_settings=bands_settings,\n    dos_settings=dos_settings,\n)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# Section 2: Customizing Bands and DOS Plots\n# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n#\n# This section demonstrates how to customize the appearance of both the band structures and DOS plots.\n# We'll adjust the colormap, color limits, Fermi line properties, and other settings.\n#\n\nbands_settings = {\n    \"mode\": \"scatter\",\n    \"dirname\": bands_dir,\n    \"fermi\": 5.599480,  # This will overide the default fermi value found in bands directory\n    \"atoms\": [0],\n    \"orbitals\": [4, 5, 6, 7, 8],\n    \"cmap\": \"viridis\",\n    \"clim\": [0, 1],\n    \"fermi_color\": \"red\",\n    \"fermi_linestyle\": \"--\",\n    \"fermi_linewidth\": 2.0,\n}\n\ndos_settings = {\n    \"mode\": \"parametric\",\n    \"dirname\": dos_dir,\n    \"fermi\": 5.599480,  # This will overide the default fermi value found in dos directory\n    \"atoms\": [0],\n    \"orbitals\": [4, 5, 6, 7, 8],\n    \"cmap\": \"viridis\",\n    \"clim\": [0, 1],\n    \"marker\": [\"v\", \"o\"],\n    \"markersize\": [10, 5],\n}\n\npyprocar.bandsdosplot(\n    code=\"vasp\",\n    bands_settings=bands_settings,\n    dos_settings=dos_settings,\n)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# Section 3: Adjusting Figure Size and DPI\n# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n#\n# This section demonstrates how to adjust the overall figure size and dots per inch (DPI) for the combined plot.\n#\n\nbands_settings = {\"mode\": \"scatter\", \"dirname\": bands_dir}\n\ndos_settings = {\"mode\": \"parametric\", \"dirname\": dos_dir}\n\npyprocar.bandsdosplot(\n    code=\"vasp\",\n    bands_settings=bands_settings,\n    dos_settings=dos_settings,\n    figure_size=(12, 7),\n    dpi=300,\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
}