.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples\00-band_structure\plot_atomic_levels.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_00-band_structure_plot_atomic_levels.py: .. _ref_plotting_atomic_levels: Plotting Atomic Levels ~~~~~~~~~~~~~~~~~~~~~~ This example illustrates how to plot atomic energy levels for the compound hBN-CNCN at the GAMMA point using the `pyprocar` package. Preparation ----------- Before diving into plotting, we need to download the example files. Use the following code to do this. Once downloaded, specify the `data_dir` to point to the location of the downloaded data. .. code-block:: :caption: Downloading example import pyprocar data_dir = pyprocar.download_example( save_dir='', material='hBN-CNN', code='vasp', spin_calc_type='spin-polarized-colinear', calc_type='gamma' ) .. GENERATED FROM PYTHON SOURCE LINES 28-31 Setting up the environment -------------------------- First, we will import the necessary libraries and set up our data directory path. .. GENERATED FROM PYTHON SOURCE LINES 31-40 .. code-block:: Python import os import pyprocar # Define the directory containing the example data data_dir = f"{pyprocar.utils.ROOT}{os.sep}data{os.sep}examples{os.sep}hBN-CNCN" .. GENERATED FROM PYTHON SOURCE LINES 41-45 Plotting in Atomic Mode ----------------------- The atomic mode is used to plot the energy levels at a specific k-point. In this example, we focus on the GAMMA point. The plot will display energy levels for specific atoms in the range of -6 to 6 eV. .. GENERATED FROM PYTHON SOURCE LINES 45-57 .. code-block:: Python # Define the atom indices we're interested in atoms = [96, 97, 0, 1, 2, 3, 42, 44] # Plot the atomic bands pyprocar.bandsplot( code='vasp', # Specify the DFT code used. In this case, it's VASP. dirname=data_dir, mode='atomic', elimit=[-6, 6], # Energy range for the plot clim=[-0.4, 0.4], # Color limit for the plot atoms=atoms, # Atoms for which we want to plot the energy levels ) .. image-sg:: /examples/00-band_structure/images/sphx_glr_plot_atomic_levels_001.png :alt: plot atomic levels :srcset: /examples/00-band_structure/images/sphx_glr_plot_atomic_levels_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 ---------------------------------------------------------------------------------------------------------- WARNING : `fermi` is not set! Set `fermi={value}`. The plot did not shift the bands by the Fermi energy. ---------------------------------------------------------------------------------------------------------- z:\research projects\pyprocar\pyprocar\plotter\ebs_plot.py:604: UserWarning: Attempting to set identical low and high xlims makes transformation singular; automatically expanding. self.ax.set_xlim(interval) Atomic plot: bands.shape : (2, 246, 2) Atomic plot: spd.shape : (2, 246, 98, 1, 9, 2) Atomic plot: kpoints.shape: (2, 3) (
, ) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.159 seconds) .. _sphx_glr_download_examples_00-band_structure_plot_atomic_levels.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_atomic_levels.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_atomic_levels.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_