ccu.structure.symmetry¶
Symmetry-related functions and classes.
This class defines the Transformation class and useful subclasses
(Rotation,
Translation,
Reflection, and
Inversion)
Example
>>> from ase import Atoms
>>> from ccu.structure.symmetry import check_symmetry, Rotation
>>> rotation1 = Rotation(90, [0, 0, 1])
>>> co = Atoms("CO", positions=[[0, 0, 0], [1, 0, 0]])
>>> rotated = rotation1(co)
>>> rotated.positions
array([[0.000000e+00, 0.000000e+00, 0.000000e+00],
[6.123234e-17, 1.000000e+00, 0.000000e+00]])
>>> check_symmetry(rotation1, co)
False
>>> h2 = Atoms("HH", positions=[[0, 0, 0], [1, 0, 0]])
>>> rotation2 = Rotation(180, [0, 0, 1])
>>> check_symmetry(rotation2, h2)
True
- class ccu.structure.symmetry.Inversion(point: Iterable[float] | None = None)[source]¶
Bases:
TransformationAn inversion operation.
This
Transformationrepresents the inverson of coordinates through a point.- Variables:
point – A length 3, 1D
ndarraythat represents the inversion point.
Instantiate an
Inversion.- Parameters:
point – A length 3 iterable of floats that represents the inversion point.
- _abc_impl = <_abc._abc_data object>¶
- _is_protocol = False¶
- class ccu.structure.symmetry.Reflection(point: Iterable[float] | None = None, norm: Iterable[float] | None = None)[source]¶
Bases:
TransformationA reflection operation.
This
Transformationrepresents the reflection of coordinates through a plane.- Variables:
Create a reflection operation.
- Parameters:
point – A length 3 iterable of floats that represents a point on the reflection plane. Defaults to the origin.
norm – A length 3 iterable of floats that represents a vector normal to the reflection plane. Defaults to the positive z-axis.
- _abc_impl = <_abc._abc_data object>¶
- _is_protocol = False¶
- class ccu.structure.symmetry.Rotation(angle: float = 0.0, axis: Iterable[float] | None = None)[source]¶
Bases:
TransformationA rotation operation.
- Variables:
angle – A float specifying a rotation angle in degrees.
axis – A
numpy.ndarrayrepresenting the axis of rotation.
Create a rotation operation.
- Parameters:
angle – The angle of rotation. Defaults to 0.0.
axis – The axis of rotation. Defaults to the positive z-axis.
- _abc_impl = <_abc._abc_data object>¶
- _is_protocol = False¶
- class ccu.structure.symmetry.Transformation(*args, **kwargs)[source]¶
Bases:
ProtocolA protocol for structural transformations.
In general, implementers of this protocol should preserve the
infodictionary ofAtomsobjects; however, if changes are made to the chemical composition, metadata should be updated as well.- _abc_impl = <_abc._abc_data object>¶
- _is_protocol = True¶
- class ccu.structure.symmetry.Translation(direction: Iterable[float] | None = None)[source]¶
Bases:
TransformationA reflection operation.
This
Transformationrepresents the reflection of coordinates through a plane.- Variables:
direction – A length 3, 1D
ndarraythat represents a translation.
Create a reflection operation.
- Parameters:
direction – A length 3, 1D
ndarraythat represents a translation. Defaults to the zero vector.
- _abc_impl = <_abc._abc_data object>¶
- _is_protocol = False¶
- ccu.structure.symmetry.check_symmetry(transform: Transformation, structure: Atoms, tol: float = 0.05) bool[source]¶
Check if a structure is symmetric with respect to a transformation.
- Parameters:
transform – The
Transformationwith respect to whichstructurewill be checked for symmetry.structure – An
Atomsobject.tol – A float specifying the absolute tolerance for positions. Defaults to 5e-2.
- Returns:
A bool indicating whether or not the given structure possesses the symmetry with respect to the given
Transformationsubject to the specified tolerance.