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.

  • ../_images/sphx_glr_plot_optic_001.png
  • ../_images/sphx_glr_plot_optic_002.png
  • ../_images/sphx_glr_plot_optic_003.png
  • ../_images/sphx_glr_plot_optic_004.png

Out:

/Users/gmatteo/git_repos/pymatgen/pymatgen/util/plotting.py:550: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
  plt.show()
/Users/gmatteo/git_repos/pymatgen/pymatgen/util/plotting.py:550: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
  plt.show()
/Users/gmatteo/git_repos/pymatgen/pymatgen/util/plotting.py:550: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
  plt.show()
/Users/gmatteo/git_repos/pymatgen/pymatgen/util/plotting.py:550: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
  plt.show()

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()

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

Gallery generated by Sphinx-Gallery