.. only:: html
.. note::
:class: sphx-glr-download-link-note
Click :ref:`here ` to download the full example code
.. rst-class:: sphx-glr-example-title
.. _sphx_glr_auto_examples_plot_band_center_plot_band_center.py:
==================================
Calculating band center using vdos
==================================
This example shows how to plot projected density of states
.. code-block:: default
import os
from pdos_overlap.vasp_dos import get_example_data
from pdos_overlap.vasp_dos import VASP_DOS
from pdos_overlap.plotting_tools import set_figure_settings
Load DOSCAR file
----------------
First we will, get the example data, load a DOSCAR file and use it to
instantiate a VASP_DOS object.
.. code-block:: default
set_figure_settings('paper')
example_path = get_example_data()
DOSCAR = os.path.join(example_path, 'C2H4/DOSCAR')
PDOS = VASP_DOS(DOSCAR)
Calculate and print band centers
--------------------------------
This method uses the the site and spin orbital projected density. It sums the
spin orbital densities to get energy sub-level band centers.
.. code-block:: default
orbitals = [key for key in PDOS.orbital_dictionary.keys() if 's' in key or 'p' in key]
band_centers = PDOS.get_band_center([0], orbital_list=orbitals\
, max_energy=PDOS.e_fermi, sum_spin=False)
for count, orbital in enumerate(orbitals):
print(orbital + ' band center :' + str(band_centers[count]))
.. rst-class:: sphx-glr-script-out
Out:
.. code-block:: none
s+ band center :-17.178867110984445
s- band center :-17.178845887899325
py+ band center :-8.756540885848858
py- band center :-8.756524623910577
pz+ band center :-11.145902800385862
pz- band center :-11.14591890144209
px+ band center :-8.756562549409367
px- band center :-8.756548208350123
.. rst-class:: sphx-glr-timing
**Total running time of the script:** ( 0 minutes 1.335 seconds)
.. _sphx_glr_download_auto_examples_plot_band_center_plot_band_center.py:
.. only :: html
.. container:: sphx-glr-footer
:class: sphx-glr-footer-example
.. container:: sphx-glr-download sphx-glr-download-python
:download:`Download Python source code: plot_band_center.py `
.. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: plot_band_center.ipynb `
.. only:: html
.. rst-class:: sphx-glr-signature
`Gallery generated by Sphinx-Gallery `_