Welcome to Sgt-Py’s documentation!

Sgt-Py is a python package for performing group theoretic calculations with crystallographic space groups. It provides an interface with several functions from the Bilbao Crystallographic Server.


Example usage:

Print the general positions of a space group

Print the general positions of space group P2_{1}2_{1}2_{1} in the standard setting:

>>> import group_modules as gm
>>> group_19 = gm.get_space_group(19)
>>> print(group_19.lin_rep)
x y z
-x+1/2 -y z+1/2
-x y+1/2 -z+1/2
x+1/2 -y+1/2 -z

Decomposing a space group into a product of subgroups

To find a decomposition of the space group P222_1 with respect to the Bieberbach subgroup P2_1, start by finding a SpaceGroupPair object relating the two space groups:

>>> import group_modules as gm
>>> group_pairs = gm.get_space_subgroups(17,4)
>>> pair1 = group_pairs[0]
>>> supergroup = pair1.supergroup
>>> subgroup = pair1.subgroup

Find a complementary symmorphic subgroup of the right size:

>>> complements = gm.get_sym_complements(17, 4, supergroup.matrix, subgroup.size())
>>> complement = complements[0]

Check if the product of the two subgroups recovers the full group:

>>> product = subgroup.lin_rep * complement
>>> print(product == supergroup.lin_rep)
True

Determine the type of product:

>>> print(gm.is_normal(subgroup.lin_rep, supergroup.lin_rep))
True
>>> print(gm.is_normal(complement, supergroup.lin_rep))
True

Identify the space group and transformation matrix that yields the complement group:

>>> num, matrix = gm.identify_group(complement.cosets)
>>> print(num)
'3'

From this you can conclude that P222_1 can be written as a direct product of P2_1 and P2.


Classes

class group_modules.LinRep(lin_rep, cosets=None)

A class to represent a linear representation of a group.

Variables:
  • lin_rep – An n-element finite matrix group is represented as an numpy.ndarray with shape (4,4,n). Each group element is represented as a 4x4 homogenous matrix of the form {\cal H}(A, {\bf a}) = \left(\begin{array}{ccc}
A && {\bf a} \\ \                {\bf 0}^t && 1 \end{array}\right) where A \in GL(3, \mathbb{R}) and {\bf a} \in \mathbb{R}^3.
  • cosets – The general positions (i.e. actions on \mathbb{R}^3).
  • size – The size of the group.
class group_modules.SpaceGroup(num, lin_rep, cosets=None, matrix=None)

A class to represent a space group (\Gamma) by both a linear representation of \frac{\Gamma}{P1} and the general positions (i.e. the actions on \mathbb{R}^3).

Variables:
  • num – The ITA number of the space group.
  • lin_rep – A LinRep object representing a fundamental domain of \frac{\Gamma}{P1}.
  • matrix – The affine transformation matrix used to conjugate the space group.
size()

Returns the size of a fundamental domain of \frac{\Gamma}{P1}

write_to_file(filename)

Writes the general positions to a specified file.

Parameters:filename – A string containing the file name.
class group_modules.SpaceGroupPair(subgroup, supergroup, matrix, index)

A class to store a supgergroup-subgroup pair of space groups.

Variables:
  • subgroup – A SpaceGroup object representing the subgroup.
  • supergroup – A SpaceGroup object representing the supergroup.
  • matrix – The affine transformation that conjugates the supergroup to contain the subgroup.
  • index – The index of the subgroup in the supergroup.
is_normal()

Returns True if the subgroup is normal in the supergroup and False otherwise.


Functions

group_modules.get_space_group(gnum, matrix=None)

Returns a SpaceGroup object given the ITA number and transformation matrix that relates the group and subgroup (P1) basis.

Parameters:
  • gnum – The group ITA number.
  • matrix – The transformation matrix.
group_modules.get_space_subgroups(supergroup, subgroup, index=None)

Returns a list of SpaceGroupPair objects given a space group ITA number and a space subgroup ITA number for a given index or for all possible indices if no index is provided (stopping right before the index of the lattice translation group in the supergroup).

Parameters:
  • supergroup – The supergroup ITA number.
  • subgroup – The subgroup ITA number.
  • index – The index of the subgroup in the supergroup.
group_modules.is_normal(sub, sup)

Returns True if the subgroup is normal in the supergroup and False otherwise.

Parameters:
  • sub – A LinRep object representing the subgroup.
  • sup – A LinRep object representing the supergroup.
group_modules.load_group_from_file(filename)

Returns a LinRep object from a file of coset representatives.

Parameters:filename – A string containing the filename.
group_modules.get_bieb_complements(gnum, snum, mat, ssize)

Returns a list of LinRep objects representing all the complementary Bieberbach groups (with size equal to the order of the supergroup divided by the order of the subgroup) that can be constructed from the coset decomposition of the supergroup with respect to the subgroup.

Parameters:
  • gnum – The ITA number of the space group.
  • snum – The ITA number of the subgroup.
  • mat – The matrix relating the subgroup and supergroup.
  • ssize – The size of the subgroup.
group_modules.get_sym_complements(gnum, bnum, mat, bsize)

Returns a list of LinRep objects representing all the complementary symmorphic groups (with size equal to the order of the supergroup divided by the order of the subgroup) that can be constructed from the coset decomposition of the supergroup with respect to the subgroup.

Parameters:
  • gnum – The ITA number of the space group.
  • bnum – The ITA number of the Bieberbach subgroup.
  • mat – The matrix relating the subgroup and supergroup.
  • bsize – The size of the subgroup.
group_modules.get_all_bieb_groups()

Returns a list of SpaceGroup objects for all the Bieberbach space groups in their standard settings.

group_modules.get_all_sym_groups()

Returns a list of SpaceGroup objects for all the symmorphic space groups in their standard settings.

group_modules.identify_group(generators)

Identifies the minimal space group generated by a set of generators and returns the ITA number and the transformation matrix.

Parameters:generators – A string containing a set of generators.