.. 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 Click :ref:`here ` to download the full example code or to run this example in your browser via Binder .. 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:: default 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-27 .. code-block:: default edos = gs_ebands.get_edos() .. GENERATED FROM PYTHON SOURCE LINES 28-29 To plot bands and DOS with matplotlib use: .. GENERATED FROM PYTHON SOURCE LINES 29-31 .. code-block:: default nscf_ebands.plot_with_edos(edos, e0=None, with_gaps=True, title="Si Electron bands + DOS") .. image:: /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) :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none
.. GENERATED FROM PYTHON SOURCE LINES 32-33 For the plotly version use: .. GENERATED FROM PYTHON SOURCE LINES 33-37 .. code-block:: default nscf_ebands.plotly_with_edos(edos, e0=None, with_gaps=True, title="Si Electron bands + DOS") print("nscf_ebands.efermi", nscf_ebands.fermie) print("gs_ebands.efermi", gs_ebands.fermie) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none nscf_ebands.efermi 5.598313017568332 eV gs_ebands.efermi 5.598453325290463 eV .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.820 seconds) .. _sphx_glr_download_gallery_plot_ebands_edos.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/abinit/abipy/gh-pages?filepath=notebooks/gallery/plot_ebands_edos.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_ebands_edos.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_ebands_edos.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_