Note
Click here to download the full example code
Phonon fatbandsΒΆ
This example shows how to plot the phonon fatbands of AlAs. See tutorial/lesson_rf2.html
Out:
[31mWarning: file /Users/gmatteo/git_repos/abipy/abipy/data/refs/alas_phonons/trf2_5.out_PHBST.nc does not contain atomic_numbers.
Particular methods need them![0m
/Users/gmatteo/git_repos/abipy/abipy/dfpt/phtk.py:53: UserWarning: get_dyn_mat_eigenvec has been called with amu=None. Eigenvectors may not be orthonormal.
warnings.warn("get_dyn_mat_eigenvec has been called with amu=None. Eigenvectors may not be orthonormal.")
/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()
/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()
/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
# Open the PHBST file produced by anaddb and get the phonon bands.
with abiopen(abidata.ref_file("trf2_5.out_PHBST.nc")) as ncfile:
phbands = ncfile.phbands
# Plot the phonon band structure.
phbands.plot_fatbands(title="AlAs phonon fatbands without LO-TO splitting")
# Plot the phonon band structure + PJDOS
# sphinx_gallery_thumbnail_number = 2
phdos_path = abidata.ref_file("trf2_5.out_PHDOS.nc")
phbands.plot_fatbands(units="Thz", phdos_file=phdos_path, title="AlAs phonon fatbands with PJDOS")
# Plot contributions to the phonon displacement at the Gamma point grouped by atom type.
phbands.plot_phdispl(qpoint=(0, 0, 0), units="meV", title=r"phonon displacements at $\Gamma$")
# Plot (orthonormal) eigenvectors instead of displacements.
phbands.plot_phdispl(qpoint=(0, 0, 0), use_eigvec=True, units="meV", title=r"phonon eigenvectors at $\Gamma$")
# Decompose contributions along the three Cartesian directions.
phbands.plot_phdispl_cartdirs(qpoint=(0, 0, 0), units="cm-1")
Total running time of the script: ( 0 minutes 1.496 seconds)