lattice¶
Crystal Lattice functions for diffraction
bmatrix(a, b=None, c=None, alpha=90.0, beta=90.0, gamma=90.0)
¶
Calculate the B matrix as defined in Busing&Levy Acta Cyst. 22, 457 (1967) Creates a matrix to transform (hkl) into a cartesian basis: (qx,qy,qz)' = B.(h,k,l)' (where ' indicates a column vector)
The B matrix is related to the reciprocal basis vectors: (astar, bstar, cstar) = 2 * np.pi * B.T Where cstar is defined along the z axis
The B matrix is related to the real-space unit vectors: (vec_a, vec_b, vec_c) = B^-1 = inv(B) Where vec_b is defined along the y axis
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
float
|
lattice parameter a in Angstroms |
required |
b
|
float | None
|
lattice parameter b in Angstroms |
None
|
c
|
float | None
|
lattice parameter c in Angstroms |
None
|
alpha
|
float
|
lattice angle alpha in degrees |
90.0
|
beta
|
float
|
lattice angle beta in degrees |
90.0
|
gamma
|
float
|
lattice angle gamma in degrees |
90.0
|
Returns:
| Type | Description |
|---|---|
ndarray
|
[3x3] array B matrix in inverse-Angstroms (no 2pi) |
Source code in mmg_toolbox/diffraction/lattice.py
bragg(d_space, wavelength=None, energy=None, wl_units='angstrom', en_units='keV')
¶
Returns the photon Bragg angle in Degrees for a given d-space in Angstroms
Source code in mmg_toolbox/diffraction/lattice.py
bragg_en(energy, d_space, en_units='keV')
¶
Returns the Bragg angle for a given d-space at given photon energy in keV
Source code in mmg_toolbox/diffraction/lattice.py
bragg_wl(wavelength, d_space, wl_units='angstrom')
¶
Returns the Bragg angle for a given d-space at given wavelength in Angstroms
Source code in mmg_toolbox/diffraction/lattice.py
cal2theta(qmag, wavelength, wl_units='angstrom')
¶
Calculate 2theta of |Q| in degrees twotheta = cal2theta(q_mag, wavelength_a=1.5)
Source code in mmg_toolbox/diffraction/lattice.py
caldspace(twotheta, wavelength, wl_units='angstrom')
¶
Calculate d-spacing from two-theta dspace = caldspace(tth, wavelength_a=1.5)
Source code in mmg_toolbox/diffraction/lattice.py
calqmag(twotheta, wavelength, wl_units='angstrom')
¶
Calculate |Q| at a particular 2-theta (deg) for energy in keV magQ = calqmag(twotheta, wavelength_a=1.5)
Source code in mmg_toolbox/diffraction/lattice.py
dspace2q(dspace)
¶
q2dspace(qmag)
¶
reciprocal_lattice(a_vec, b_vec, c_vec)
¶
Calculate the reciprocal lattice vectors from real lattice vectors
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a_vec
|
ndarray
|
[3x1] basis vector a in Angstroms |
required |
b_vec
|
ndarray
|
[3x1] basis vector b in Angstroms |
required |
c_vec
|
ndarray
|
[3x1] basis vector c in Angstroms |
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray, ndarray]
|
[3x1], [3x1], [3x1] reciprocal lattice vectors |
Source code in mmg_toolbox/diffraction/lattice.py
scherrer_fwhm(size, twotheta, wavelength_a, shape_factor=0.9)
¶
Use the Scherrer equation to calculate the size of a crystallite from a peak width L = K * lambda / fwhm * cos(theta) See: https://en.wikipedia.org/wiki/Scherrer_equation
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
crystallite domain size in Angstroms |
required | |
twotheta
|
2*Bragg angle, in degrees |
required | |
wavelength_a
|
incident beam wavelength, in Angstroms |
required | |
shape_factor
|
dimensionless shape factor, dependent on shape of crystallite |
0.9
|
Returns:
| Type | Description |
|---|---|
|
float, peak full-width-at-half-max in degrees |
Source code in mmg_toolbox/diffraction/lattice.py
scherrer_size(fwhm, twotheta, wavelength_a, shape_factor=0.9)
¶
Use the Scherrer equation to calculate the size of a crystallite from a peak width L = K * lambda / fwhm * cos(theta) See: https://en.wikipedia.org/wiki/Scherrer_equation
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fwhm
|
full-width-half-maximum of a peak, in degrees |
required | |
twotheta
|
2*Bragg angle, in degrees |
required | |
wavelength_a
|
incident beam wavelength, in Angstroms |
required | |
shape_factor
|
dimensionless shape factor, dependent on shape of crystallite |
0.9
|
Returns:
| Type | Description |
|---|---|
|
float, crystallite domain size in Angstroms |