httk.atomistic.symmetry.xyz

Exact parsers for crystallographic coordinate-operation notation.

Functions

parse_linear_expression(expression[, allowed_vars])

Parse one superspace linear expression into integer coefficients and a translation.

operation_from_xyz(operation)

Parse an exact three-coordinate crystallographic operation.

operation_from_xyzt(operation)

Parse an exact magnetic operation and return its time-reversal flag.

Module Contents

httk.atomistic.symmetry.xyz.parse_linear_expression(expression, allowed_vars=_SUPERSPACE_VARS)[source]

Parse one superspace linear expression into integer coefficients and a translation.

The parser accepts the six superspace variables x1 through x6 by default and preserves an exact rational translation.

Parameters:
Returns:

The integer coefficients in allowed_vars and the exact translation.

Raises:

ValueError – If the expression is empty, malformed, or has a non-integer variable coefficient.

Return type:

tuple[tuple[int, Ellipsis], fractions.Fraction]

httk.atomistic.symmetry.xyz.operation_from_xyz(operation)[source]

Parse an exact three-coordinate crystallographic operation.

Parameters:

operation (str) – The comma-separated x,y,z operation string.

Returns:

The exact affine operation.

Raises:

ValueError – If the operation does not contain three valid coordinate expressions.

Return type:

httk.atomistic.symmetry.affine_operation.AffineOperation

httk.atomistic.symmetry.xyz.operation_from_xyzt(operation)[source]

Parse an exact magnetic operation and return its time-reversal flag.

The first three comma-separated fields use crystallographic x,y,z grammar; the fourth field must be +1 or -1.

Parameters:

operation (str) – The comma-separated x,y,z,time-reversal operation string.

Returns:

The affine operation and its time-reversal sign.

Raises:

ValueError – If the operation does not contain three coordinate expressions and a valid time-reversal flag.

Return type:

tuple[httk.atomistic.symmetry.affine_operation.AffineOperation, int]