.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_ebands_spin.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_spin.py: Spin-polarized e-bands ====================== This example shows how to plot the band structure of nickel using the eigenvalues stored in the GSR file produced at the end of the GS run. .. GENERATED FROM PYTHON SOURCE LINES 9-28 .. code-block:: Python from abipy import abilab import abipy.data as abidata # Open the GSR file and extract the band structure. # (alternatively one can use the shell and `abiopen.py OUT_GSR.nc -nb` # to open the file in a jupyter notebook. with abilab.abiopen(abidata.ref_file("ni_666k_GSR.nc")) as ncfile: ni_ebands_kmesh = ncfile.ebands with abilab.abiopen(abidata.ref_file("ni_kpath_GSR.nc")) as ncfile: ni_ebands_kpath = ncfile.ebands # Energy limits in eV for plots. The pseudo contains semi-core states but # we are not interested in this energy region. Fermi level set to zero. elims = [-10, 2] # Plot band energies on k-path ni_ebands_kpath.plot(ylims=elims, title="Ni band structure") .. image-sg:: /gallery/images/sphx_glr_plot_ebands_spin_001.png :alt: Ni band structure :srcset: /gallery/images/sphx_glr_plot_ebands_spin_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 29-30 Plot energies on k-path + DOS with plotly .. GENERATED FROM PYTHON SOURCE LINES 30-35 .. code-block:: Python ni_ebands_kpath.plotly(ylims=elims, title="Ni band structure") # Compute DOS with Gaussian method. ni_edos = ni_ebands_kmesh.get_edos() .. GENERATED FROM PYTHON SOURCE LINES 36-37 Plot energies on k-path + DOS with matplotlib .. GENERATED FROM PYTHON SOURCE LINES 37-40 .. code-block:: Python ni_ebands_kpath.plot_with_edos(ni_edos, ylims=elims, title="Ni band structure + DOS") .. image-sg:: /gallery/images/sphx_glr_plot_ebands_spin_002.png :alt: Ni band structure + DOS :srcset: /gallery/images/sphx_glr_plot_ebands_spin_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 41-42 Plot energies on k-path + DOS with plotly .. GENERATED FROM PYTHON SOURCE LINES 42-50 .. code-block:: Python ni_ebands_kpath.plotly_with_edos(ni_edos, ylims=elims, title="Ni band structure + DOS") # Plot electronic DOS. #ni_edos.plot_dos_idos(xlims=elims) #ni_edos.plot(xlims=elims) #ni_edos.plot_up_minus_down(xlims=elims) .. GENERATED FROM PYTHON SOURCE LINES 51-52 matplotlib box plot for 10 > band >= 5 .. GENERATED FROM PYTHON SOURCE LINES 52-55 .. code-block:: Python ni_ebands_kpath.boxplot(brange=[5, 10], title="Boxplot for up and down spin and 10 > band >= 5") .. image-sg:: /gallery/images/sphx_glr_plot_ebands_spin_003.png :alt: Boxplot for up and down spin and 10 > band >= 5 :srcset: /gallery/images/sphx_glr_plot_ebands_spin_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 56-57 For the plotly version, use: .. GENERATED FROM PYTHON SOURCE LINES 57-61 .. code-block:: Python ni_ebands_kpath.boxplotly(brange=[5, 10], title="Boxplot for up and down spin and 10 > band >= 5") .. GENERATED FROM PYTHON SOURCE LINES 62-63 Now we use ElectronBandsPlotter to analyze multiple ElectronBands object .. GENERATED FROM PYTHON SOURCE LINES 63-77 .. code-block:: Python plotter = abilab.ElectronBandsPlotter() plotter.add_ebands("k-mesh", ni_ebands_kmesh) plotter.add_ebands("k-path", ni_ebands_kpath) # Energy window in eV around the Fermi level. ylims = [-10, 5] #plotter.combiplot(ylims=ylims) plotter.gridplot(ylims=ylims) plotter.gridplotly(ylims=ylims) #plotter.boxplot(brange=[5, 10]) plotter.combiboxplot(brange=[5, 10]) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /gallery/images/sphx_glr_plot_ebands_spin_004.png :alt: k-mesh, k-path :srcset: /gallery/images/sphx_glr_plot_ebands_spin_004.png :class: sphx-glr-multi-img * .. image-sg:: /gallery/images/sphx_glr_plot_ebands_spin_005.png :alt: plot ebands spin :srcset: /gallery/images/sphx_glr_plot_ebands_spin_005.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.547 seconds) .. _sphx_glr_download_gallery_plot_ebands_spin.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_spin.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_ebands_spin.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_ebands_spin.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_