PyEELS - Python EELS simulation package
PyEELS is a package for simulation Electron Energy Loss Spectra from model band structures. It can both be used as tool within education or comparison to experimental results.
The use of the package can be seen as threefold:
- Creating real space crystal models
- Create/generate band structures in reciprocal space
- Simulate EELS on the model band structures
Creating real space crystal models
The crystal defines much of the reciprocal band structure, a model of the crystal is thus important if a realistic band structure is to be generated. Some parameters defined in the crystal are important for the reciprocal space calculation (i.e. Tight Binding)
Example usage:
from pyeels import Crystal, Atom, Orbital
import numpy as np
myCrystal = Crystal(lattice=np.array([
[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])
myAtom = Atom(number=1, position=[0,0,0])
myAtom.add_orbital(Orbital(label="s", onsite="-2")
myCrystal.add_atom(myAtom)
Band structures in reciprocal space
The band structure can either be generated by a Tight Binding model (based on PythTB) or parabolic bands.
Example usage:
from pyeels import ParabolicBand
myCrystal_pb = ParabolicBand(myCrystal)
myCrystal_pb.set_grid(mesh=25)
# Affects the band structure in myCrystal
# Creates two parabolic bands with a direct band gap of 1
myCrystal_pb.set_parabolic(energy_offset=0, effective_mass=[-1, -1, -1], k_center=[0, 0, 0])
myCrystal_pb.set_parabolic(energy_offset=1, effective_mass=[ 1, 1, 1], k_center=[0, 0, 0])
# Visualization of the bands
myCrystal_pb.bandstructure()
Simulation of EEL-spectrum from the model system
The band structure gives the basis of the EEL-spectrum of a crystal. This simulation package lets you adjust all parameters in order to examine the effect of different features. The outcomming signal is a hyperspy signal, that can be investigated real time.
Example usage:
from pyeels import EELS
mySystem = EELS(myCrystal)
mySystem.temperature = 0 # Absolute zero
mySystem.fermienergy = 0.5 # Placing the fermi level at center of the band gap
mySystem.set_meta(
name="My test sample",
author=["Supervisor", "Student"],
title="myCrystal",
notes="This model is just an example."
)
# The resolution of the diffraction zone, (can relate to the CCD-resolution)
mySystem.set_diffraction_zone() #No input autogenerates a zone
mySignal = mySystem.calculate_eels_multiproc(energyBins=np.linspace(0,4,50))
mySignal.plot()