Skip to content

Instantly share code, notes, and snippets.

@DanPorter
Created April 22, 2021 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanPorter/9044c33aa54c7cd985d7ab11d5416052 to your computer and use it in GitHub Desktop.
Save DanPorter/9044c33aa54c7cd985d7ab11d5416052 to your computer and use it in GitHub Desktop.
Multiple Scattering Example
"""
Dans_Diffraction Examples
Run multiple scattering calculations
Install Dans_Diffraction from pip:
pip install Dans-Diffraction
Or, download the latest version from Github:
$ git clone https://github.com/DanPorter/Dans_Diffraction.git
"""
import sys, os
import matplotlib.pyplot as plt
import numpy as np
# Add Dans_Diffraction folder to PYTHONPATH (not required if installed through pip)
sys.path.insert(0, os.path.expanduser('~/OneDrive - Diamond Light Source Ltd/PythonProjects/Dans_Diffraction'))
import Dans_Diffraction as dif
cif_file='Silicon.cif'
energy_kev = 8.0 # keV
energy_width = 0.1
energy_range=[energy_kev-energy_width/2, energy_kev+energy_width/2]
hkl_reflection = [0, 0, 6]
azi_reference = [0, 1, 0]
xtl = dif.Crystal(cif_file)
xtl.Plot.plot_multiple_scattering(hkl_reflection, azi_reference, energy_range=energy_range, numsteps=101)
xtl.Plot.plot_ms_azimuth(hkl_reflection, energy_kev, azi_reference)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment