.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_optic.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_optic.py: Optic results ============= This example shows how to plot the optical properties computed by optic within the independent-particle approximation, no local-field effects and no excitonic effects. .. GENERATED FROM PYTHON SOURCE LINES 10-48 .. rst-class:: sphx-glr-horizontal * .. image:: /gallery/images/sphx_glr_plot_optic_001.png :alt: Linear dielectric function :class: sphx-glr-multi-img * .. image:: /gallery/images/sphx_glr_plot_optic_002.png :alt: Second Harmonic Generation :class: sphx-glr-multi-img * .. image:: /gallery/images/sphx_glr_plot_optic_003.png :alt: Convergence of $\epsilon$ wrt nkpt, $\Re(\epsilon_{xx})$, $\Im(\epsilon_{xx})$, $\Re(\epsilon_{zz})$, $\Im(\epsilon_{zz})$ :class: sphx-glr-multi-img * .. image:: /gallery/images/sphx_glr_plot_optic_004.png :alt: Convergence of $\chi^2(-2\omega,\omega,\omega)$ wrt nkpt, $|{Shg}_{xyz}|$, $|{Shg}_{yyy}|$ :class: sphx-glr-multi-img .. code-block:: default from abipy import abilab import abipy.data as abidata # Here we use one of the OPTIC.nc files shipped with abipy. # Replace filename with the path to your OPTIC.nc file. filename = abidata.ref_file("gaas_121212_OPTIC.nc") ncfile = abilab.abiopen(filename) # Optic files have a Structure and an ElectronBands object. #ncfile.ebands.plot() # To plot linear dielectric tensor and other optical # properties for all tensor components available in the file: ncfile.plot_linopt(title="Linear dielectric function") # To plot the second Harmonic tensor ncfile.plot_shg(title="Second Harmonic Generation") # Remember to close the file. ncfile.close() # Use OpticRobot to analyze multiple file e.g. convergence studies. filenames = [ abidata.ref_file("gaas_444_OPTIC.nc"), abidata.ref_file("gaas_888_OPTIC.nc"), abidata.ref_file("gaas_121212_OPTIC.nc"), ] robot = abilab.OpticRobot.from_files(filenames) # sphinx_gallery_thumbnail_number = 3 robot.plot_linopt_convergence(title=r"Convergence of $\epsilon$ wrt nkpt") robot.plot_shg_convergence(title=r"Convergence of $\chi^2(-2\omega,\omega,\omega)$ wrt nkpt") # Remember to close the file or use the `with` context manager. robot.close() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.874 seconds) .. _sphx_glr_download_gallery_plot_optic.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_optic.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_optic.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_optic.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_