pythmpg.pg_elements

Define crystallographic proper rotations and build their multiplication tables.

Provides tools to construct lists of proper rotations belonging to cubic and hexagonal crystallographic groups, and to construct their multiplication tables. Functions get_hex_table() and get_cub_table() are intended to be accessed from outside this module.

Notes

In the context of this module, all point group operations are proper rotations (determinant +1).

pythmpg.pg_elements.get_cub_rot_dict()[source]

Construct the rotation dictionary for cubic group 432.

Returns:

rot_dict – Dictionary mapping rotation names (str of 1 or 2 characters) to rotation matrices (numpy 3x3 float array).

Return type:

dict

pythmpg.pg_elements.get_cub_table(if_print=False)[source]

Build a dictionary of proper rotations for cubic group 432 and compute its multiplication table.

Parameters:

if_print (bool, optional) – If True, print the rotation list and multiplication table to stdout. Default is False.

Returns:

  • rot_dict (dict) – Dictionary mapping rotation names (str) to rotation matrices (numpy 3x3 float array).

  • table_dict (dict) – Dictionary embodying the multiplication table; keys are tuples of two rotation names and values are the resulting rotation name.

pythmpg.pg_elements.get_hex_rot_dict()[source]

Construct the rotation dictionary for hexagonal group 622.

Returns:

rot_dict – Dictionary mapping rotation names (str of 1 or 2 characters) to rotation matrices (numpy 3x3 float array).

Return type:

dict

pythmpg.pg_elements.get_hex_table(if_print=False)[source]

Build a dictionary of proper rotations for hexagonal group 622 and compute its multiplication table.

Parameters:

if_print (bool, optional) – If True, print the rotation list and multiplication table to stdout. Default is False.

Returns:

  • rot_dict (dict) – Dictionary mapping rotation names (str) to rotation matrices (numpy 3x3 float array).

  • table_dict (dict) – Dictionary embodying the multiplication table; keys are tuples of two rotation names and values are the resulting rotation name.

pythmpg.pg_elements.get_mult_table(rot_dict)[source]

Compute the multiplication table for a set of rotation matrices.

Parameters:

rot_dict (dict) – Dictionary mapping rotation names (str) to 3x3 rotation matrices (numpy float arrays).

Returns:

table_dict – Dictionary embodying the multiplication table. Keys are 2-tuples of rotation names (rot1, rot2) and values are the name of the rotation equal to the matrix product mat1 @ mat2.

Return type:

dict

Raises:

ValueError – If the product of any two rotations has no match in rot_dict (group not closed) or more than one match (internal inconsistency).

pythmpg.pg_elements.print_dict(name, rot_dict, table_dict)[source]

Print the rotation dictionary and multiplication table.

Parameters:
  • name (str) – Label printed as a header above the output.

  • rot_dict (dict) – Dictionary mapping rotation names (str) to rotation matrices (numpy 3x3 float array).

  • table_dict (dict) – Multiplication table dictionary as returned by get_mult_table().

pythmpg.pg_elements.rot_mat(axis, m, n)[source]

Construct a rotation matrix using the Rodrigues formula.

Parameters:
  • axis (array-like of length 3) – Rotation axis vector; need not be normalized.

  • m (int) – Numerator of the rotation angle fraction.

  • n (int) – Denominator of the rotation angle fraction; the rotation angle is 2 * pi * m / n.

Returns:

rot – Rotation matrix corresponding to the specified axis and angle.

Return type:

numpy.ndarray, shape (3, 3)