.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_mdf.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_mdf.py: Bethe-Salpeter ============== This example shows how to plot the macroscopic dielectric function (MDF) computed in the Bethe-Salpeter code. .. GENERATED FROM PYTHON SOURCE LINES 9-35 .. rst-class:: sphx-glr-horizontal * .. image:: /gallery/images/sphx_glr_plot_mdf_001.png :alt: Si absorption spectrum: EXC vs RPA (averaged over small q-points) :class: sphx-glr-multi-img * .. image:: /gallery/images/sphx_glr_plot_mdf_002.png :alt: Real part for the first q-point: EXC vs RPA :class: sphx-glr-multi-img * .. image:: /gallery/images/sphx_glr_plot_mdf_003.png :alt: Si macroscopic dielectric tensor (Reduced coord) :class: sphx-glr-multi-img * .. image:: /gallery/images/sphx_glr_plot_mdf_004.png :alt: Si macroscopic dielectric tensor (Cartesian coord) :class: sphx-glr-multi-img .. code-block:: default import abipy.data as abidata from abipy.abilab import abiopen # Open the MDF file produced in the tutorial. mdf_file = abiopen(abidata.ref_file("tbs_4o_DS2_MDF.nc")) # Plot the imaginary part of the macroscopic # dielectric function (EXC, RPA, GWRPA) between 2 and 5 eV. xlims = (2, 5) mdf_file.plot_mdfs(xlims=xlims, title="Si absorption spectrum: EXC vs RPA (averaged over small q-points)") # Plot the real part for the first q-point --> 0 mdf_file.plot_mdfs(cplx_mode="Re", qpoint=0, xlims=xlims, title="Real part for the first q-point: EXC vs RPA") # Plot the 6 different components of the macroscopic dielectric tensor tensor_exc = mdf_file.get_tensor("exc") tensor_exc.symmetrize(mdf_file.structure) tensor_exc.plot(title="Si macroscopic dielectric tensor (Reduced coord)") tensor_exc.plot(red_coords=False, title="Si macroscopic dielectric tensor (Cartesian coord)") mdf_file.close() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 7.303 seconds) .. _sphx_glr_download_gallery_plot_mdf.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_mdf.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_mdf.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_mdf.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_