.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_ebands_grid.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_grid.py: ElectronBandsPlotter ==================== This example shows how to plot several band structures on a grid We use two GSR files: si_scf_GSR.n: energies on a homogeneous sampling of the BZ (can be used to compute DOS) si_nscf_GSR.nc: energies on a k-path in the BZ (used to plot the band dispersion) .. GENERATED FROM PYTHON SOURCE LINES 13-25 .. code-block:: default from abipy.abilab import ElectronBandsPlotter from abipy.data import ref_file # To plot a grid with two band structures: plotter = ElectronBandsPlotter() plotter.add_ebands("BZ sampling", ref_file("si_scf_GSR.nc")) plotter.add_ebands("k-path", ref_file("si_nscf_GSR.nc")) # Get pandas dataframe frame = plotter.get_ebands_frame() print(frame) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none nsppol nspinor ... dirgap_kstart dirgap_kend BZ sampling 1 1 ... [+0.000, +0.000, +0.000] [+0.000, +0.000, +0.000] k-path 1 1 ... [+0.000, +0.000, +0.000] $\Gamma$ [+0.000, +0.000, +0.000] $\Gamma$ [2 rows x 31 columns] .. GENERATED FROM PYTHON SOURCE LINES 26-27 To create a grid plot use: .. GENERATED FROM PYTHON SOURCE LINES 27-30 .. code-block:: default plotter.gridplot(with_gaps=True) .. image:: /gallery/images/sphx_glr_plot_ebands_grid_001.png :alt: Si$_{2}$: $E^{dir}_{gap}$ = 2.53, $E^{fund}_{gap}$ = 0.56 (eV), 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 31-35 To plot a grid with band structures + DOS, use the optional argument `edos_objects` The first subplot gets the band dispersion from eb_objects[0] and the DOS from edos_objects[0] edos_kwargs is an optional dictionary passed to `get_dos` to compute the DOS. .. GENERATED FROM PYTHON SOURCE LINES 35-44 .. code-block:: default eb_objects = 2 * [ref_file("si_nscf_GSR.nc")] edos_objects = 2 * [ref_file("si_scf_GSR.nc")] plotter = ElectronBandsPlotter() plotter.add_ebands("Si", ref_file("si_nscf_GSR.nc"), edos=ref_file("si_scf_GSR.nc")) plotter.add_ebands("Same data", ref_file("si_nscf_GSR.nc"), edos=ref_file("si_scf_GSR.nc")) # sphinx_gallery_thumbnail_number = 2 plotter.gridplot() .. image:: /gallery/images/sphx_glr_plot_ebands_grid_002.png :alt: Si, Same data :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none
.. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 2.186 seconds) .. _sphx_glr_download_gallery_plot_ebands_grid.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_grid.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_ebands_grid.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_ebands_grid.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_