Note
Click here to download the full example code
Band structure plotΒΆ
This example shows how to plot a band structure using the eigenvalues stored in the GSR file produced at the end of the GS run.
Out:
/Users/gmatteo/git_repos/pymatgen/pymatgen/symmetry/bandstructure.py:63: UserWarning: The input structure does not match the expected standard primitive! The path can be incorrect. Use at your own risk.
warnings.warn("The input structure does not match the expected standard primitive! "
/Users/gmatteo/git_repos/pymatgen/pymatgen/util/plotting.py:550: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
plt.show()
/Users/gmatteo/git_repos/pymatgen/pymatgen/util/plotting.py:550: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
plt.show()
from abipy.abilab import abiopen
import abipy.data as abidata
# Here we use one of the GSR files shipped with abipy.
# Replace filename with the path to your GSR file or your WFK file.
filename = abidata.ref_file("si_nscf_GSR.nc")
# 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 abiopen(filename) as ncfile:
ebands = ncfile.ebands
# Plot the band energies. Note that the labels for the k-points
# are found automatically in an internal database.
# Show fundamental and direct gaps.
#ebands.plot(with_gaps="fd", title="Silicon band structure")
ebands.plot(with_gaps=True, title="Silicon band structure")
# Plot the BZ and the k-point path.
ebands.kpoints.plot()
Total running time of the script: ( 0 minutes 0.885 seconds)