Space#

The space module contains functions for working with real and reciprocal-space maps.

cell(nu, nv, nw, A)[source]#

Supercell lattice points.

Parameters:
nu, nv, nwint

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

A2d array, 3x3

Transformation matrix from crystal to Cartesian coodinates in real space.

Returns:
ix, iy, iz1d array

Lattice points in Cartesian coordinates.

condition(H, K, L, nu=1, nv=1, nw=1, centering=None)[source]#

Reflection condition.

Symbol

Reflection condition

P

Primitive

I

Body-centered

F

Face-centered

R(obv)

Rhombohedral, obverse

R(rev)

Rhombohedral, reverse

C

C-centered

A

A-centered

B

B-centered

Parameters:
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. Default is 1.

centeringstr

Lattice centering. The default is None.

Returns:
h, k, l1d array

Supercell index where reflection condition is met.

cond1d array, bool

Array indices where reflection condition is met.

debye_waller(h_range, k_range, l_range, nh, nk, nl, U11, U22, U33, U23, U13, U12, a_, b_, c_, W=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]))[source]#

Debye-Waller factor.

Parameters:
h_range, k_range, l_range2-tuple or 2-list

Extents of \(h\), \(k\), and \(l\) (min, max) pairs

nh, nk, nlint

Number of grid points along the axes of the reciprocal space volume.

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

Atomic displacement parameters in crystal axis system.

a_, b_, c_float

Reciprocal lattice costants \(a^*\), \(b^*\) and \(c^*\).

W2d array, 3x3, optional

Transformation matrix from axis-aligned to nonaxis-aligned projection. Default is the identity matrix.

Returns:
T1d arry

Temperature factor.

factor(nu, nv, nw)[source]#

Phase factor for discrete Fourier Transform.

Parameters:
nu, nv, nwint

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

Returns:
pf1d array

Spatial vector in Cartesian coordinates.

indices(mask)[source]#

Masked and unmasked indices.

Parameters:
mask1d array, bool

Mask array.

Returns:
i_mask1d array, int

Indices of the masked values.

i_unmask1d array, int

Indices of the unmask values.

intensity(delta_k, i_dft, factors)[source]#

Average structural scattering intensity.

Parameters:
delta_k1d array

Fourier transform of occupancy parameter.

i_dft1d array, int

Array indices of Fourier transform corresponding to reciprocal space.

factors1d array

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

Returns:
I1d array

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

mapping(h_range, k_range, l_range, nh, nk, nl, nu, nv, nw, W=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), laue=None)[source]#

Reciprocal space mapping.

Parameters:
h_range, k_range, l_range2-tuple or 2-list

Extents of \(h\), \(k\), and \(l\) (min, max) pairs

nh, nk, nlint

Number of grid points along the axes of the reciprocal space volume.

nu, nv, nwint

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

W2d array, 3x3, optional

Transformation matrix from axis-aligned to nonaxis-aligned projection. Default is the identity matrix.

lauestr

Laue class to use for symmetrization. Default is None.

Returns:
h, k, l1d array

Reciprocal space lattice units

H, K, L1d array, int

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

index1d array, int

Index of reduced data.

reverses1d array, int

Mapping of reduced data that reconstructs full volume.

symops1d array, str

Symmetry operations correspoding to Laue class.

prefactors(scattering_length, phase_factor, occupancy)[source]#

Scattering prefactors.

Parameters:
scattering_length1d array

Scattering length or form factors.

phase_factor1d array

Phase factors

occupancy1d array

Unit cell occupancies.

Returns:
factors1d array

Constant prefactors.

real(ux, uy, uz, ix, iy, iz, atm)[source]#

Real space spatial vectors.

Parameters:
ux, uy, uz1d array

Unit cell atomic coordinates in Cartesian coordiantes.

ix, iy, iz1d array

Supercell lattice points in Cartesian coordinates.

atm1d array, str

Unit cell atomic, ions, or isotopes.

Returns:
rx, ry, rz1d array

Spatial vector in Cartesian coordinates.

atms1d array, str

Supercell atomic, ions, or isotopes.

reciprocal(h_range, k_range, l_range, mask, B, W=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]))[source]#

Reciprocal space wavevector.

Parameters:
h_range, k_range, l_range2-tuple or 2-list

Extents of \(h\), \(k\), and \(l\) (min, max) pairs.

mask3d array, bool

Reciprocal space volume mask. Shape determines bin size.

B2d array, 3x3

Transformation matrix from crystal to Cartesian coodinates in reciprocal space.

W2d array, 3x3, optional

Transformation matrix from axis-aligned to nonaxis-aligned projection. Default is the identity matrix.

Returns:
Qh, Qk, Ql1d array

Wavevector in Cartesian coordinates.

reduced(h_range, k_range, l_range, nh, nk, nl, nu, nv, nw, W=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), laue=None)[source]#

Reduced reciprocal space mapping with resolution constrained by supercell.

Parameters:
h_range, k_range, l_range2-tuple or 2-list

Extents of \(h\), \(k\), and \(l\) (min, max) pairs

nh, nk, nlint

Number of grid points along the axes of the reciprocal space volume.

nu, nv, nwint

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

W2d array, 3x3, optional

Transformation matrix from axis-aligned to nonaxis-aligned projection. Default is the identity matrix.

lauestr

Laue class to use for symmetrization. Default is None.

Returns:
index1d array, int

Index of reduced data.

reverses1d array, int

Mapping of reduced data that reconstructs full volume.

symops1d array, str

Symmetry operations correspoding to Laue class.

Nu, Nv, Nwint

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

structure(delta_k, i_dft, factors)[source]#

Partial average structure factor.

Parameters:
delta_k1d array

Fourier transform of occupancy parameter.

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].

prod1d array

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

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

Discrete Fourier transform of occupancy parameter.

Parameters:
delta_r1d array

Occupancy parameter.

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:
delta_k1d array

Fourier transform of occupancy 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.

unit(vx, vy, vz)[source]#

Unit vectors and magnitude.

Parameters:
vx, vy, vz1d array

Vector components in Cartesian coordinates.

Returns:
nx, ny, nz1d array

Unit vector.

v1d array

Scalar magnitude.