Plotting DOS ProjectionsΒΆ

[1]:
%matplotlib inline
# these two lines are only necessary to make the jupyter notebooks run on binder
import sys
sys.path.insert(0, "../..")

# we load the necessary modules
from aimstools.density_of_states import SpeciesProjectedDOS as SPD
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
from matplotlib import gridspec

# we initialize the SpeciesProjectedDOS class with spin-orbit coupling from the directory
spd = SPD("dos_projections/", soc=True)

# we set up a canvas with 2 columns and two rows as grid, making second column three times as wide as the first one
fig = plt.figure(constrained_layout=True, figsize=(12, 6))
spec = gridspec.GridSpec(ncols=2, nrows=2, figure=fig, width_ratios=[1, 3])

# we generate three axes, where the first one spans the entire left column
ax1 = fig.add_subplot(spec[:, 0])
ax2 = fig.add_subplot(spec[0, 1])
ax3 = fig.add_subplot(spec[1, 1])

# On the first axes, we draw the contributions we want from the spectrum
ax1 = spd.plot_contributions(contributions=["PbI", "WS", "CHN"],
                             axes=ax1, # this specifies the axes to draw onto
                             colors=["purple", "orange", "cyan"], # colors can be strings or hex codes
                             labels=["PbI$_4$", "WS$_2$", "PEA"], # labels accept latex commands
                             broadening=0.025, # DOS with the tetrahedron method is not broadened, so we apply a broadening of 25 meV
                             window=(-7,-1.3), # We set the energy limits in eV
                             energy_tick_locator=1, # We put the ticks on the energy axis at 1 eV
                             dos_tick_locator="auto" # We choose the DOS ticks automatically
                             )

# On the second axes, we plot all species, but this time with the energy being the x-axis and the DOS being the y-axis
ax2 = spd.plot_all_species(axes=ax2,
                           flip=False, # the default is to "flip" the axes, such that the energy is the y-axis
                           broadening=0.025,
                           energy_tick_locator=1,
                           dos_tick_locator=50)
# On the third axes, we plot all angular momenta
ax3 = spd.plot_all_angular_momenta(axes=ax3,
                                   flip=False,
                                   broadening=0.025,
                                   energy_tick_locator=1,
                                   dos_tick_locator=50)
plt.show()
../_images/notebooks_dosfigure_1_0.png