.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_ifcs.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_plot_ifcs.py: Interatomic Force Constants ============================ This example shows how to plot the longitudinal part of the Interatomic Force Constants in real-space starting from a DDB file. See e.g. .. important:: Note that a **manager.yml** configuration file and an abinit installation are required to run this script as AbiPy needs to invoke anaddb to compute the IFCs from the DDB file. .. GENERATED FROM PYTHON SOURCE LINES 19-20 Open the DDB file for AlAs .. GENERATED FROM PYTHON SOURCE LINES 20-29 .. code-block:: Python import os import abipy.data as abidata from abipy import abilab filepath = os.path.join(abidata.dirpath, "refs", "alas_phonons", "trf2_3_DDB") ddb = abilab.abiopen(filepath) .. GENERATED FROM PYTHON SOURCE LINES 30-32 Call anaddb to compute the Interatomic Force Constants Default args are: asr=2, chneut=1, dipdip=1. .. GENERATED FROM PYTHON SOURCE LINES 32-35 .. code-block:: Python ifc = ddb.anaget_ifc() .. GENERATED FROM PYTHON SOURCE LINES 36-37 Plot the total longitudinal IFCs in local coordinates, .. GENERATED FROM PYTHON SOURCE LINES 37-40 .. code-block:: Python ifc.plot_longitudinal_ifc(title="Total Longitudinal IFCs") .. image-sg:: /gallery/images/sphx_glr_plot_ifcs_001.png :alt: Total Longitudinal IFCs :srcset: /gallery/images/sphx_glr_plot_ifcs_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 41-42 Plot the short range longitudinal IFCs in local coordinates, .. GENERATED FROM PYTHON SOURCE LINES 42-45 .. code-block:: Python ifc.plot_longitudinal_ifc_short_range(title="Longitudinal SR-IFCs") .. image-sg:: /gallery/images/sphx_glr_plot_ifcs_002.png :alt: Longitudinal SR-IFCs :srcset: /gallery/images/sphx_glr_plot_ifcs_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 46-47 Plot the Ewald part of the IFCs in local coordinates, .. GENERATED FROM PYTHON SOURCE LINES 47-49 .. code-block:: Python ifc.plot_longitudinal_ifc_ewald(title="Longitudinal LR-IFCs") .. image-sg:: /gallery/images/sphx_glr_plot_ifcs_003.png :alt: Longitudinal LR-IFCs :srcset: /gallery/images/sphx_glr_plot_ifcs_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.127 seconds) .. _sphx_glr_download_gallery_plot_ifcs.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_ifcs.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_ifcs.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_ifcs.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_