Skip to content
Yusuke SETO edited this page Jan 31, 2025 · 21 revisions

Load CIF files and add them to 'Crystal List'

#Get file names. Multiple selections are possible (using CTRL or SHIFT key) in a selection dialog .
filenames = ReciPro.File.GetFileNames()

#Loop through each file
for filename in filenames:
	#Read a crystal (CIF- or AMC-format only) and set it to 'Crystal Information'.
	ReciPro.File.ReadCrystal(filename)
	#Add the crystal at 'Crystal Information' to the end of the list.
	ReciPro.CrystalList.Add()

Rotate the crystal by a 5° step along the b-axis (= [010] axis) and save the electron diffraction patterns.

# Get the path name where the simulated files are saved.
path = ReciPro.File.GetDirectoryPath()

# Set simulation properties of electron diffraction 
ReciPro.DifSim.Open()
ReciPro.DifSim.Source_Electron()
ReciPro.DifSim.Energy = 200 # in kV
ReciPro.DifSim.Calc_Kinematical()
ReciPro.DifSim.ImageSize(800, 800) # in pixel
ReciPro.DifSim.CameraLength2 = 1500 # in mm
ReciPro.DifSim.Foot(0,0) # in mm

# Specify the rotation axis and step
(u, v, w) = (0, 1, 0)
step = 5

# Reset the crystal orientation
ReciPro.Dir.EulerInDeg(0, 0, 0)

# Loop for 6 times
for n in range(6):
	# Rotate 5 degrees around the [uvw] axis.
	ReciPro.Dir.RotateAroundAxisInDeg(u, v, w, step)
	# Save the image with an appropriate name.
	ReciPro.DifSim.SaveAsPng(path+str(n*step)+'deg')

Simulate STEM images for annular detectors.

# Get the path name where the simulated files are saved.
path = ReciPro.File.GetDirectoryPath()

# Set properties for a STEM simulation 
ReciPro.STEM.Open()
ReciPro.STEM.Thickness = 30 # in nm
ReciPro.STEM.AccVol = 200 # in keV
ReciPro.STEM.DeltaV = 0.8 # in eV
ReciPro.STEM.Cs = 1.0 # in mm
ReciPro.STEM.Cc = 1.4 # in mm
ReciPro.STEM.Defocus = ReciPro.STEM.Scherzer

# Loop the inner and outer radii of the annular detector
for (inner, outer) in [(0,5), (12,24), (26,60), (80,250)]:
	# Set the inner and outer radii 
	ReciPro.STEM.DetectorInnerAngle = inner # in mrad
	ReciPro.STEM.DetectorOuterAngle = outer # in mrad
	# Simulate STEM image 
	ReciPro.STEM.Simulate()
	# Save the image with an appropriate name.
	ReciPro.STEM.SaveImageAsTif(path + 'in' + str(inner) + 'out' + str(outer))