hikari.symmetry.operations
This file contains class and definitions of 3-dimensional symmetry operations.
Classes
Class storing information about symmetry operations, with clear string |
|
A subclass of Operation where all three elements of the translation |
|
A subclass of BoundedOperation, asserts translation vector = [0,0,0] |
Module Contents
- class hikari.symmetry.operations.Operation(transformation, translation=np.array([0, 0, 0]))[source]
Class storing information about symmetry operations, with clear string representation and intuitive syntax for combining / utilising operations: “=” to compare two symmetry operations for logical equivalence, “*” to combine two symmetry operations or transform a vector, “** n” to apply symmetry operation n times, “% n” to restrict symmetry operation to n unit cells. Some of the functions may work incorrectly for rhombohedral unit cells #TODO
- class Type[source]
Bases:
enum.EnumEnumerator class storing information about type of operation
- rotoinversion = 4
- identity = 3
- reflection = 2
- rotation = 1
- inversion = 0
- rototranslation = -1
- transflection = -2
- translation = -3
- property tf: numpy.ndarray
- Return type:
numpy.ndarray
- property tl: numpy.ndarray
- Return type:
numpy.ndarray
- classmethod from_code(code)[source]
Create new symmetry operation using symmetry code “x’,y’,z’” containing transformation of each individual coordinate from x,y,z to x’,y’,z’.
- Parameters:
code (str) – string representing new coordinates after operation
- Returns:
Symmetry operation generated from given coordinate triplet code
- Return type:
- classmethod from_matrix(matrix)[source]
Create new symmetry operation using augmented 4x4 transformation matrix
- Parameters:
matrix (numpy.ndarray) – augmented 4x4 matrix
- Returns:
Symmetry operation generated based on augmented matrix
- Return type:
- classmethod from_pair(matrix, vector)[source]
Create new symmetry operation using point transformation 3x3 matrix and 3-length translation vector. Alias for standard creation method.
- Parameters:
matrix (numpy.ndarray) – 3x3 point transformation matrix
vector (numpy.ndarray) – 3-length translation vector
- Returns:
Symmetry operation generated based on matrix - vector pair
- Return type:
- static _row_to_str(xyz, r)[source]
Convert xyz: 3-el. list and r - number to single element of code triplet
- Parameters:
xyz (numpy.ndarray[int]) – 3-element list of coordinates, e.g.: [1,-1,0]
r (float) – translation applied to the row
- Returns:
string representing change of coordinate
- Return type:
str
- static _project(vector, onto)[source]
Return projection of np.ndarray “vector” to np.ndarray “onto”
- Parameters:
vector (numpy.ndarray)
onto (numpy.ndarray)
- Return type:
numpy.ndarray
- property code: str
- Return type:
str
- property matrix: numpy.ndarray
Augmented 4 x 4 transformation matrix with float-type values
- Return type:
numpy.ndarray
- property det: int
Determinant of 3x3 transformation part of operation’s matrix
- Return type:
int
- property name: str
‘m’, ‘3’ or ‘2_1’
- Type:
Short name of symmetry operation, e.g.
- Return type:
str
- property fold: int
Number of times operation must be repeated to become identity, inversion or translation: n for n-fold axes, 2 for reflections, 1 for other (max 6)
- Return type:
int
- property order: int
Number of times operation has to be repeated to become a translation, e.g.: n for all n-fold axes, 2 for other (max 6)
- Return type:
int
- property glide: numpy.ndarray
Part of the translation vector stemming from operations’ glide
- Return type:
numpy.ndarray
- property glide_fold: int
Number of types glide component of the operation must be repeated in order to contain only integer values, e.g.: 3 for “6_2”, 4 for “d”
- Return type:
int
- property origin: numpy.ndarray
Selected point that remains on the symmetry element after operation Loosely based on solving https://math.stackexchange.com/q/1054481/.
- Return type:
numpy.ndarray
- property reciprocal: PointOperation
Relevant symmetry operation in its respective reciprocal space
- Return type:
- property trace: int
Trace of 3x3 transformation part of operation’s matrix
- Return type:
int
- property translational: bool
True if operation has any glide component, False otherwise
- Return type:
bool
- property invariants: list[numpy.ndarray]
List of directions not affected by this symmetry operation
- Return type:
list[numpy.ndarray]
- property orientation: numpy.ndarray | None
Direction of symmetry element (if it can be defined) else None
- Return type:
Union[numpy.ndarray, None]
- property sense: str
“+” or “-”, the “sense” of rotation, as given in ITC A, 11.1.2
- Return type:
str
- property _hm_span
- property _hm_glide
- property hm_symbol: str
- Return type:
str
- property bounded: BoundedOperation
Instance of self that always collapses down to Coset representative
- Return type:
- property unbounded: Operation
Instance of self that can express translations beyond the unit cube
- Return type:
- property is_bounded: bool
True if self is a coset representatives i.e. 0 <= tl < 1 element-wise
- Return type:
bool
- at(point)[source]
Transform operation as little as possible so that its symmetry element contains “point”. To be used after “into” if used together. Based on “ITC 5.2.1. Transformations”.
- Parameters:
point (numpy.ndarray) – Target coordinates of point which should lie in element
- Returns:
New symmetry operation which contains “point” in its element
- Return type:
- into(direction, hexagonal=False)[source]
Rotate operation so that its orientation changes to “direction”, while preserving fractional glide. To be used before respective “at” method. Will most likely not work for unimplemented rhombohedral unit cells.
- Parameters:
direction (numpy.ndarray) – Target orientation for element of symmetry operation
hexagonal (bool) – True if operation is defined in hexagonal coordinates
- Returns:
New symmetry operation whose orientation is “direction”
- Return type:
- transform(other)[source]
Transform a column containing rows of coordinate points
- Parameters:
other (numpy.ndarray) – A vertical numpy array of coordinate triplets kept in rows
- Returns:
Same-shaped array of coordinate triplets transformed by self
- Return type:
numpy.ndarray
- class hikari.symmetry.operations.BoundedOperation(transformation, translation=np.array([0, 0, 0]))[source]
Bases:
OperationA subclass of Operation where all three elements of the translation vector are bounded between 0 (inclusive) and 1 (exclusive). This class is suitable for handling coset representatives of space groups, since upon binding operations related by unit translation become equivalent.
- property tl: numpy.ndarray
- Return type:
numpy.ndarray
- class hikari.symmetry.operations.PointOperation(transformation, translation=np.array([0, 0, 0]))[source]
Bases:
BoundedOperationA subclass of BoundedOperation, asserts translation vector = [0,0,0]
- property tl: numpy.ndarray
- Return type:
numpy.ndarray