Module: xrd.crystallography

1 Class

class hexrd.xrd.crystallography.PlaneData(hkls, *args, **kwargs)[source]

Bases: object

Careful with ordering: Outputs are ordered by the 2-theta for the hkl unless you get self.__hkls directly, and this order can change with changes in lattice parameters (lparms); setting and getting exclusions works on the current hkl ordering, not the original ordering (in self.__hkls), but exclusions are stored in the original ordering in case the hkl ordering does change with lattice parameters

if not None, tThWidth takes priority over strainMag in setting two-theta ranges; changing strainMag automatically turns off tThWidth

__init__(hkls, *args, **kwargs)[source]
getDD_tThs_lparms()[source]

derivatives of tThs with respect to lattice parameters; have not yet done coding for analytic derivatives, just wimp out and finite difference

getHKLID(hkl)[source]

can call on a single hkl or list of hkls

getHKLs(asStr=False, thisTTh=None, allHKLs=False)[source]

if pass thisTTh, then only return hkls overlapping the specified 2-theta; if set allHKLs to true, the ignore exlcusions, tThMax, etc

getLatticeOperators()[source]

gets lattice vector operators as a new (deepcopy)

getLatticeType()[source]

This is the lattice type

getLaueGroup()[source]

This is the Schoenflies tag

getNhklRef()[source]

does not use exclusions or the like

getPhaseID()[source]

may return None if not set

getPlaneNormals()[source]

gets both +(hkl) and -(hkl) normals

getPlaneSpacings()[source]

gets plane spacings

getSymHKLs(asStr=False, indices=None)[source]

new function that returns all symmetric hkls

getTThRanges(strainMag=None, lparms=None)[source]

Return 2-theta ranges for included hkls

return array is n x 2

get_hkls()[source]

do not do return self.__hkls, as everywhere else hkls are returned in 2-theta order; transpose is to comply with lparm convention

hkls

do not do return self.__hkls, as everywhere else hkls are returned in 2-theta order; transpose is to comply with lparm convention

latVecOps

gets lattice vector operators as a new (deepcopy)

static makePlaneData(hkls, lparms, qsym, symmGroup, strainMag, wavelength)[source]

hkls : need to work with crystallography.latticePlanes lparms : need to work with crystallography.latticePlanes laueGroup : see symmetry module wavelength : wavelength strainMag : swag of strian magnitudes

static makeScatteringVectors(hkls, rMat_c, bMat, wavelength, chiTilt=None)[source]

modeled after QFromU.m

13 Functions

hexrd.xrd.crystallography.hklToStr(x)[source]
hexrd.xrd.crystallography.tempSetOutputDegrees(val)[source]
hexrd.xrd.crystallography.revertOutputDegrees()[source]
hexrd.xrd.crystallography.cosineXform(a, b, c)[source]

Spherical trig transform to take alpha, beta, gamma to expressions for cos(alpha*). See ref below.

[1] R. J. Neustadt, F. W. Cagle, Jr., and J. Waser, ``Vector algebra and
the relations between direct and reciprocal lattice quantities’‘. Acta Cryst. (1968), A24, 247–248
hexrd.xrd.crystallography.processWavelength(arg)[source]

Convert an energy value to a wavelength. If argument has units of length or energy, will convert to globally specified unit type for wavelength (dUnit). If argument is a scalar, assumed input units are keV.

hexrd.xrd.crystallography.latticeParameters(lvec)[source]

Generates direct and reciprocal lattice vector components in a crystal-relative RHON basis, X. The convention for fixing X to the lattice is such that a || x1 and c* || x3, where a and c* are direct and reciprocal lattice vectors, respectively.

hexrd.xrd.crystallography.latticePlanes(hkls, lparms, ltype='cubic', wavelength=1.54059292, strainMag=None)[source]

Generates lattice plane data in the direct lattice for a given set of Miller indices. Vector components are written in the crystal-relative RHON basis, X. The convention for fixing X to the lattice is such that a || x1 and c* || x3, where a and c* are direct and reciprocal lattice vectors, respectively.

USAGE:

planeInfo = latticePlanes(hkls, lparms, **kwargs)

INPUTS:

  1. hkls (3 x n float ndarray) is the array of Miller indices for the planes of interest. The vectors are assumed to be concatenated along the 1-axis (horizontal).

  2. lparms (1 x m float list) is the array of lattice parameters, where m depends on the symmetry group (see below).

  3. The following optional keyword arguments are recognized:

    *) ltype=(string) is a string representing the symmetry type of

    the implied Laue group. The 11 available choices are shown below. The default value is ‘cubic’. Note that each group expects a lattice parameter array of the indicated length and order.

    latticeType lparms ———– ———— ‘cubic’ a ‘hexagonal’ a, c ‘trigonal’ a, c ‘rhombohedral’ a, alpha (in degrees) ‘tetragonal’ a, c ‘orthorhombic’ a, b, c ‘monoclinic’ a, b, c, beta (in degrees) ‘triclinic’ a, b, c, alpha, beta, gamma (in degrees)

    *) wavelength=<float> is a value represented the wavelength in

    Angstroms to calculate bragg angles for. The default value is for Cu K-alpha radiation (1.54059292 Angstrom)

    *) strainMag=None

OUTPUTS:

  1. planeInfo is a dictionary containing the following keys/items:

    normals (3, n) double array array of the components to the

    unit normals for each {hkl} in X (horizontally concatenated)

    dspacings (n, ) double array array of the d-spacings for

    each {hkl}

    2thetas (n, ) double array array of the Bragg angles for

    each {hkl} relative to the specified wavelength

NOTES:

*) This function is effectively a wrapper to ‘latticeVectors’.
See ‘help(latticeVectors)’ for additional info.
*) Lattice plane d-spacings are calculated from the reciprocal
lattice vectors specified by {hkl} as shown in Appendix 1 of [1].

REFERENCES:

[1] B. D. Cullity, ``Elements of X-Ray Diffraction, 2
ed.’‘. Addison-Wesley Publishing Company, Inc., 1978. ISBN 0-201-01174-3
hexrd.xrd.crystallography.latticeVectors(lparms, tag='cubic', radians=False, debug=False)[source]

Generates direct and reciprocal lattice vector components in a crystal-relative RHON basis, X. The convention for fixing X to the lattice is such that a || x1 and c* || x3, where a and c* are direct and reciprocal lattice vectors, respectively.

USAGE:

lattice = LatticeVectors(lparms, <symmTag>)

INPUTS:

  1. lparms (1 x n float list) is the array of lattice parameters, where n depends on the symmetry group (see below).

  2. symTag (string) is a case-insensitive string representing the symmetry type of the implied Laue group. The 11 available choices are shown below. The default value is ‘cubic’. Note that each group expects a lattice parameter array of the indicated length and order.

    latticeType lparms ———– ———— ‘cubic’ a ‘hexagonal’ a, c ‘trigonal’ a, c ‘rhombohedral’ a, alpha (in degrees) ‘tetragonal’ a, c ‘orthorhombic’ a, b, c ‘monoclinic’ a, b, c, beta (in degrees) ‘triclinic’ a, b, c, alpha, beta, gamma (in degrees)

OUTPUTS:

  1. lattice is a dictionary containing the following keys/items:

    F (3, 3) double array transformation matrix taking

    componenents in the direct lattice (i.e. {uvw}) to the reference, X

    B (3, 3) double array transformation matrix taking

    componenents in the reciprocal lattice (i.e. {hkl}) to X

    BR (3, 3) double array transformation matrix taking

    componenents in the reciprocal lattice to the Fable reference frame (see notes)

    U0 (3, 3) double array transformation matrix

    (orthogonal) taking componenents in the Fable reference frame to X

    vol double the unit cell volume

    dparms (6, ) double list the direct lattice parameters:

    [a b c alpha beta gamma]

    rparms (6, ) double list the reciprocal lattice

    parameters: [a* b* c* alpha* beta* gamma*]

NOTES:

*) The conventions used for assigning a RHON basis,
X -> {x1, x2, x3}, to each point group are consistent with those published in Appendix B of [1]. Namely: a || x1 and c* || x3. This differs from the convention chosen by the Fable group, where a* || x1 and c || x3 [2].
*) The unit cell angles are defined as follows:
alpha=acos(b’*c/|b||c|), beta=acos(c’*a/|c||a|), and gamma=acos(a’*b/|a||b|).
*) The reciprocal lattice vectors are calculated using the
crystallographic convention, where the prefactor of 2*pi is omitted. In this convention, the reciprocal lattice volume is 1/V.
*) Several relations from [3] were employed in the component
calculations.

REFERENCES:

[1] J. F. Nye, ``Physical Properties of Crystals: Their
Representation by Tensors and Matrices’‘. Oxford University Press, 1985. ISBN 0198511655
[2] E. M. Lauridsen, S. Schmidt, R. M. Suter, and H. F. Poulsen,
``Tracking: a method for structural characterization of grains in powders or polycrystals’‘. J. Appl. Cryst. (2001). 34, 744–750
[3] R. J. Neustadt, F. W. Cagle, Jr., and J. Waser, ``Vector
algebra and the relations between direct and reciprocal lattice quantities’‘. Acta Cryst. (1968), A24, 247–248
hexrd.xrd.crystallography.hexagonalIndicesFromRhombohedral(hkl)[source]

converts rhombohedral hkl to hexagonal indices

hexrd.xrd.crystallography.rhombohedralIndicesFromHexagonal(HKL)[source]

converts hexagonal hkl to rhombohedral indices

hexrd.xrd.crystallography.rhombohedralParametersFromHexagonal(a_h, c_h)[source]

converts hexagonal lattice parameters (a, c) to rhombohedral lattice parameters (a, alpha)

hexrd.xrd.crystallography.getFriedelPair(tth0, eta0, *ome0, **kwargs)[source]

Get the diffractometer angular coordinates in degrees for the Friedel pair of a given reflection (min angular distance).

AUTHORS:

    1. Bernier – 10 Nov 2009

USAGE:

ome1, eta1 = getFriedelPair(tth0, eta0, *ome0,
display=False, units=’degrees’, convention=’hexrd’)

INPUTS:

  1. tth0 is a list (or ndarray) of 1 or n the bragg angles (2theta) for the n reflections (tiled to match eta0 if only 1 is given).
  2. eta0 is a list (or ndarray) of 1 or n azimuthal coordinates for the n reflections (tiled to match tth0 if only 1 is given).
  3. ome0 is a list (or ndarray) of 1 or n reference oscillation angles for the n reflections (denoted omega in [1]). This argument is optional.
  4. Keyword arguments may be one of the following:

Keyword Values|{default} Action ————– ————– ————– ‘display’ True|{False} toggles display info to cmd line ‘units’ ‘radians’|{‘degrees’} sets units for input angles ‘convention’ ‘fable’|{‘hexrd’} sets conventions defining

the angles (see below)
‘chiTilt’ None the inclination (about Xlab) of
the oscillation axis

OUTPUTS:

  1. ome1 contains the oscialltion angle coordinates of the Friedel pairs associated with the n input reflections, relative to ome0 (i.e. ome1 = <result> + ome0). Output is in DEGREES!
  2. eta1 contains the azimuthal coordinates of the Friedel pairs associated with the n input reflections. Output units are controlled via the module variable ‘outputDegrees’

NOTES:

JVB) The ouputs ome1, eta1 are written using the selected convention, but the
units are alway degrees. May change this to work with Nathan’s global...
JVB) In the ‘fable’ convention [1], {XYZ} form a RHON basis where X is
downstream, Z is vertical, and eta is CCW with +Z defining eta = 0.
JVB) In the ‘hexrd’ convention [2], {XYZ} form a RHON basis where Z is upstream,
Y is vertical, and eta is CCW with +X defining eta = 0.

REFERENCES:

[1] E. M. Lauridsen, S. Schmidt, R. M. Suter, and H. F. Poulsen,
``Tracking: a method for structural characterization of grains in powders or polycrystals’‘. J. Appl. Cryst. (2001). 34, 744–750
[2] J. V. Bernier, M. P. Miller, J. -S. Park, and U. Lienert,
``Quantitative Stress Analysis of Recrystallized OFHC Cu Subject to Deformed In Situ’‘, J. Eng. Mater. Technol. (2008). 130. DOI:10.1115/1.2870234
hexrd.xrd.crystallography.getDparms(lp, lpTag, radians=True)[source]

Utility routine for getting dparms, that is the lattice parameters without symmetry – ‘triclinic’