.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_phonons_msqd.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_phonons_msqd.py: Debye-Waller and generalized phonon DOS ======================================= This example shows how to plot the generalized phonon DOS with the mean square displacement tensor in cartesian coords and how to calculate Debye Waller factors as a function of temperature. See :cite:`Lee1995` for the further details about the internal implementation and :cite:`Trueblood1996` for the different conventions used by crystallographers. .. GENERATED FROM PYTHON SOURCE LINES 13-55 .. rst-class:: sphx-glr-horizontal * .. image:: /gallery/images/sphx_glr_plot_phonons_msqd_001.png :alt: Si0 (3b), O3 (6c) :class: sphx-glr-multi-img * .. image:: /gallery/images/sphx_glr_plot_phonons_msqd_002.png :alt: plot phonons msqd :class: sphx-glr-multi-img * .. image:: /gallery/images/sphx_glr_plot_phonons_msqd_003.png :alt: plot phonons msqd :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Creating temporary file: /var/folders/nc/k69spyd12qv2tk3stk2xrxg40000gr/T/tmppv_2pfu8mp-7000_DDB | .. code-block:: default import os import abipy.data as abidata from abipy import abilab # Open DDB file for alpha-SiO2 taken from https://materialsproject.org/materials/mp-7000/ filepath = os.path.join(abidata.dirpath, "refs", "mp-7000_DDB.bz2") ddb = abilab.abiopen(filepath) # Invoke anaddb to compute phonon bands and dos. #dos_method = "gaussian" dos_method = "tetra" phbst_file, phdos_file = ddb.anaget_phbst_and_phdos_files(nqsmall=4, dos_method=dos_method, ndivsm=1, mpi_procs=2) # Extract msqd_dos msqd_dos = phdos_file.msqd_dos #print(msqd_dos) #for fmt in ("cartesian", "cif", "ustar", "beta", "B"): for fmt in ("cartesian", "cif"): df = msqd_dos.get_dataframe(temp=300, view="all", fmt=fmt) abilab.print_dataframe(df, title="Format: %s" % fmt) # Plot generalized phonon DOS for each inequivalent atom in the unit cell. msqd_dos.plot() # Plot tensor(T) for each inequivalent atom. msqd_dos.plot_tensor() msqd_dos.plot_uiso() # To save the structure and the U tensor at T=300K in CIF format, use: #msqd_dos.write_cif_file("DW.cif", temp=300) # To visualize the thermal ellipsoids with Vesta, use: #msqd_dos.vesta_open(temp=300) # Remember to close the files. phbst_file.close() phdos_file.close() ddb.close() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 6.181 seconds) .. _sphx_glr_download_gallery_plot_phonons_msqd.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_phonons_msqd.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_phonons_msqd.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_phonons_msqd.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_