.. 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 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_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-56 .. rst-class:: sphx-glr-horizontal * .. image:: /gallery/images/sphx_glr_plot_ebands_spin_001.png :alt: Ni band structure :class: sphx-glr-multi-img * .. image:: /gallery/images/sphx_glr_plot_ebands_spin_002.png :alt: Ni band structure + DOS :class: sphx-glr-multi-img * .. image:: /gallery/images/sphx_glr_plot_ebands_spin_003.png :alt: Boxplot for up and down spin and 10 > band >= 5 :class: sphx-glr-multi-img * .. image:: /gallery/images/sphx_glr_plot_ebands_spin_004.png :alt: k-mesh, k-path :class: sphx-glr-multi-img * .. image:: /gallery/images/sphx_glr_plot_ebands_spin_005.png :alt: plot ebands spin :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none
| .. code-block:: default 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") # Compute DOS with Gaussian method. ni_edos = ni_ebands_kmesh.get_edos() # Plot energies on k-path + DOS ni_ebands_kpath.plot_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) # Boxplot for 10 > band >= 5 ni_ebands_kpath.boxplot(brange=[5, 10], title="Boxplot for up and down spin and 10 > band >= 5") # Use ElectronBandsPlotter to analyze multiple ElectronBands object plotter = abilab.ElectronBandsPlotter() plotter.add_ebands("k-mesh", ni_ebands_kmesh) plotter.add_ebands("k-path", ni_ebands_kpath) ylims = [-10, 5] #plotter.combiplot(ylims=ylims) plotter.gridplot(ylims=ylims) #plotter.boxplot(brange=[5, 10]) plotter.combiboxplot(brange=[5, 10]) .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 2.132 seconds) .. _sphx_glr_download_gallery_plot_ebands_spin.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_spin.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_ebands_spin.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_ebands_spin.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_