.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_phbands_and_dos.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code or to run this example in your browser via Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_plot_phbands_and_dos.py: Phonon band structures with LO-TO ================================= This example shows how to plot the phonon band structure of AlAs. without the LO-TO splitting. See tutorial/lesson_rf2.html .. GENERATED FROM PYTHON SOURCE LINES 12-15 Open the PHBST file produced by anaddb and get the phonon bands. Note that the treatment of the LO-TO splitting for q--> 0 requires additional steps. See `plot_phonons_lo_to.py`. .. GENERATED FROM PYTHON SOURCE LINES 15-22 .. code-block:: default from abipy.abilab import abiopen import abipy.data as abidata with abiopen(abidata.ref_file("trf2_5.out_PHBST.nc")) as ncfile: phbands = ncfile.phbands .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Warning: 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! .. GENERATED FROM PYTHON SOURCE LINES 23-24 Read the Phonon DOS from the netcd file produced by anaddb (prtdos 2) .. GENERATED FROM PYTHON SOURCE LINES 24-28 .. code-block:: default with abiopen(abidata.ref_file("trf2_5.out_PHDOS.nc")) as ncfile: phdos = ncfile.phdos .. GENERATED FROM PYTHON SOURCE LINES 29-30 Plot phonon bands and DOS with matplotib: .. GENERATED FROM PYTHON SOURCE LINES 30-33 .. code-block:: default phbands.plot(title="AlAs Phonon bands and DOS in eV") .. image:: /gallery/images/sphx_glr_plot_phbands_and_dos_001.png :alt: AlAs Phonon bands and DOS in eV :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none
.. GENERATED FROM PYTHON SOURCE LINES 34-35 For the plotly version use: .. GENERATED FROM PYTHON SOURCE LINES 35-38 .. code-block:: default phbands.plotly(title="AlAs Phonon bands and DOS in eV") .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 39-40 To plot phonon bands and phonon DOS with matplotlib use: .. GENERATED FROM PYTHON SOURCE LINES 40-44 .. code-block:: default phbands.plot_with_phdos(phdos, units="cm-1", title="AlAs Phonon bands + DOS in cm-1") .. image:: /gallery/images/sphx_glr_plot_phbands_and_dos_002.png :alt: AlAs Phonon bands + DOS in cm-1 :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none
.. GENERATED FROM PYTHON SOURCE LINES 45-46 For the plotly version use: .. GENERATED FROM PYTHON SOURCE LINES 46-50 .. code-block:: default phbands.plotly_with_phdos(phdos, units="cm-1", title="AlAs Phonon bands + DOS in cm-1") .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 51-52 Plot the phonon band structure with different color for each line (matplotlib version). .. GENERATED FROM PYTHON SOURCE LINES 52-55 .. code-block:: default phbands.plot_colored_matched(units="cm-1", title="AlAs with different color for each line.") .. image:: /gallery/images/sphx_glr_plot_phbands_and_dos_003.png :alt: AlAs with different color for each line. :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none
.. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.913 seconds) .. _sphx_glr_download_gallery_plot_phbands_and_dos.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/abinit/abipy/gh-pages?filepath=notebooks/gallery/plot_phbands_and_dos.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_phbands_and_dos.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_phbands_and_dos.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_