schrodinger.application.matsci.gsas.GSASIIlattice module

# Third-party code. No Schrodinger Copyright.

GSASIIlattice: Unit cells

Perform lattice-related computations

Note that G is the reciprocal lattice tensor, and g is its inverse, G = g^{-1}, where

g = \left( \begin{matrix} a^2 & a b\cos gamma & a c\cos\beta \\ a b\cos\gamma & b^2 & b c cos\alpha \\ a c\cos\beta & b c \cos\alpha & c^2 \end{matrix}\right)

The “A tensor” terms are defined as A = (\begin{matrix} G_{11} & G_{22} & G_{33} & 2G_{12} & 2G_{13} & 2G_{23}\end{matrix}) and A can be used in this fashion: d^* = sqrt {A_1 h^2 + A_2 k^2 + A_3 l^2 + A_4 hk + A_5 hl + A_6 kl}, where d is the d-spacing, and d^* is the reciprocal lattice spacing, Q = 2 \pi d^* = 2 \pi / d

schrodinger.application.matsci.gsas.GSASIIlattice.sind(x)
schrodinger.application.matsci.gsas.GSASIIlattice.asind(x)
schrodinger.application.matsci.gsas.GSASIIlattice.tand(x)
schrodinger.application.matsci.gsas.GSASIIlattice.atand(x)
schrodinger.application.matsci.gsas.GSASIIlattice.atan2d(y, x)
schrodinger.application.matsci.gsas.GSASIIlattice.cosd(x)
schrodinger.application.matsci.gsas.GSASIIlattice.acosd(x)
schrodinger.application.matsci.gsas.GSASIIlattice.rdsq2d(x)
schrodinger.application.matsci.gsas.GSASIIlattice.sec2HMS(sec)

Convert time in sec to H:M:S string

Parameters

sec – time in seconds

Returns

H:M:S string (to nearest 100th second)

schrodinger.application.matsci.gsas.GSASIIlattice.rotdMat(angle, axis=0)

Prepare rotation matrix for angle in degrees about axis(=0,1,2)

Parameters
  • angle – angle in degrees

  • axis – axis (0,1,2 = x,y,z) about which for the rotation

Returns

rotation matrix - 3x3 numpy array

schrodinger.application.matsci.gsas.GSASIIlattice.rotdMat4(angle, axis=0)

Prepare rotation matrix for angle in degrees about axis(=0,1,2) with scaling for OpenGL

Parameters
  • angle – angle in degrees

  • axis – axis (0,1,2 = x,y,z) about which for the rotation

Returns

rotation matrix - 4x4 numpy array (last row/column for openGL scaling)

schrodinger.application.matsci.gsas.GSASIIlattice.fillgmat(cell)

Compute lattice metric tensor from unit cell constants

Parameters

cell – tuple with a,b,c,alpha, beta, gamma (degrees)

Returns

3x3 numpy array

schrodinger.application.matsci.gsas.GSASIIlattice.cell2Gmat(cell)

Compute real and reciprocal lattice metric tensor from unit cell constants

Parameters

cell – tuple with a,b,c,alpha, beta, gamma (degrees)

Returns

reciprocal (G) & real (g) metric tensors (list of two numpy 3x3 arrays)

schrodinger.application.matsci.gsas.GSASIIlattice.A2Gmat(A, inverse=True)

Fill real & reciprocal metric tensor (G) from A.

Parameters
  • A – reciprocal metric tensor elements as [G11,G22,G33,2*G12,2*G13,2*G23]

  • inverse (bool) – if True return both G and g; else just G

Returns

reciprocal (G) & real (g) metric tensors (list of two numpy 3x3 arrays)

schrodinger.application.matsci.gsas.GSASIIlattice.Gmat2A(G)

Extract A from reciprocal metric tensor (G)

Parameters

G – reciprocal maetric tensor (3x3 numpy array

Returns

A = [G11,G22,G33,2*G12,2*G13,2*G23]

schrodinger.application.matsci.gsas.GSASIIlattice.cell2A(cell)

Obtain A = [G11,G22,G33,2*G12,2*G13,2*G23] from lattice parameters

Parameters

cell – [a,b,c,alpha,beta,gamma] (degrees)

Returns

G reciprocal metric tensor as 3x3 numpy array

schrodinger.application.matsci.gsas.GSASIIlattice.A2cell(A)

Compute unit cell constants from A

Parameters

A – [G11,G22,G33,2*G12,2*G13,2*G23] G - reciprocal metric tensor

Returns

a,b,c,alpha, beta, gamma (degrees) - lattice parameters

schrodinger.application.matsci.gsas.GSASIIlattice.Gmat2cell(g)

Compute real/reciprocal lattice parameters from real/reciprocal metric tensor (g/G) The math works the same either way.

Parameters

G) (g (or) – real (or reciprocal) metric tensor 3x3 array

Returns

a,b,c,alpha, beta, gamma (degrees) (or a*,b*,c*,alpha*,beta*,gamma* degrees)

schrodinger.application.matsci.gsas.GSASIIlattice.invcell2Gmat(invcell)
Compute real and reciprocal lattice metric tensor from reciprocal

unit cell constants

Parameters

invcell – [a*,b*,c*,alpha*, beta*, gamma*] (degrees)

Returns

reciprocal (G) & real (g) metric tensors (list of two 3x3 arrays)

schrodinger.application.matsci.gsas.GSASIIlattice.cellDijFill(pfx, phfx, SGData, parmDict)

Returns the filled-out reciprocal cell (A) terms from the parameter dictionaries corrected for Dij.

Parameters
  • pfx (str) – parameter prefix (“n::”, where n is a phase number)

  • SGdata (dict) – a symmetry object

  • parmDict (dict) – a dictionary of parameters

Returns

A,sigA where each is a list of six terms with the A terms

schrodinger.application.matsci.gsas.GSASIIlattice.prodMGMT(G, Mat)

Transform metric tensor by matrix

Parameters
  • G – array metric tensor

  • Mat – array transformation matrix

Returns

array new metric tensor

schrodinger.application.matsci.gsas.GSASIIlattice.TransformCell(cell, Trans)

Transform lattice parameters by matrix

Parameters
  • cell – list a,b,c,alpha,beta,gamma,(volume)

  • Trans – array transformation matrix

Returns

array transformed a,b,c,alpha,beta,gamma,volume

schrodinger.application.matsci.gsas.GSASIIlattice.TransformXYZ(XYZ, Trans, Vec)
schrodinger.application.matsci.gsas.GSASIIlattice.TransformU6(U6, Trans)
schrodinger.application.matsci.gsas.GSASIIlattice.ExpandCell(Atoms, atCodes, cx, Trans)
schrodinger.application.matsci.gsas.GSASIIlattice.TransformPhase(oldPhase, newPhase, Trans, Uvec, Vvec, ifMag)

Transform atoms from oldPhase to newPhase M’ is inv(M) does X’ = M(X-U)+V transformation for coordinates and U’ = MUM/det(M) for anisotropic thermal parameters

Parameters
  • oldPhase – dict G2 phase info for old phase

  • newPhase – dict G2 phase info for new phase; with new cell & space group atoms are from oldPhase & will be transformed

  • Trans – lattice transformation matrix M

  • Uvec – array parent coordinates transformation vector U

  • Vvec – array child coordinate transformation vector V

  • ifMag – bool True if convert to magnetic phase; if True all nonmagnetic atoms will be removed

Returns

newPhase dict modified G2 phase info

Returns

atCodes list atom transformation codes

schrodinger.application.matsci.gsas.GSASIIlattice.FindNonstandard(controls, Phase)

Find nonstandard setting of magnetic cell that aligns with parent nuclear cell

Parameters
  • controls – list unit cell indexing controls

  • Phase – dict new magnetic phase data (NB:not G2 phase construction); modified here

Returns

None

schrodinger.application.matsci.gsas.GSASIIlattice.makeBilbaoPhase(result, uvec, trans, ifMag=False)
schrodinger.application.matsci.gsas.GSASIIlattice.FillUnitCell(Phase)
schrodinger.application.matsci.gsas.GSASIIlattice.GetUnique(Phase, atCodes)
schrodinger.application.matsci.gsas.GSASIIlattice.calc_rVsq(A)

Compute the square of the reciprocal lattice volume (1/V**2) from A’

schrodinger.application.matsci.gsas.GSASIIlattice.calc_rV(A)

Compute the reciprocal lattice volume (V*) from A

schrodinger.application.matsci.gsas.GSASIIlattice.calc_V(A)

Compute the real lattice volume (V) from A

schrodinger.application.matsci.gsas.GSASIIlattice.A2invcell(A)

Compute reciprocal unit cell constants from A returns tuple with a*,b*,c*,alpha*, beta*, gamma* (degrees)

schrodinger.application.matsci.gsas.GSASIIlattice.Gmat2AB(G)

Computes orthogonalization matrix from reciprocal metric tensor G

Returns

tuple of two 3x3 numpy arrays (A,B)

  • A for crystal to Cartesian transformations (A*x = np.inner(A,x) = X)

  • B (= inverse of A) for Cartesian to crystal transformation (B*X = np.inner(B,X) = x)

schrodinger.application.matsci.gsas.GSASIIlattice.cell2AB(cell)

Computes orthogonalization matrix from unit cell constants

Parameters

cell (tuple) – a,b,c, alpha, beta, gamma (degrees)

Returns

tuple of two 3x3 numpy arrays (A,B) A for crystal to Cartesian transformations A*x = np.inner(A,x) = X B (= inverse of A) for Cartesian to crystal transformation B*X = np.inner(B,X) = x

schrodinger.application.matsci.gsas.GSASIIlattice.HKL2SpAng(H, cell, SGData)

Computes spherical coords for hkls; view along 001

Parameters
  • H (array) – arrays of hkl

  • cell (tuple) – a,b,c, alpha, beta, gamma (degrees)

  • SGData (dict) – space group dictionary

Returns

arrays of r,phi,psi (radius,inclination,azimuth) about 001

schrodinger.application.matsci.gsas.GSASIIlattice.U6toUij(U6)

Fill matrix (Uij) from U6 = [U11,U22,U33,U12,U13,U23] NB: there is a non numpy version in GSASIIspc: U2Uij

Parameters

U6 (list) – 6 terms of u11,u22,…

Returns

Uij - numpy [3][3] array of uij

schrodinger.application.matsci.gsas.GSASIIlattice.UijtoU6(U)

Fill vector [U11,U22,U33,U12,U13,U23] from Uij NB: there is a non numpy version in GSASIIspc: Uij2U

schrodinger.application.matsci.gsas.GSASIIlattice.betaij2Uij(betaij, G)

Convert beta-ij to Uij tensors

:param beta-ij - numpy array [beta-ij] :param G: reciprocal metric tensor :returns: Uij: numpy array [Uij]

schrodinger.application.matsci.gsas.GSASIIlattice.Uij2betaij(Uij, G)

Convert Uij to beta-ij tensors – stub for eventual completion

Parameters
  • Uij – numpy array [Uij]

  • G – reciprocal metric tensor

Returns

beta-ij - numpy array [beta-ij]

schrodinger.application.matsci.gsas.GSASIIlattice.cell2GS(cell)

returns Uij to betaij conversion matrix

schrodinger.application.matsci.gsas.GSASIIlattice.Uij2Ueqv(Uij, GS, Amat)

returns 1/3 trace of diagonalized U matrix

schrodinger.application.matsci.gsas.GSASIIlattice.CosAngle(U, V, G)

calculate cos of angle between U & V in generalized coordinates defined by metric tensor G

Parameters
  • U – 3-vectors assume numpy arrays, can be multiple reflections as (N,3) array

  • V – 3-vectors assume numpy arrays, only as (3) vector

  • G – metric tensor for U & V defined space assume numpy array

Returns

cos(phi)

schrodinger.application.matsci.gsas.GSASIIlattice.CosSinAngle(U, V, G)

calculate sin & cos of angle between U & V in generalized coordinates defined by metric tensor G

Parameters
  • U – 3-vectors assume numpy arrays

  • V – 3-vectors assume numpy arrays

  • G – metric tensor for U & V defined space assume numpy array

Returns

cos(phi) & sin(phi)

schrodinger.application.matsci.gsas.GSASIIlattice.criticalEllipse(prob)

Calculate critical values for probability ellipsoids from probability

schrodinger.application.matsci.gsas.GSASIIlattice.CellBlock(nCells)

Generate block of unit cells n*n*n on a side; [0,0,0] centered, n = 2*nCells+1 currently only works for nCells = 0 or 1 (not >1)

schrodinger.application.matsci.gsas.GSASIIlattice.CellAbsorption(ElList, Volume)

Compute unit cell absorption

Parameters
  • ElList (dict) – dictionary of element contents including mu and number of atoms be cell

  • Volume (float) – unit cell volume

Returns

mu-total/Volume

schrodinger.application.matsci.gsas.GSASIIlattice.combinations(items, n)

take n distinct items, order matters

schrodinger.application.matsci.gsas.GSASIIlattice.uniqueCombinations(items, n)

take n distinct items, order is irrelevant

schrodinger.application.matsci.gsas.GSASIIlattice.selections(items, n)

take n (not necessarily distinct) items, order matters

schrodinger.application.matsci.gsas.GSASIIlattice.permutations(items)

take all items, order matters

schrodinger.application.matsci.gsas.GSASIIlattice.Pos2dsp(Inst, pos)

convert powder pattern position (2-theta or TOF, musec) to d-spacing

schrodinger.application.matsci.gsas.GSASIIlattice.TOF2dsp(Inst, Pos)

convert powder pattern TOF, musec to d-spacing by successive approximation Pos can be numpy array

schrodinger.application.matsci.gsas.GSASIIlattice.Dsp2pos(Inst, dsp)

convert d-spacing to powder pattern position (2-theta or TOF, musec)

schrodinger.application.matsci.gsas.GSASIIlattice.getPeakPos(dataType, parmdict, dsp)

convert d-spacing to powder pattern position (2-theta or TOF, musec)

schrodinger.application.matsci.gsas.GSASIIlattice.calc_rDsq(H, A)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.calc_rDsq2(H, G)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.calc_rDsqSS(H, A, vec)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.calc_rDsqZ(H, A, Z, tth, lam)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.calc_rDsqZSS(H, A, vec, Z, tth, lam)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.calc_rDsqT(H, A, Z, tof, difC)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.calc_rDsqTSS(H, A, vec, Z, tof, difC)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.PlaneIntercepts(Amat, H, phase, stack)

find unit cell intercepts for a stack of hkl planes

schrodinger.application.matsci.gsas.GSASIIlattice.MaxIndex(dmin, A)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.transposeHKLF(transMat, Super, refList)

Apply transformation matrix to hkl(m) param: transmat: 3x3 or 4x4 array param: Super: 0 or 1 for extra index param: refList list of h,k,l,…. return: newRefs transformed list of h’,k’,l’,,, return: badRefs list of noninteger h’,k’,l’…

schrodinger.application.matsci.gsas.GSASIIlattice.sortHKLd(HKLd, ifreverse, ifdup, ifSS=False)

sort reflection list on d-spacing; can sort in either order

Parameters
  • HKLd – a list of [h,k,l,d,…];

  • ifreverse – True for largest d first

  • ifdup – True if duplicate d-spacings allowed

Returns

sorted reflection list

schrodinger.application.matsci.gsas.GSASIIlattice.SwapIndx(Axis, H)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.Rh2Hx(Rh)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.Hx2Rh(Hx)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.CentCheck(Cent, H)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.GetBraviasNum(center, system)

Determine the Bravais lattice number, as used in GenHBravais

Parameters
  • center – one of: ‘P’, ‘C’, ‘I’, ‘F’, ‘R’ (see SGLatt from GSASIIspc.SpcGroup)

  • system – one of ‘cubic’, ‘hexagonal’, ‘tetragonal’, ‘orthorhombic’, ‘trigonal’ (for R) ‘monoclinic’, ‘triclinic’ (see SGSys from GSASIIspc.SpcGroup)

Returns

a number between 0 and 13 or throws a ValueError exception if the combination of center, system is not found (i.e. non-standard)

schrodinger.application.matsci.gsas.GSASIIlattice.GenHBravais(dmin, Bravais, A)

Generate the positionally unique powder diffraction reflections

Parameters
  • dmin – minimum d-spacing in A

  • Bravais

    lattice type (see GetBraviasNum). Bravais is one of:

    • 0 F cubic

    • 1 I cubic

    • 2 P cubic

    • 3 R hexagonal (trigonal not rhombohedral)

    • 4 P hexagonal

    • 5 I tetragonal

    • 6 P tetragonal

    • 7 F orthorhombic

    • 8 I orthorhombic

    • 9 A orthorhombic

    • 10 B orthorhombic

    • 11 C orthorhombic

    • 12 P orthorhombic

    • 13 I monoclinic

    • 14 C monoclinic

    • 15 P monoclinic

    • 16 P triclinic

  • A – reciprocal metric tensor elements as [G11,G22,G33,2*G12,2*G13,2*G23]

Returns

HKL unique d list of [h,k,l,d,-1] sorted with largest d first

schrodinger.application.matsci.gsas.GSASIIlattice.getHKLmax(dmin, SGData, A)

finds maximum allowed hkl for given A within dmin

schrodinger.application.matsci.gsas.GSASIIlattice.GenHLaue(dmin, SGData, A)

Generate the crystallographically unique powder diffraction reflections for a lattice and Bravais type

Parameters
  • dmin – minimum d-spacing

  • SGData

    space group dictionary with at least

    • ’SGLaue’: Laue group symbol: one of ‘-1’,’2/m’,’mmm’,’4/m’,’6/m’,’4/mmm’,’6/mmm’, ‘3m1’, ‘31m’, ‘3’, ‘3R’, ‘3mR’, ‘m3’, ‘m3m’

    • ’SGLatt’: lattice centering: one of ‘P’,’A’,’B’,’C’,’I’,’F’

    • ’SGUniq’: code for unique monoclinic axis one of ‘a’,’b’,’c’ (only if ‘SGLaue’ is ‘2/m’) otherwise an empty string

  • A – reciprocal metric tensor elements as [G11,G22,G33,2*G12,2*G13,2*G23]

Returns

HKL = list of [h,k,l,d] sorted with largest d first and is unique part of reciprocal space ignoring anomalous dispersion

schrodinger.application.matsci.gsas.GSASIIlattice.GenPfHKLs(nMax, SGData, A)

Generate the unique pole figure reflections for a lattice and Bravais type. Min d-spacing=1.0A & no more than nMax returned

Parameters
  • nMax – maximum number of hkls returned

  • SGData

    space group dictionary with at least

    • ’SGLaue’: Laue group symbol: one of ‘-1’,’2/m’,’mmm’,’4/m’,’6/m’,’4/mmm’,’6/mmm’, ‘3m1’, ‘31m’, ‘3’, ‘3R’, ‘3mR’, ‘m3’, ‘m3m’

    • ’SGLatt’: lattice centering: one of ‘P’,’A’,’B’,’C’,’I’,’F’

    • ’SGUniq’: code for unique monoclinic axis one of ‘a’,’b’,’c’ (only if ‘SGLaue’ is ‘2/m’) otherwise an empty string

  • A – reciprocal metric tensor elements as [G11,G22,G33,2*G12,2*G13,2*G23]

Returns

HKL = list of ‘h k l’ strings sorted with largest d first; no duplicate zones

schrodinger.application.matsci.gsas.GSASIIlattice.GenSSHLaue(dmin, SGData, SSGData, Vec, maxH, A)

needs a doc string

schrodinger.application.matsci.gsas.GSASIIlattice.LaueUnique2(SGData, refList)

Impose Laue symmetry on hkl

Parameters
  • SGData – space group data from ‘P ‘+Laue

  • HKLF – np.array([[h,k,l,…]]) reflection set to be converted

Returns

HKLF new reflection array with imposed Laue symmetry

schrodinger.application.matsci.gsas.GSASIIlattice.LaueUnique(Laue, HKLF)

Impose Laue symmetry on hkl

Parameters
  • Laue (str) –

    Laue symbol, as below

    centrosymmetric Laue groups:

    ['-1','2/m','112/m','2/m11','mmm','-42m','-4m2','4/mmm','-3',
    '-31m','-3m1','6/m','6/mmm','m3','m3m']
    

    noncentrosymmetric Laue groups:

    ['1','2','211','112','m','m11','11m','222','mm2','m2m','2mm',
    '4','-4','422','4mm','3','312','321','31m','3m1','6','-6',
    '622','6mm','-62m','-6m2','23','432','-43m']
    

  • HKLF – np.array([[h,k,l,…]]) reflection set to be converted

Returns

HKLF new reflection array with imposed Laue symmetry

schrodinger.application.matsci.gsas.GSASIIlattice.OdfChk(SGLaue, L, M)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.GenSHCoeff(SGLaue, SamSym, L, IfLMN=True)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.CrsAng(H, cell, SGData)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.SamAng(Tth, Gangls, Sangl, IFCoup)

Compute sample orientation angles vs laboratory coord. system

Parameters
  • Tth – Signed theta

  • Gangls – Sample goniometer angles phi,chi,omega,azmuth

  • Sangl – Sample angle zeros om-0, chi-0, phi-0

  • IFCoup – True if omega & 2-theta coupled in CW scan

Returns

psi,gam: Sample odf angles dPSdA,dGMdA: Angle zero derivatives

schrodinger.application.matsci.gsas.GSASIIlattice.Lnorm(L)
schrodinger.application.matsci.gsas.GSASIIlattice.GetKcl(L, N, SGLaue, phi, beta)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.GetKsl(L, M, SamSym, psi, gam)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.GetKclKsl(L, N, SGLaue, psi, phi, beta)
This is used for spherical harmonics description of preferred orientation;

cylindrical symmetry only (M=0) and no sample angle derivatives returned

schrodinger.application.matsci.gsas.GSASIIlattice.Glnh(Start, SHCoef, psi, gam, SamSym)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.Flnh(Start, SHCoef, phi, beta, SGData)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.polfcal(ODFln, SamSym, psi, gam)

Perform a pole figure computation. Note that the the number of gam values must either be 1 or must match psi. Updated for numpy 1.8.0

schrodinger.application.matsci.gsas.GSASIIlattice.invpolfcal(ODFln, SGData, phi, beta)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.textureIndex(SHCoef)

needs doc string

schrodinger.application.matsci.gsas.GSASIIlattice.selftestlist = []

Defines a list of self-tests

schrodinger.application.matsci.gsas.GSASIIlattice.TestData()
schrodinger.application.matsci.gsas.GSASIIlattice.test0()
schrodinger.application.matsci.gsas.GSASIIlattice.test1()

test cell2A and A2Gmat

schrodinger.application.matsci.gsas.GSASIIlattice.test2()

test Gmat2A, A2cell, A2Gmat, Gmat2cell

schrodinger.application.matsci.gsas.GSASIIlattice.test3()

test invcell2Gmat

schrodinger.application.matsci.gsas.GSASIIlattice.test4()

test calc_rVsq, calc_rV, calc_V

schrodinger.application.matsci.gsas.GSASIIlattice.test5()

test A2invcell

schrodinger.application.matsci.gsas.GSASIIlattice.test6()

test cell2AB

schrodinger.application.matsci.gsas.GSASIIlattice.test7()

test GetBraviasNum(…) and GenHBravais(…)

schrodinger.application.matsci.gsas.GSASIIlattice.test8()

test GenHLaue

schrodinger.application.matsci.gsas.GSASIIlattice.test9()

test GenHLaue