.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_speed_of_sound.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_speed_of_sound.py: Speed of Sound ============== This example shows how to compute the speed of sound by fitting phonon frequencies along selected directions by linear least-squares fit. For a command line interface use: abiview.py ddb_vs input_DDB .. GENERATED FROM PYTHON SOURCE LINES 12-31 .. image:: /gallery/images/sphx_glr_plot_speed_of_sound_001.png :alt: [0.707, 0.000, 0.707] - X, [0.408, 0.408, 0.816] - K, [0.577, 0.577, 0.577] - L :class: sphx-glr-single-img .. raw:: html


.. code-block:: default from __future__ import print_function import os import abipy.data as abidata from abipy import abilab from abipy.dfpt.vsound import SoundVelocity # Initialize object from DDB file. ddb_path = os.path.join(abidata.dirpath, "refs", "si_sound_vel", "Si_DDB") sv = SoundVelocity.from_ddb(ddb_path) # Get pandas dataframe with results. df = sv.get_dataframe() abilab.print_dataframe(df) # Plot fit sv.plot() sv.plotly() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 1.555 seconds) .. _sphx_glr_download_gallery_plot_speed_of_sound.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_speed_of_sound.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_speed_of_sound.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_speed_of_sound.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_