httk.atomistic.symmetry.xyz¶
Exact parsers for crystallographic coordinate-operation notation.
Functions¶
|
Parse one superspace linear expression into integer coefficients and a translation. |
|
Parse an exact three-coordinate crystallographic 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
x1throughx6by default and preserves an exact rational translation.- Parameters:
expression (str) – The linear expression to parse.
allowed_vars (collections.abc.Sequence[str]) – The variable names accepted in
expression.
- Returns:
The integer coefficients in
allowed_varsand 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,zoperation string.- Returns:
The exact affine operation.
- Raises:
ValueError – If the operation does not contain three valid coordinate expressions.
- Return type:
- 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,zgrammar; the fourth field must be+1or-1.- Parameters:
operation (str) – The comma-separated
x,y,z,time-reversaloperation 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]