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
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
with respect to the Bieberbach subgroup
, 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
can be written as a direct product of
and
.
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
where
and 
- cosets – The general positions (i.e. actions on
). - size – The size of the group.
- 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
-
class
group_modules.SpaceGroup(num, lin_rep, cosets=None, matrix=None)¶ A class to represent a space group (
) by both a linear representation of
and the general positions (i.e. the actions on
).Variables: - num – The ITA number of the space group.
- lin_rep – A
LinRepobject representing a fundamental domain of
. - matrix – The affine transformation matrix used to conjugate the space group.
-
size()¶ Returns the size of a fundamental domain of

-
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
SpaceGroupobject representing the subgroup. - supergroup – A
SpaceGroupobject 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.
- subgroup – A
Functions¶
-
group_modules.get_space_group(gnum, matrix=None)¶ Returns a
SpaceGroupobject given the ITA number and transformation matrix that relates the group and subgroup (
) basis.Parameters: - gnum – The group ITA number.
- matrix – The transformation matrix.
-
group_modules.get_space_subgroups(supergroup, subgroup, index=None)¶ Returns a list of
SpaceGroupPairobjects 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:
-
group_modules.load_group_from_file(filename)¶ Returns a
LinRepobject 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
LinRepobjects 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
LinRepobjects 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
SpaceGroupobjects for all the Bieberbach space groups in their standard settings.
-
group_modules.get_all_sym_groups()¶ Returns a list of
SpaceGroupobjects 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.