Crystal#

The crystal module contains functions for working with Crystallographic Information Files (CIF).

cartesian(a, b, c, alpha, beta, gamma)[source]#

Transformation matrix from crystal to Cartesian coodinates.

Parameters:
a, b, c, alpha, beta, gammafloat

Lattice constants and angles. Angles in radians.

Returns:
A2d array

Transformation matrix.

cartesian_displacement(a, b, c, alpha, beta, gamma)[source]#

Transformation matrix from crystal to Cartesian coodinates for atomic displacement parameters.

Parameters:
a, b, c, alpha, beta, gammafloat

Lattice constants and angles. Angles in radians.

Returns:
D2d array

Transformation matrix.

cartesian_moment(a, b, c, alpha, beta, gamma)[source]#

Transformation matrix from crystal to Cartesian coodinates for magnetic moments.

Parameters:
a, b, c, alpha, beta, gammafloat

Lattice constants and angles. Angles in radians.

Returns:
C2d array

Transformation matrix.

cartesian_rotation(a, b, c, alpha, beta, gamma)[source]#

Rotation matrix between reciprocal and real Cartesian coodinates.

Parameters:
a, b, c, alpha, beta, gammafloat

Lattice constants and angles. Angles in radians.

Returns:
R2d array

Rotation matrix.

d(a, b, c, alpha, beta, gamma, h, k, l)[source]#

Interplanar d-spacing.

Parameters:
a, b, c, alpha, beta, gammafloat

Lattice constants and angles. Angles in radians.

h, k, l1d array

Miller indices

Returns:
d1d array

d-spacings.

disordered(delta, Ux, Uy, Uz, Sx, Sy, Sz, rx, ry, rz, nu, nv, nw, atm, A, name, folder, filename)[source]#

Write disordered supercell information to a CIF file.

Parameters:
delta1d array

Relative occupancies.

Ux, Uy, Uz1d array

Atomic displacementsr in Cartesian coordinates.

Sx, Sy, Sz1d array

Magnetic momentsr in Cartesian coordinates.

rx, ry, rz1d array

Spatial vector in Cartesian coordinates.

nu, nv, nwint

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

atm1d array, str

Atoms, ions, or isotopes.

A2d array

Transformation matrix from crystal to Cartesian coordinates.

folderstr,

Name of path excluding filename of reference CIF file.

filenamestr

Name of filename excluding path of reference CIF file.

group(folder, filename)[source]#

Reads space group information from a CIF file.

Parameters:
folderstr,

Name of path excluding filename.

filenamestr

Name of filename excluding path.

Returns:
groupint

Space group number.

hmstr

Space group symbol in Hermann–Mauguin notation.

interplanar(a, b, c, alpha, beta, gamma, h0, k0, l0, h1, k1, l1)[source]#

Interplanar angle.

Parameters:
a, b, c, alpha, beta, gammafloat

Lattice constants and angles. Angles in radians.

h, k, l1d array

Miller indices

Returns:
angle1d array

Interplanar angles in radians.

lattice(a, b, c, alpha, beta, gamma)[source]#

Lattice system of unit cell based on lattice parameters.

Parameters:
a, b, c, alpha, beta, gammafloat

Lattice constants and angles. Angles in radians.

Returns:
systemstr

One of 'Cubic', 'Hexagonal', 'Rhombohedral', 'Tetragonal', 'Orthorhombic', 'Monoclinic', or 'Triclinic'.

laue(folder, filename)[source]#

Determines Laue class from a CIF file.

Laue

Noncentrosymmetric

m-3m

432, -43m

m-3

23

6/mmm

622, -62m, 6mmm

6/m

6, -6

-3m

32, 3m

-3

3

4/mmm

422, -42m, 4mm

4/m

4, -4

mmm

222, 22m

2/m

2, m

-1

1

Parameters:
folderstr,

Name of path excluding filename.

filenamestr

Name of filename excluding path.

Returns:
lauestr

One of '-1', '2/m', 'mmm', '4/m', '4/mmm', '-3', '-3m', '6/m', '6/mmm', 'm-3', or 'm-3m'.

metric(a, b, c, alpha, beta, gamma)[source]#

Metric tensor.

Parameters:
a, b, c, alpha, beta, gammafloat

Lattice constants and angles. Angles in radians.

Returns:
G2d array

Components of the \(G\) metric tensor.

operators(folder, filename)[source]#

Reads symmetry operators from a CIF file.

Parameters:
folderstr,

Name of path excluding filename.

filenamestr

Name of filename excluding path.

Returns:
symopslist

Symmetry operators in Jones-faithful notation.

parameters(folder=None, filename=None)[source]#

Reads lattice parameters from a CIF file.

Parameters:
folderstr,

Name of path excluding filename.

filenamestr

Name of filename excluding path.

Returns:
a, b, c, alpha, beta, gammafloat

Lattice constants and angles. Angles in radians.

reciprocal(a, b, c, alpha, beta, gamma)[source]#

Reciprocal lattice parameters.

Parameters:
a, b, c, alpha, beta, gammafloat

Lattice constants and angles. Angles in radians.

Returns:
a_, b_, c_, alpha_, beta_, gamma_float

Reciprocal lattice constants and angles. Angles in radians.

supercell(atm, occ, disp, mom, u, v, w, nu, nv, nw, name, folder, filename)[source]#

Write average supercell information to a CIF file.

Parameters:
atm1d array, str

Atoms, ions, or isotopes.

occ1d array

Site occupancies.

disp1d array

Atomic displacements.

mom1d array

Magnetic moments.

u, v, w1d array

Fractional coordinates.

nu, nv, nwint

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

folderstr,

Name of path excluding filename of reference CIF file.

filenamestr

Name of filename excluding path of reference CIF file.

tolfloat, optional

Tolerance of unique atom coordinates.

transform(p, q, r, U)[source]#

Transform the components of a vector.

Parameters:
p, q, r1d array

Components of a vector.

U2d array

Transformation matrix.

Returns:
x, y, z1d array

Transformed components of a vector.

twins(folder, filename)[source]#

Reads twin matrices from a CIF file.

Parameters:
folderstr,

Name of path excluding filename.

filenamestr

Name of filename excluding path.

Returns:
T3d array

Twin matrices with individual components along last two axes.

weights1d array

Twin mass fraction.

unitcell(folder, filename, tol=0.01)[source]#

Reads atom site information from a CIF file.

Parameters:
folderstr,

Name of path excluding filename.

filenamestr

Name of filename excluding path.

tolfloat, optional

Tolerance of unique atom coordinates.

Returns:
unit_celldict

Dictionary of unit cell information.

vector(h, k, l, B)[source]#

Recirprocal lattice vector in Cartesian coodinates.

Parameters:
h, k, l1d array

Miller indices.

B2d array

Transformation matrix from crystal to Cartesian coodinates in reciprocal space.

Returns:
Qx, Qy, Qz1d array

Recirprocal lattice vector in Cartesian coodinates.

vectors(folder, filename)[source]#

Reads propagation vectors from a CIF file.

Parameters:
folderstr,

Name of path excluding filename.

filenamestr

Name of filename excluding path.

Returns:
kvecslist

Proapagtion operators.

volume(a, b, c, alpha, beta, gamma)[source]#

Volume of unit cell.

Parameters:
a, b, c, alpha, beta, gammafloat

Lattice constants and angles. Angles in radians.

Returns:
Vfloat

Unit cell volume.