Skip to content

Instantly share code, notes, and snippets.

@DanPorter
Created August 9, 2023 14:28
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/01611491da4d7316d82d3edcc4c7b1ed to your computer and use it in GitHub Desktop.
Save DanPorter/01611491da4d7316d82d3edcc4c7b1ed to your computer and use it in GitHub Desktop.
Example sample alignment using DiffCalc commands on I16 in GDA
# Create new UB
newub # interactive... you will need sample name and lattice parameters
# Add constraints (vertical geometry)
con gam 0 mu 0 phi phi() # phi fixed
con gam 0 mu 0 bisect # bisecting
# Move to position (with pilatus)
pos do do.pil # set delta offset to pilatus detector
pos delta c2th([h,k,l]) eta c2th([h,k,l])/2
# Centre detector on reflection
scancn eta 0.05 61 pil 1
go maxval
pil2max # takes an exposure with pilatus, then moves delta and chi to put max pixel in centre of detector
# Add reflection to reflist
addref [h,k,l] '300K specular'
# Build trial UB matrix using 1st reflection
trialub
# Find second reflection
sim hkl [h2,k2,l2]
pos hkl [h2,k2,l2]
scan kphi -68 268 1 pil 1
go maxval
pil2max
#---OR---
simallsr2([h2,k2,l2]) # pick a set of azimuths
scan sr2 [h2 k2 l2 -90] [h2 k2 l2 90] [0 0 0 1] pil3 1 roi2
# Add reflection to reflist
addref [h2,k2,l2] '300K off-specular'
# Regenerate orientation matrix with 1st ref
showref # or: ub
calcub 1 2 # uses reflections '1' and '2', defaults to first two reflections in list if no argument is given
# Refine lattice parameters
hklcur=hkl()
lpold=latt()
latt(lpold[0]*h2/hklcur[0], lpold[1]*k2/hklcur[1], lpold[2], lpold[3], lpold[4], lpold[5])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment