Displacive#

The displacive module contains functions for working with atomic displacements required for setting up a displacive refinement.

cartesian(U11, U22, U33, U23, U13, U12, D)[source]#

Components of atomic displacement parameters in Cartesian coordiantes \(U_{xx}\), \(U_{yy}\), \(U_{zz}\), \(U_{yz}\), \(U_{xz}\), and \(U_{xy}\).

Parameters:
U11, U22, U33, U23, U13, U12float or 1d array

Components of atomic displacement parameters \(U_{11}\), \(U_{22}\), \(U_{33}\), \(U_{23}\), \(U_{13}\), and \(U_{12}\).

D2d array, 3x3

Transform matrix from crystal axis to Cartesian coordiante system.

Returns:
Uxx, Uyy, Uzz, Uyz, Uxz, Uxy1d array

Atomic displacement parameters in Cartesian coordiantes. Has same size as input atomic displacement parameter components.

coefficients(p)[source]#

Coefficients for the Taylor expansion product.

Parameters:
pint

Order of the Taylor expansion.

Returns:
coeffs1d array, complex

Array of coefficients

decompose(U11, U22, U33, U23, U13, U12, D)[source]#

Componenents of factorized atomic displacement parameters in Cartesian coordiantes \(L_{xx}\), \(L_{yy}\), \(L_{zz}\), \(L_{yz}\), \(L_{xz}\), and \(L_{xy}\).

Parameters:
U11, U22, U33, U23, U13, U12float or 1d array

Components of atomic displacement parameters \(U_{11}\), \(U_{22}\), \(U_{33}\), \(U_{23}\), \(U_{13}\), and \(U_{12}\).

D2d array, 3x3

Transform matrix from crystal axis to Cartesian coordiante system.

Returns:
Lxx, Lyy, Lzz, Lyz, Lxz, Lxy1d array

Lower triangular Cholesky decomposition in Cartesian coordiantes. Has same size as input atomic displacement parameter components.

equivalent(Uiso, D)[source]#

Components of atomic displacement parameters in crystal coordiantes \(U_{11}\), \(U_{22}\), \(U_{33}\), \(U_{23}\), \(U_{13}\), and \(U_{12}\).

Parameters:
Uiso1d array

Isotropic atomic displacement parameters \(U_\mathrm{iso}\).

D2d array, 3x3

Transform matrix from crystal axis to Cartesian coordiante system.

Returns:
U11, U22, U33, U23, U13, U12float or 1d array

Atomic displacement parameter components. Has same size as input isotropic atomic displacement parameters.

expansion(nu, nv, nw, n_atm, value=1, fixed=True)[source]#

Generate random displacement vectors.

Parameters:
nu, nv, nwint

Number of grid points \(N_1\), \(N_2\), \(N_3\) along the \(a\), \(b\), and \(c\)-axis of the supercell.

n_atmint

Number of atoms in the unit cell.

value1d array, optional

Magnitude of displacement vector, default value=1.

Returns:
Ux, Uy, Uz1d array

Atomic displacement vector components. Each array has a flattened shape of size nu*nv*nw*n_atm.

factorial(n)[source]#

Factorial \(n!\).

Parameters:
nint

Number.

Returns:
fint

Factorial of the number.

indices(p)[source]#

Even and odd indices for the Taylor expansion.

Parameters:
pint

Order of the Taylor expansion.

Returns:
even, odd1d array, int

Indices for the even and odd terms.

intensity(U_k, Q_k, coeffs, cond, p, i_dft, factors, subtract=True)[source]#

Displacive scattering intensity.

Parameters:
U_k1d array

Fourier transform of Taylor expansion displacement products.

Q_k1d array

Fourier transform of Taylor expansion wavevector products.

coeffs1d array

Taylor expansion coefficients

cond1d array

Array indices corresponding to nuclear Bragg peaks.

pint

Order of Taylor expansion

i_dft1d array, int

Array indices of Fourier transform corresponding to reciprocal space.

factors1d array

Prefactors of form factors, phase factors, and composition factors.

subtractboolean, optional

Optionally subtract the Bragg intensity or return the Bragg structure factor.

Returns:
I1d array

Intensity. Array has a flattened shape of size coeffs.shape[0]*i_dft.shape[0].

F_bragg1d array

Bragg structure factor. Array has a flattened shape of size coeffs.shape[0]*i_dft.shape[0].

isotropic(U11, U22, U33, U23, U13, U12, D)[source]#

Equivalent isotropic atomic displacement parameters \(U_\mathrm{iso}\).

Parameters:
U11, U22, U33, U23, U13, U12float or 1d array

Components of atomic displacement parameters \(U_{11}\), \(U_{22}\), \(U_{33}\), \(U_{23}\), \(U_{13}\), and \(U_{12}\).

D2d array, 3x3

Transform matrix from crystal axis to Cartesian coordiante system.

Returns:
Uiso1d array

Isotropic atomic displacement parameters. Has same size as input atomic displacement parameter components.

number(n)[source]#

\(n\)-th triangular number.

Parameters:
nint

Number.

Returns:
tint

Triangular number.

numbers(n)[source]#

Cumulative sum of \(0\dots n\) triangular numbers.

Parameters:
nint

Number.

Returns:
cint

Cumulative sum.

parameters(Ux, Uy, Uz, D, n_atm)[source]#

Atomic displacement paramters from atomic displacements.

Ux, Uy, Uz1d array

Atomic displacements in Cartesian coordinates.

D2d array, 3x3

Transform matrix from crystal axis to Cartesian coordiante system.

n_atmint

Number of atoms in the unit cell.

Returns:
U11, U22, U33, U23, U13, U121d array

Atomic displacement parameter components. Has same size as input atomic displacements.

principal(U11, U22, U33, U23, U13, U12, D)[source]#

Principal atomic displacement parameters \(U_\mathrm{1}\), \(U_\mathrm{2}\), and \(U_\mathrm{3}\).

Parameters:
U11, U22, U33, U23, U13, U12float or 1d array

Components of atomic displacement parameters \(U_{11}\), \(U_{22}\), \(U_{33}\), \(U_{23}\), \(U_{13}\), and \(U_{12}\).

D2d array, 3x3

Transform matrix from crystal axis to Cartesian coordiante system.

Returns:
U1, U2, U31d array

Principal atomic displacement parameters. Has same size as input atomic displacement parameter components.

products(Vx, Vy, Vz, p)[source]#

Trinomial expansion products.

Parameters:
Vx, Vy, Vz1d array or float

Vector compontents for Taylor expansion.

pint

Order of the Taylor expansion.

Returns:
values1d array or float

Trionomial products.

structure(U_k, Q_k, coeffs, cond, p, i_dft, factors)[source]#

Partial displacive structure factor.

Parameters:
U_k1d array

Fourier transform of Taylor expansion displacement products.

Q_k1d array

Fourier transform of Taylor expansion wavevector products.

coeffs1d array

Taylor expansion coefficients.

cond1d array

Array indices corresponding to nuclear Bragg peaks.

pint

Order of Taylor expansion.

i_dft1d array, int

Array indices of Fourier transform corresponding to reciprocal space.

factors1d array

Prefactors of scattering lengths, phase factors, and occupancies.

Returns:
F1d array

Structure factor. Array has a flattened shape of size coeffs.shape[0]*i_dft.shape[0].

F_nuc1d array

Bragg structure factor. Array has a flattened shape of size cond.sum()*i_dft.shape[0].

prod1d array

Partial structure factor. Array has a flattened shape of size coeffs.shape[0]*i_dft.shape[0]*n_atm.

prod_nuc1d array

Partial Bragg structure factor. Array has a flattened shape of size coeffs.sum()*i_dft.shape[0]*n_atm.

V_k1d array

Structural parameter. Array has a flattened shape of size coeffs.shape[0]*i_dft.shape[0]*n_atm.

V_k_nuc1d array

Bragg Structural parameter. Array has a flattened shape of size coeffs.sum()*i_dft.shape[0]*n_atm.

even1d array, int

Array indices of the even Taylor expandion coefficients.

bragg1d array, int

Indices of integer reciprocal coordinates. Array has a flattened shape of size coeffs.sum().

transform(U_r, H, K, L, nu, nv, nw, n_atm)[source]#

Discrete Fourier transform of Taylor expansion displacement products.

Parameters:
U_r1d array

Displacement parameter \(U\) (in Cartesian coordinates).

H, K, L1d array, int

Supercell index along the \(a^*\), \(b^*\), and \(c^*\)-axis in reciprocal space.

nu, nv, nwint

Number of grid points \(N_1\), \(N_2\), \(N_3\) along the \(a\), \(b\), and \(c\)-axis of the supercell.

n_atmint

Number of atoms in the unit cell.

Returns:
U_k1d array

Fourier transform of displacement parameter. Array has a flattened shape of size nu*nw*nv*n_atm.

i_dft1d array, int

Fourier transform indices. Array has a flattened shape of size nu*nw*nv*n_atm.