.. 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_projected_density_plot_projected_density.py: ================================================= Plotting projected density obtained from vasp_dos ================================================= This example shows how to plot projected density of states .. code-block:: default import os import numpy as np import matplotlib.pyplot as plt 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) Obtain projected density ------------------------ We get the site and spin orbital projected density. We sum the individual spin orbital densities to get energy sub-level site projected densities. .. code-block:: default orbitals, projected_density = PDOS.get_site_dos(atom_indices=np.arange(-6,0)\ , orbital_list=['s', 'p', 'd']\ , sum_density = True) Plot projected density ---------------------- We plot the projected density with the fermi-level indicated. .. code-block:: default plt.figure(figsize=(3,3)) colors = ['b','g','r'] zorder = [2,3,4] for count, density in enumerate(projected_density): plt.plot(density, PDOS.get_energies(), colors[count], zorder=zorder[count]) plt.plot([np.min(projected_density), np.max(projected_density)]\ ,[PDOS.e_fermi, PDOS.e_fermi],'k--', zorder=1, linewidth=5) plt.legend([i for i in orbitals]+ ['fermi level']) plt.xlabel('State density') plt.ylabel('Energy [eV]') plt.show() .. image:: /auto_examples/plot_projected_density/images/sphx_glr_plot_projected_density_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none C:\Users\lansf\Box Sync\Synced_Files\Coding\Python\Github\pdos_overlap\examples\plot_projected_density\plot_projected_density.py:56: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure. plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 1.038 seconds) .. _sphx_glr_download_auto_examples_plot_projected_density_plot_projected_density.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_projected_density.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_projected_density.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_