.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_ebands_edos.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_gallery_plot_ebands_edos.py: Bands + DOS =========== This example shows how to compute the DOS and plot a band structure with DOS using two GSR files. .. GENERATED FROM PYTHON SOURCE LINES 9-22 .. code-block:: Python from abipy.abilab import abiopen import abipy.data as abidata # Open the file with energies computed on a k-path in the BZ # and extract the band structure object. with abiopen(abidata.ref_file("si_nscf_GSR.nc")) as nscf_file: nscf_ebands = nscf_file.ebands # Open the file with energies computed with a homogeneous sampling of the BZ # and extract the band structure object. with abiopen(abidata.ref_file("si_scf_GSR.nc")) as gs_file: gs_ebands = gs_file.ebands .. GENERATED FROM PYTHON SOURCE LINES 23-25 Compute the DOS with the Gaussian method (use default values for the broadening and the step of the linear mesh. .. GENERATED FROM PYTHON SOURCE LINES 25-28 .. code-block:: Python edos = gs_ebands.get_edos() .. GENERATED FROM PYTHON SOURCE LINES 29-30 To plot bands and DOS with matplotlib use: .. GENERATED FROM PYTHON SOURCE LINES 30-33 .. code-block:: Python nscf_ebands.plot_with_edos(edos, with_gaps=True, title="Si Electron bands + DOS") .. image-sg:: /gallery/images/sphx_glr_plot_ebands_edos_001.png :alt: Si Electron bands + DOS, Si$_{2}$: $E^{dir}_{gap}$ = 2.53, $E^{fund}_{gap}$ = 0.52 (eV) :srcset: /gallery/images/sphx_glr_plot_ebands_edos_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 34-35 For the plotly version use: .. GENERATED FROM PYTHON SOURCE LINES 35-37 .. code-block:: Python nscf_ebands.plotly_with_edos(edos, with_gaps=True, title="Si Electron bands + DOS") .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.476 seconds) .. _sphx_glr_download_gallery_plot_ebands_edos.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_ebands_edos.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_ebands_edos.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_ebands_edos.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_