#!/usr/bin/env python # coding: utf-8 # Back to the main [Index](index.ipynb) # ## FATBANDS.nc file # The `FATBANDS.nc` file contains the projection of the KS wavefunctions onto atom-centered # functions with given angular momentum $l$. # The file is generated by using the `prtdos` variable either in a SCF or NSCF run. # One can use the `abiopen` function provided by `abilab` to open the file and generate an instance of `FatbandsFile`. # Alternatively, use the `abiopen.py` script to open the file inside the shell with the syntax: # # abiopen.py out_FATBANDS.nc # # This command will start the ipython interpreter so that one can interact directly # with the `FatbandFile` object (named `abifile` inside ipython). # To generate a jupyter notebook use: # # abiopen.py out_FATBANDS.nc -nb # # For a quick visualization of the data, use: # # abiopen.py out_FATBANDS.nc -e # In[1]: # Use this at the beginning of your script so that your code will be compatible with python3 from __future__ import print_function, division, unicode_literals import warnings warnings.filterwarnings("ignore") # Ignore warnings from abipy import abilab abilab.enable_notebook() # This line tells AbiPy we are running inside a notebook import abipy.data as abidata # This line configures matplotlib to show figures embedded in the notebook. # Replace `inline` with `notebook` in classic notebook get_ipython().run_line_magic('matplotlib', 'inline') # Option available in jupyterlab. See https://github.com/matplotlib/jupyter-matplotlib #%matplotlib widget # In[2]: # This fatbands file has been produced on a k-path so it is not suitable for DOS calculations. fbnc_kpath = abilab.abiopen(abidata.ref_file("mgb2_kpath_FATBANDS.nc")) # To print file info i.e., dimensions, variables, etc. # (note that prtdos = 3, so LM decomposition is not available) # In[3]: print(fbnc_kpath) # In[4]: fbnc_kpath.structure.plot(); # To plot the k-points belonging to the path: # In[5]: fbnc_kpath.ebands.kpoints.plot(); # To plot the electronic fatbands grouped by atomic type: # In[6]: fbnc_kpath.plot_fatbands_typeview(tight_layout=True); # To plot the electronic fatbands grouped by $l$: # In[7]: fbnc_kpath.plot_fatbands_lview(tight_layout=True); # Now we read another FATBANDS.nc file produced on 18x18x18 k-mesh # In[8]: fbnc_kmesh = abilab.abiopen(abidata.ref_file("mgb2_kmesh181818_FATBANDS.nc")) print(fbnc_kpath) # and plot the $l$-PJDOS grouped by atomic type: # In[9]: fbnc_kmesh.plot_pjdos_typeview(tight_layout=True); # Plot the L-PJDOS grouped by L: # In[10]: fbnc_kmesh.plot_pjdos_lview(tight_layout=True); # Now we use the two netcdf files to produce plots with fatbands + PJDOSEs. # The data for the DOS is taken from pjdosfile. # In[11]: fbnc_kpath.plot_fatbands_with_pjdos(pjdosfile=fbnc_kmesh, view="type", tight_layout=True); # fatbands + PJDOS grouped by L: # In[12]: fbnc_kpath.plot_fatbands_with_pjdos(pjdosfile=fbnc_kmesh, view="lview", tight_layout=True); # # In[13]: fbnc_kpath.close() fbnc_kmesh.close() # Back to the main [Index](index.ipynb)