Diffractometer Extra Solver Parameters#

Some of the diffractometer modes use extra parameters. The E4CV geometry, for example, has a double_diffraction mode which requires a reference \(hkl_2\) vector. The vector is set as a Python dictionary:

action

E4CV method

read

e4cv.core.solver.extras

write

e4cv.core.solver.extras = dictionary

Objective

Show how to use the double_diffraction mode in the E4CV geometry.

E4CV, hkl, double_diffraction#

term

value

geometry

E4CV

engine

hkl

mode

double_diffraction

Using the standard E4CV geometry with simulated motors, we copy the E4CV setup for the LNO_LAO sample. Using a kwarg, we can automatically compute the UB matrix once we define the second reflection. (This means we do not have to call compute_UB() on a separate line.)

import hklpy2

e4cv = hklpy2.creator(name="e4cv")
e4cv.restore("e4cv-LNO_LAO.yml")
e4cv.wh(full=True)
diffractometer='e4cv'
HklSolver(name='hkl_soleil', version='5.1.2', geometry='E4CV', engine_name='hkl', mode='bissector')
Sample(name='LNO_LAO', lattice=Lattice(a=3.7817, b=3.7914, c=3.7989, alpha=90.2546, beta=90.0182, gamma=89.8997, system='triclinic'))
Reflection(name='r_85d9', h=0.0, k=0.0, l=2.0)
Reflection(name='r_bca7', h=1.0, k=1.0, l=3.0)
Orienting reflections: ['r_85d9', 'r_bca7']
U=[[-0.057509522654, -0.998327393204, 0.005922059067], [0.000158283449, 0.005922758763, 0.999982447783], [-0.998344945272, 0.057509450598, -0.000182596327]]
UB=[[-0.095549901092, -1.654278634916, 0.002428444854], [0.000262981975, 0.009814839065, 1.65396180769], [-1.658712442301, 0.098200239641, -0.000389705577]]
constraint: -180.0 <= omega <= 180.0
constraint: -180.0 <= chi <= 180.0
constraint: -50.0 <= phi <= 100.0
constraint: -2.0 <= tth <= 180.0
h=0, k=0, l=0
wavelength=1.239424258
omega=0, chi=0, phi=0, tth=0

Set the double_diffraction mode.

e4cv.core.solver.mode = "double_diffraction"
print(f"{e4cv.core.solver.mode=!r}")
print(f"{e4cv.core.solver.extras=!r}")
e4cv.core.solver.mode='double_diffraction'
e4cv.core.solver.extras={'h2': 1.0, 'k2': 1.0, 'l2': 1.0}

Set $hkl_2=(2\ 2\ 0)$.

e4cv.core.solver.extras = {'h2': 2.0, 'k2': 2.0, 'l2': 0}

Calculate (002) with (220) as second diffracting plane#

print(f"{e4cv.core.solver.extras=!r}")
print("(002) :", e4cv.forward(0, 0, 2))
e4cv.core.solver.extras={'h2': 2.0, 'k2': 2.0, 'l2': 0.0}
(002) : Hklpy2DiffractometerRealPos(omega=19.125950423193, chi=89.98528785702, phi=19.056580679972, tth=38.084061000204)

Calculate (002) with (222) as second diffracting plane#

e4cv.core.solver.extras = {'h2': 2.0, 'k2': 2.0, 'l2': 2}
print(f"{e4cv.core.solver.extras=}")
print("(002) :", e4cv.forward(0, 0, 2))
e4cv.core.solver.extras={'h2': 2.0, 'k2': 2.0, 'l2': 2.0}
(002) : Hklpy2DiffractometerRealPos(omega=19.125989270384, chi=89.985511037941, phi=18.904237535436, tth=38.084060988627)