.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_efatbands_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_efatbands_spin.py: spin-polarized fatbands ======================= This example shows how to plot the L-projected fatbands of Ni using the results stored in the FATBANDS.nc files produced with prtdos 3. .. GENERATED FROM PYTHON SOURCE LINES 11-14 Open the file (alternatively one can use the shell and `abiopen.py FILE -nb` to open the file in a jupyter notebook This file has been produced on a k-path so it's not suitable for DOS calculations. .. GENERATED FROM PYTHON SOURCE LINES 14-20 .. code-block:: Python import abipy.abilab as abilab import abipy.data as abidata fbnc_kpath = abilab.abiopen(abidata.ref_file("ni_kpath_FATBANDS.nc")) .. GENERATED FROM PYTHON SOURCE LINES 21-23 NC files have contributions up to L = 4 (g channel) but here we are intererested in s,p,d terms only so we use the optional argument lmax .. GENERATED FROM PYTHON SOURCE LINES 23-37 .. code-block:: Python lmax = 2 # 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] # Print file info (dimensions, variables ...) # Note that prtdos = 3, so LM decomposition is not available. print(fbnc_kpath) # Plot the k-points belonging to the path. #fbnc_kpath.ebands.kpoints.plot() .. rst-class:: sphx-glr-script-out .. code-block:: none ================================= File Info ================================= Name: ni_kpath_FATBANDS.nc Directory: /home/runner/work/abipy/abipy/abipy/data/refs/ni_ebands Size: 619.35 kB Access Time: Wed Jul 2 08:06:00 2025 Modification Time: Wed Jul 2 08:00:59 2025 Change Time: Wed Jul 2 08:00:59 2025 ================================= Structure ================================= Full Formula (Ni1) Reduced Formula: Ni abc : 2.489016 2.489016 2.489016 angles: 60.000000 60.000000 60.000000 pbc : True True True Sites (1) # SP a b c --- ---- --- --- --- 0 Ni 0 0 0 Abinit Spacegroup: spgid: 225, num_spatial_symmetries: 48, has_timerev: True, symmorphic: False ============================== Electronic Bands ============================== ================================= Structure ================================= Full Formula (Ni1) Reduced Formula: Ni abc : 2.489016 2.489016 2.489016 angles: 60.000000 60.000000 60.000000 pbc : True True True Sites (1) # SP a b c --- ---- --- --- --- 0 Ni 0 0 0 Abinit Spacegroup: spgid: 225, num_spatial_symmetries: 48, has_timerev: True, symmorphic: False Number of electrons: 18.0, Fermi level: 11.296 (eV) nsppol: 2, nkpt: 101, mband: 12, nspinor: 1, nspden: 2 smearing scheme: gaussian (occopt 7), tsmear_eV: 0.204, tsmear Kelvin: 2368.3 =============================== Fatbands Info =============================== prtdos: 3, prtdosm: 1, mbesslang: 5, pawprtdos: 0, usepaw: 0 nsppol: 2, nkpt: 101, mband: 12 Idx Symbol Reduced_Coords Lmax Ratsph [Bohr] Has_Atom ----- -------- ----------------------- ------ --------------- ---------- 0 Ni 0.00000 0.00000 0.00000 4 2 Yes .. GENERATED FROM PYTHON SOURCE LINES 38-39 Plot the electronic fatbands grouped by atomic type. .. GENERATED FROM PYTHON SOURCE LINES 39-42 .. code-block:: Python fbnc_kpath.plot_fatbands_typeview(ylims=elims, lmax=lmax, tight_layout=True) .. image-sg:: /gallery/images/sphx_glr_plot_efatbands_spin_001.png :alt: type=Ni, $\sigma=\uparrow$, type=Ni, $\sigma=\downarrow$ :srcset: /gallery/images/sphx_glr_plot_efatbands_spin_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 43-44 For the plotly version use: .. GENERATED FROM PYTHON SOURCE LINES 44-47 .. code-block:: Python fbnc_kpath.plotly_fatbands_typeview(ylims=elims, lmax=lmax) .. GENERATED FROM PYTHON SOURCE LINES 48-49 Plot the electronic fatbands grouped by L. .. GENERATED FROM PYTHON SOURCE LINES 49-52 .. code-block:: Python fbnc_kpath.plot_fatbands_lview(ylims=elims, lmax=lmax, tight_layout=True) .. image-sg:: /gallery/images/sphx_glr_plot_efatbands_spin_002.png :alt: $l=s$, $\sigma=\uparrow$, $l=p$, $\sigma=\uparrow$, $l=d$, $\sigma=\uparrow$, $l=s$, $\sigma=\downarrow$, $l=p$, $\sigma=\downarrow$, $l=d$, $\sigma=\downarrow$ :srcset: /gallery/images/sphx_glr_plot_efatbands_spin_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 53-54 For the plotly version use: .. GENERATED FROM PYTHON SOURCE LINES 54-57 .. code-block:: Python fbnc_kpath.plotly_fatbands_lview(ylims=elims, lmax=lmax) .. GENERATED FROM PYTHON SOURCE LINES 58-59 Now we read another FATBANDS file produced on 18x18x18 k-mesh .. GENERATED FROM PYTHON SOURCE LINES 59-62 .. code-block:: Python fbnc_kmesh = abilab.abiopen(abidata.ref_file("ni_666k_FATBANDS.nc")) .. GENERATED FROM PYTHON SOURCE LINES 63-64 Plot the L-PJDOS grouped by atomic type. .. GENERATED FROM PYTHON SOURCE LINES 64-67 .. code-block:: Python fbnc_kmesh.plot_pjdos_typeview(xlims=elims, lmax=lmax, tight_layout=True) .. image-sg:: /gallery/images/sphx_glr_plot_efatbands_spin_003.png :alt: Type: Ni :srcset: /gallery/images/sphx_glr_plot_efatbands_spin_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 68-69 For the plotly version use: .. GENERATED FROM PYTHON SOURCE LINES 69-72 .. code-block:: Python fbnc_kmesh.plotly_pjdos_typeview(xlims=elims, lmax=lmax) .. GENERATED FROM PYTHON SOURCE LINES 73-74 Plot the L-PJDOS grouped by L. .. GENERATED FROM PYTHON SOURCE LINES 74-77 .. code-block:: Python fbnc_kmesh.plot_pjdos_lview(xlims=elims, lmax=lmax, tight_layout=True) .. image-sg:: /gallery/images/sphx_glr_plot_efatbands_spin_004.png :alt: $l=s$, $l=p$, $l=d$ :srcset: /gallery/images/sphx_glr_plot_efatbands_spin_004.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 78-79 For the plotly version use: .. GENERATED FROM PYTHON SOURCE LINES 79-82 .. code-block:: Python fbnc_kmesh.plotly_pjdos_lview(xlims=elims, lmax=lmax) .. GENERATED FROM PYTHON SOURCE LINES 83-85 Now we use the two netcdf files to produce plots with fatbands + PJDOSEs. The data for the DOS is taken from pjdosfile. .. GENERATED FROM PYTHON SOURCE LINES 85-89 .. code-block:: Python fbnc_kpath.plot_fatbands_with_pjdos(pjdosfile=fbnc_kmesh, ylims=elims, lmax=lmax, view="type", tight_layout=True) .. image-sg:: /gallery/images/sphx_glr_plot_efatbands_spin_005.png :alt: type=Ni, $\sigma=\uparrow$, type=Ni, $\sigma=\downarrow$ :srcset: /gallery/images/sphx_glr_plot_efatbands_spin_005.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 90-91 For the plotly version use: .. GENERATED FROM PYTHON SOURCE LINES 91-95 .. code-block:: Python fbnc_kpath.plotly_fatbands_with_pjdos(pjdosfile=fbnc_kmesh, ylims=elims, lmax=lmax, view="type") .. GENERATED FROM PYTHON SOURCE LINES 96-97 fatbands + PJDOS grouped by L .. GENERATED FROM PYTHON SOURCE LINES 97-101 .. code-block:: Python fbnc_kpath.plot_fatbands_with_pjdos(pjdosfile=fbnc_kmesh, ylims=elims, lmax=lmax, view="lview", tight_layout=True) .. image-sg:: /gallery/images/sphx_glr_plot_efatbands_spin_006.png :alt: $l=s$, $\sigma=\uparrow$, $l=p$, $\sigma=\uparrow$, $l=d$, $\sigma=\uparrow$, $l=s$, $\sigma=\downarrow$, $l=p$, $\sigma=\downarrow$, $l=d$, $\sigma=\downarrow$ :srcset: /gallery/images/sphx_glr_plot_efatbands_spin_006.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 102-103 For the plotly version use: .. GENERATED FROM PYTHON SOURCE LINES 103-107 .. code-block:: Python fbnc_kpath.plotly_fatbands_with_pjdos(pjdosfile=fbnc_kmesh, ylims=elims, lmax=lmax, view="lview") .. GENERATED FROM PYTHON SOURCE LINES 108-109 Close files. .. GENERATED FROM PYTHON SOURCE LINES 109-112 .. code-block:: Python fbnc_kpath.close() fbnc_kmesh.close() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 4.957 seconds) .. _sphx_glr_download_gallery_plot_efatbands_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_efatbands_spin.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_efatbands_spin.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_efatbands_spin.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_