hexrd.material.unitcell module

hexrd.material.unitcell.C_cubic_eq(x)[source]
hexrd.material.unitcell.C_cyclictet_eq(x)[source]
hexrd.material.unitcell.C_trigonal_eq(x)[source]
hexrd.material.unitcell.WAV_ID = 7

calculate dot product of two vectors in any space ‘d’ ‘r’ or ‘c’

hexrd.material.unitcell.identity(x)[source]
hexrd.material.unitcell.laue_11 = 'oh'

these supergroups are the three exceptions to the coloring scheme the point groups are not topological and can’t have no discontinuities in the IPF coloring scheme. they are -1, -3 and -4 point groups.

class hexrd.material.unitcell.unitcell(lp, sgnum, atomtypes, charge, atominfo, U, dmin, beamenergy, sgsetting=0)[source]

Bases: object

>> @AUTHOR: Saransh Singh, Lawrence Livermore National Lab, saransh1@llnl.gov >> @DATE: 10/09/2018 SS 1.0 original

@DATE: 10/15/2018 SS 1.1 added space group handling

>> @DETAILS: this is the unitcell class

CalcAngle(u, v, space)[source]
CalcAnomalous()[source]
CalcBraggAngle(hkl)[source]
CalcCross(p, q, inspace, outspace, vol_divide=False)[source]
CalcDensity()[source]

calculate density, average atomic weight (avA) and average atomic number(avZ)

CalcDot(u, v, space)[source]
CalcLength(u, space)[source]
CalcMaxGIndex()[source]
CalcOrbit(v, reduceToUC=True)[source]

@date 03/04/2021 SS 1.0 original

@details calculate the equivalent position for the space group symmetry. this function will replace the code in the CalcPositions subroutine.

@params v is the factional coordinates in direct space

reduceToUC reduces the position to the fundamental fractional unit cell (0-1)

CalcPositions()[source]

calculate the asymmetric positions in the fundamental unitcell used for structure factor calculations

CalcStar(v, space, applyLaue=False)[source]

this function calculates the symmetrically equivalent hkls (or uvws) for the reciprocal (or direct) point group symmetry.

CalcWavelength()[source]
CalcXRFormFactor(Z, charge, s)[source]

we are using the following form factors for x-aray scattering: 1. coherent x-ray scattering, f0 tabulated in Acta Cryst. (1995). A51,416-431 2. Anomalous x-ray scattering (complex (f’+if”)) tabulated in J. Phys. Chem. Ref. Data, 24, 71 (1995) and J. Phys. Chem. Ref. Data, 29, 597 (2000). 3. Thompson nuclear scattering, fNT tabulated in Phys. Lett. B, 69, 281 (1977).

the anomalous scattering is a complex number (f’ + if”), where the two terms are given by f’ = f1 + frel - Z f” = f2

f1 and f2 have been tabulated as a function of energy in Anomalous.h5 in hexrd folder

overall f = (f0 + f’ + if” +fNT)

CalcXRSF(hkl)[source]
ChooseSymmetric(hkllist, InversionSymmetry=True)[source]

this function takes a list of hkl vectors and picks out a subset of the list picking only one of the symmetrically equivalent one. The convention is to choose the hkl with the most positive components.

GenerateCartesianPGSym()[source]

use the direct point group symmetries to generate the symmetry operations in the cartesian frame. this is used to reduce directions to the standard stereographi tringle

GenerateRecipPGSym()[source]
GetPgLg()[source]

simple subroutine to get point and laue groups to maintain consistency for planedata initialization in the materials class

InitializeInterpTable()[source]
MakeStiffnessMatrix(inp_Cvals)[source]
NormVec(u, space)[source]
Required_C(C)[source]
Required_lp(p)[source]
SortHKL(hkllist)[source]

this function sorts the hkllist by increasing |g| i.e. decreasing d-spacing. If two vectors are same length, then they are ordered with increasing priority to l, k and h

TransSpace(v_in, inspace, outspace)[source]
property U

initialize interpolation from table for anomalous scattering

property Z
property a
property alpha
property asym_pos
property atom_ntype
property atom_pos
property b
property beta
property c
calcBetaij()[source]
calc_absorption_cross_sec()[source]
calc_absorption_length()[source]
calc_number_density()[source]
calc_unitcell_mass()[source]
calcmatrices()[source]
color_directions(dir3, laueswitch)[source]

@AUTHOR Saransh Singh, Lawrence Livermore National Lab, saransh1@llnl.gov @DATE 11/12/2020 SS 1.0 original @PARAM dir3 is crystal direction obtained by multiplying inverse of crystal orientation with reference direction

laueswitch perform reducion based on lauegroup or the point group

@DETAIL this is the routine which makes the calls to sphere_sector class which correctly color the orientations for this crystal class. the logic is as follows:

  1. reduce direction to fundamental zone of point group

  2. reduce to fundamental zone of super group

  3. If both are same, then color (hsl) assigned by polar and azimuth

  4. If different, then barycenter lightness is replaced by 1-L (equivalent to replaceing barycenter to pi-theta)

color_orientations(rmats, ref_dir=array([0., 0., 1.]), laueswitch=True)[source]

@AUTHOR Saransh Singh, Lawrence Livermore National Lab, saransh1@llnl.gov @DATE 11/12/2020 SS 1.0 original @PARAM rmats rotation matrices of size nx3x3

ref_dir reference direction of the sample frame along which all crystal directions are colored laueswitch should we use laue group for coloring or not

@DETAIL this is a simple routine which takes orientations as rotations matrices and a reference sample direction ([0 0 1] by default) and returns the directions in the crystal reference frame. Note that the crystal orientations is defined as the the orientation which takes the “””SAMPLE””” reference frame TO the “””CRYSTAL””” frame. Since we are computing the conversion from crystal to sample, we will need to INVERT these matrices. Thanksfully, this is just a transpose

property compliance
convert_lp_to_valunits(lp)[source]

added 03/17/2021 SS

property dmin
property dmt
property dsm
fill_correct_lp_vals(lp, val, lp_name)[source]

added 03/17/2021 SS

property gamma
getHKLs(dmin)[source]

this function generates the symetrically unique set of hkls up to a given dmin. dmin is in nm

init_max_g_index()[source]

added 03/17/2021 SS

inside_spheretriangle(conn, dir3, hemisphere, switch)[source]

check if direction is inside a spherical triangle the logic used as follows: if determinant of [A B x], [A x C] and [x B C] are all same sign, then the sphere is inside the traingle formed by A, B and C

returns a mask with inside as True and outside as False

11/23/2020 SS switch is now a string specifying which symmetry group to use for reducing directions 11/23/2020 SS catching cases when vertices are empty

is_editable(lp_name)[source]

@author Saransh Singh, Lawrence Livermore National Lab @date 03/17/2021 SS 1.0 original @details check if a certain field in the lattice parameter is editable. this depends on the space group number or the lattice class

property lparms
property lparms_reduced
property num_atom
property numat
property pgnum
property point_group
reduce_dirvector(dir3, switch='pg')[source]

check if the dimensions of the dir3 array is to spec

remove_duplicate_atoms(atom_pos=None, tol=0.001)[source]

@date 03/04/2021 SS 1.0 original

@details it was requested that a functionality be added which can remove duplicate atoms from the atom_pos field such that no two atoms are closer that the distance specified by “tol” (lets assume its in A) steps involved are as follows: 1. get the star (or orbit) oe each point in atom_pos 2. if any points in the orbits are within tol, then remove the second point (the first point will be preserved by convention) 3. update the densities, interptables for structure factors etc.

@params tol tolerance of distance between points specified in A

property rmt
property rsm
property sgnum
property vol
property vol_per_atom
property voltage

calculate symmetry

property wavelength