.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_wannier90_abiwan.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_wannier90_abiwan.py: Band structure interpolation with Wannier functions =================================================== This example shows how to analyze the wannier90 results using the ABIWAN.nc netcdf file produced by Abinit when calling wannier90 in library mode. Use `abiopen FILE.wout` for a command line interface and the `--expose` option to generate matplotlib figures automatically. .. GENERATED FROM PYTHON SOURCE LINES 11-40 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /gallery/images/sphx_glr_plot_wannier90_abiwan_001.png :alt: Matrix elements in real space :srcset: /gallery/images/sphx_glr_plot_wannier90_abiwan_001.png :class: sphx-glr-multi-img * .. image-sg:: /gallery/images/sphx_glr_plot_wannier90_abiwan_002.png :alt: Wannier-interpolated :srcset: /gallery/images/sphx_glr_plot_wannier90_abiwan_002.png :class: sphx-glr-multi-img * .. image-sg:: /gallery/images/sphx_glr_plot_wannier90_abiwan_003.png :alt: Wannier-interpolated bands and DOS :srcset: /gallery/images/sphx_glr_plot_wannier90_abiwan_003.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none ================================= File Info ================================= Name: tw90_4o_DS3_ABIWAN.nc Directory: /home/runner/work/abipy/abipy/abipy/data/refs/wannier90/tutoplugs_tw90_4 Size: 205.47 kB Access Time: Sun Jun 29 14:20:22 2025 Modification Time: Sun Jun 29 14:16:08 2025 Change Time: Sun Jun 29 14:16:08 2025 ================================= Structure ================================= Full Formula (Si2) Reduced Formula: Si abc : 3.840259 3.840259 3.840259 angles: 60.000000 60.000000 60.000000 pbc : True True True Sites (2) # SP a b c --- ---- ---- ---- ---- 0 Si 0 0 0 1 Si 0.25 0.25 0.25 Abinit Spacegroup: spgid: 227, num_spatial_symmetries: 24, has_timerev: False, symmorphic: False ============================== Electronic Bands ============================== Number of electrons: 8.0, Fermi level: 5.861 (eV) nsppol: 1, nkpt: 64, mband: 14, nspinor: 1, nspden: 1 smearing scheme: none (occopt 1), tsmear_eV: 0.272, tsmear Kelvin: 3157.7 Direct gap: Energy: 2.519 (eV) Initial state: spin: 0, kpt: [+0.000, +0.000, +0.000], weight: 0.016, band: 3, eig: 5.861, occ: 2.000 Final state: spin: 0, kpt: [+0.000, +0.000, +0.000], weight: 0.016, band: 4, eig: 8.380, occ: 0.000 Fundamental gap: Energy: 0.635 (eV) Initial state: spin: 0, kpt: [+0.000, +0.000, +0.000], weight: 0.016, band: 3, eig: 5.861, occ: 2.000 Final state: spin: 0, kpt: [+0.500, +0.500, +0.000], weight: 0.016, band: 4, eig: 6.496, occ: 0.000 Bandwidth: 11.953 (eV) Valence maximum located at kpt index 0: spin: 0, kpt: [+0.000, +0.000, +0.000], weight: 0.016, band: 3, eig: 5.861, occ: 2.000 Conduction minimum located at kpt index 10: spin: 0, kpt: [+0.500, +0.500, +0.000], weight: 0.016, band: 4, eig: 6.496, occ: 0.000 TIP: Use `--verbose` to print k-point coordinates with more digits ================================== K-points ================================== K-mesh with divisions: [4, 4, 4], shifts: [0.0, 0.0, 0.0] kptopt: 3 (Do not take into account any symmetry) Number of points in the IBZ: 64 0) [+0.000, +0.000, +0.000], weight=0.016 1) [+0.250, +0.000, +0.000], weight=0.016 2) [+0.500, +0.000, +0.000], weight=0.016 3) [-0.250, +0.000, +0.000], weight=0.016 4) [+0.000, +0.250, +0.000], weight=0.016 5) [+0.250, +0.250, +0.000], weight=0.016 6) [+0.500, +0.250, +0.000], weight=0.016 7) [-0.250, +0.250, +0.000], weight=0.016 8) [+0.000, +0.500, +0.000], weight=0.016 9) [+0.250, +0.500, +0.000], weight=0.016 10) [+0.500, +0.500, +0.000], weight=0.016 ... (More than 10 k-points) ============================= Wannier90 Results ============================= No of Wannier functions: 8, No bands: 14, Number of k-point neighbours: 8 Disentanglement: True, exclude_bands: no WF_index Center Spread 0 [1.12195 1.59353 1.59353] 2.767 1 [1.59353 1.59353 1.12195] 2.767 2 [1.12195 1.12195 1.12195] 2.767 3 [1.59353 1.12195 1.59353] 2.767 4 [0.23579 0.23579 0.23579] 2.767 5 [0.23579 2.47968 2.47968] 2.767 6 [2.47968 0.23579 2.47968] 2.767 7 [2.47968 2.47968 0.23579] 2.767 HWanR built in 0.004 (s) Interpolation completed in 0.005 [s] Interpolation completed in 0.002 [s] | .. code-block:: Python import os import abipy.data as abidata from abipy.abilab import abiopen # Open the ABIWAN file filepath = os.path.join(abidata.dirpath, "refs", "wannier90", "tutoplugs_tw90_4", "tw90_4o_DS3_ABIWAN.nc") abiwan = abiopen(filepath) print(abiwan) # Plot the matrix elements of the KS Hamiltonian in real space in the Wannier Gauge. abiwan.hwan.plot(title="Matrix elements in real space") # Interpolate bands with Wannier functions using an automatically selected k-path # with 5 points for the smallest segment. ebands_wan_kpath = abiwan.interpolate_ebands(line_density=5) ebands_wan_kpath.plot(title="Wannier-interpolated") # Interpolate bands in the IBZ defined by ngkpt ebands_wan_kmesh = abiwan.interpolate_ebands(ngkpt=[8, 8, 8]) edos = ebands_wan_kmesh.get_edos() ebands_wan_kpath.plot_with_edos(edos, title="Wannier-interpolated bands and DOS") # To compare the interpolated bands with ab-initio results, # pass a file with the ab-initio bands to the get_plotter_from_ebands method # that will return an ElectronBandsPlotter object. #plotter = abiwan.get_plotter_from_ebands("out_GSR.nc") #plotter.combiplot() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.866 seconds) .. _sphx_glr_download_gallery_plot_wannier90_abiwan.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_wannier90_abiwan.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_wannier90_abiwan.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_wannier90_abiwan.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_