space_group_transforms
#
- biotite.structure.space_group_transforms(space_group)[source]#
Get the coordinate transformations for a given space group.
Applying each transformation to a structure (in fractional coordinates) reproduces the entire unit cell.
- Parameters:
- space_groupstr or int
The space group name (full Hermann-Mauguin symbol) or International Table’s number.
- Returns:
- transformationslist of AffineTransformation
The transformations that creates the symmetric copies of a structure in a unit cell of the given space group. Note that the transformations need to be applied to coordinates in fractions of the unit cell and also return fractional coordinates, when applied.
See also
coord_to_fraction
Used to convert to fractional coordinates.
fraction_to_coord
Used to convert back to Cartesian coordinates.
Examples
>>> transforms = space_group_transforms("P 21 21 21") >>> for transform in transforms: ... print(transform.rotation) ... print(transform.target_translation) ... print() [[[1. 0. 0.] [0. 1. 0.] [0. 0. 1.]]] [[0. 0. 0.]] [[[-1. 0. 0.] [ 0. -1. 0.] [ 0. 0. 1.]]] [[0.5 0.0 0.5]] [[[-1. 0. 0.] [ 0. 1. 0.] [ 0. 0. -1.]]] [[0.0 0.5 0.5]] [[[ 1. 0. 0.] [ 0. -1. 0.] [ 0. 0. -1.]]] [[0.5 0.5 0.0]]
Reproduce the unit cell for some coordinates (in this case only one atom).
>>> asym_coord = np.array([[1.0, 2.0, 3.0]]) >>> box = np.eye(3) * 10 >>> transforms = space_group_transforms("P 21 21 21") >>> # Apply the transformations to fractional coordinates of the asymmetric unit >>> unit_cell = np.concatenate( ... [ ... fraction_to_coord(transform.apply(coord_to_fraction(asym_coord, box)), box) ... for transform in transforms ... ] ... ) >>> print(unit_cell) [[ 1. 2. 3.] [ 4. -2. 8.] [-1. 7. 2.] [ 6. 3. -3.]]