.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_phonon_pjdos.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_phonon_pjdos.py: Projected phonon DOS ==================== This example shows how to plot the projected phonon DOS (PJDOS) of AlAs. See tutorial/lesson_rf2.html .. GENERATED FROM PYTHON SOURCE LINES 11-14 Read the Phonon DOS from the netcdf file produced by anaddb with prtdos 2 (alternatively one can use the shell and `abiopen.py OUT_PHDOS.nc -nb` to open the file in a jupyter notebook. .. GENERATED FROM PYTHON SOURCE LINES 14-20 .. code-block:: default from abipy.abilab import abiopen import abipy.data as abidata phdos_file = abiopen(abidata.ref_file("trf2_5.out_PHDOS.nc")) .. GENERATED FROM PYTHON SOURCE LINES 21-22 To plot the PJDOS with matplotlib, use: .. GENERATED FROM PYTHON SOURCE LINES 22-25 .. code-block:: default phdos_file.plot_pjdos_type(units="cm-1", title="AlAs type-projected phonon DOS") .. image:: /gallery/images/sphx_glr_plot_phonon_pjdos_001.png :alt: AlAs type-projected phonon DOS :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none
.. GENERATED FROM PYTHON SOURCE LINES 26-27 For the plotly version, use: .. GENERATED FROM PYTHON SOURCE LINES 27-30 .. code-block:: default phdos_file.plotly_pjdos_type(units="cm-1", title="AlAs type-projected phonon DOS") .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 31-32 To have the projection along the cartesian directions (summed over atomic types), use .. GENERATED FROM PYTHON SOURCE LINES 32-36 .. code-block:: default phdos_file.plot_pjdos_cartdirs_type(units="Thz", stacked=True, title="Type-projected ph-DOS decomposed along the three Cartesian directions.") .. image:: /gallery/images/sphx_glr_plot_phonon_pjdos_002.png :alt: Type-projected ph-DOS decomposed along the three Cartesian directions. :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none
.. GENERATED FROM PYTHON SOURCE LINES 37-38 To plot the PJDOS for all the inequivalent sites, use: .. GENERATED FROM PYTHON SOURCE LINES 38-41 .. code-block:: default phdos_file.plot_pjdos_cartdirs_site(view="inequivalent", stacked=True) .. image:: /gallery/images/sphx_glr_plot_phonon_pjdos_003.png :alt: plot phonon pjdos :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none
.. GENERATED FROM PYTHON SOURCE LINES 42-43 Remember to close the file .. GENERATED FROM PYTHON SOURCE LINES 43-44 .. code-block:: default phdos_file.close() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.560 seconds) .. _sphx_glr_download_gallery_plot_phonon_pjdos.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_phonon_pjdos.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_phonon_pjdos.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_phonon_pjdos.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_