Note
Go to the end to download the full example code.
Plotting Inverse participation ratio#
Often it is needed to search for localized modes within the band structure, typical examples are surface/interface states and defect levels.
The usual procedure for detecting them is looking for bands with a large projection around the atoms at the surface or defect.
This procedure is both cumbersome for the user and error-prone. For instance, the lowest unoccupied levels
of the neutral
where the indexes
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.
import pyprocar
bi2se3_data_dir = pyprocar.download_example(
save_dir='',
material='Bi2Se3-spinorbit-surface',
code='vasp',
spin_calc_type='spin-polarized-colinear',
calc_type='bands'
)
C_data_dir = pyprocar.download_example(
save_dir='',
material='NV-center',
code='vasp',
spin_calc_type='spin-polarized-colinear',
calc_type='bands'
)
Setting up the environment#
First, we will import the necessary libraries and set up our data directory path.
import os
import pyprocar
# Define the directory containing the example data
bi2se3_data_dir = os.path.join(
pyprocar.utils.DATA_DIR, "examples", "Bi2Se3-spinorbit-surface"
)
C_data_dir = os.path.join(pyprocar.utils.DATA_DIR, "examples", "NV-center")
Topologically-protected surface states in #
The first example is the detection of topologically-protected surface states in
pyprocar.bandsplot(
dirname=bi2se3_data_dir,
elimit=[-1.0, 1.0],
mode="ipr",
code="vasp",
spins=[0],
fermi=2.0446,
clim=[0, 0.2],
)

----------------------------------------------------------------------------------------------------------
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
----------------------------------------------------------------------------------------------------------
(<Figure size 900x600 with 2 Axes>, <Axes: xlabel='K vector', ylabel='E - E$_F$ (eV)'>)
defect in diamond#
The second example is the
pyprocar.bandsplot(
dirname=C_data_dir,
elimit=[-3.0, 2.5],
mode="ipr",
code="vasp",
fermi=12.4563,
spins=[0, 1],
clim=[0, 0.1],
)

----------------------------------------------------------------------------------------------------------
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\Desktop\Current_Projects\pyprocar\pyprocar\plotter\ebs_plot.py:701: UserWarning: Attempting to set identical low and high xlims makes transformation singular; automatically expanding.
self.ax.set_xlim(interval)
Atomic plot: bands.shape : (2, 540, 2)
Atomic plot: spd.shape : (2, 540, 215, 1, 9, 2)
Atomic plot: kpoints.shape: (2, 3)
(<Figure size 900x600 with 2 Axes>, <Axes: xlabel='K vector', ylabel='E - E$_F$ (eV)'>)
Total running time of the script: (0 minutes 21.526 seconds)