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.

  • Linear dielectric function
  • Second Harmonic Generation
  • Convergence of $\epsilon$ wrt nkpt, $\Re(\epsilon_{xx})$, $\Im(\epsilon_{xx})$, $\Re(\epsilon_{zz})$, $\Im(\epsilon_{zz})$
  • Convergence of $\chi^2(-2\omega,\omega,\omega)$ wrt nkpt, $|{Shg}_{xyz}|$, $|{Shg}_{yyy}|$
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.

# 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.

# Use OpticRobot to analyze multiple file e.g. convergence studies.
filenames = [

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.

Total running time of the script: ( 0 minutes 0.874 seconds)

Gallery generated by Sphinx-Gallery