bsym.symmetry_group

class bsym.symmetry_group.SymmetryGroup(symmetry_operations: list[SymmetryOperation] | None = None)[source]

Bases: object

SymmetryGroup class.

A SymmetryGroup object contains a set of SymmetryOperation objects.

e.g.:

SymmetryGroup( symmetry_operations=[s1, s2, s3])

where s1, s2, and s3 are SymmetryOperation objects.

SymmetryGroup objects can also be created from files using the class methods:

SymmetryGroup.read_from_file(filename)

and:

SymmetryGroup.read_from_file_with_labels(filename)
append(symmetry_operation: SymmetryOperation) SymmetryGroup[source]

Append a SymmetryOperation to this SymmetryGroup.

Parameters:

symmetry_operation (SymmetryOperation) – The SymmetryOperation to add.

Returns:

self (SymmetryGroup)

by_label(label: str) SymmetryOperation | None[source]

Returns the SymmetryOperation with a matching label.

Parameters:

label (str) – The label identifying the chosen symmetry operation.

Returns:

The symmetry operation that matches this label.

Return type:

(SymmetryOperation)

class_str = 'SymmetryGroup'
extend(symmetry_operations_list: list[SymmetryOperation]) SymmetryGroup[source]

Extend the list of symmetry operations in this SymmetryGroup.

Parameters:

symmetry_operations_list (list) – A list of SymmetryOperation objects.

Returns:

self (SymmetryGroup)

property labels: list[str | None]

A list of labels for each SymmetryOperation in this spacegroup.

Returns:

A list of label strings.

operate_on(configuration: Configuration, minimal_set: bool = False) list[Configuration][source]

Returns a list of Configurations generated by applying every symmetry operation in this symmetry group.

Parameters:
  • configuration – (Configuration): The configuration / occupation vector to operate on.

  • minimal_set – (bool, optional): Specifies whether to return the minimal set of resulting Configurations. Default is False.

Returns:

list(Configuration)

classmethod read_from_file(filename)[source]

Create a SymmetryGroup object from a file.

The file format should be a series of numerical mappings representing each symmetry operation.

e.g. for a pair of equivalent sites:

# example input file to define the spacegroup for a pair of equivalent sites
1 2
2 1
Parameters:

filename (str) – Name of the file to be read in.

Returns:

spacegroup (SymmetryGroup)

classmethod read_from_file_with_labels(filename: str) SymmetryGroup[source]

Create a SymmetryGroup object from a file, with labelled symmetry operations.

The file format should be a series of numerical mappings representing each symmetry operation, prepended with a string that will be used as a label.

e.g. for a pair of equivalent sites:

# example input file to define the spacegroup for a pair of equivalent sites
E  1 2
C2 2 1
Parameters:

filename (str) – Name of the file to be read in.

Returns:

The symmetry group read from the file.

Return type:

SymmetryGroup

save_symmetry_operation_vectors_to(filename: str) None[source]

Save the set of vectors describing each symmetry operation in this SymmetryGroup to a file.

Parameters:

filename (str) – Name of the file to save to.

Returns:

None

property size: int
property stacked_index_mappings: ndarray[tuple[int, ...], dtype[int64]]

Stack all index mappings from symmetry operations.

Returns:

Array of shape (n_operations, n_sites) containing all index mappings.

Return type:

np.ndarray

property unique_index_mappings: ndarray[tuple[int, ...], dtype[int64]]

Get unique index mappings, removing duplicates.

Returns:

Array of shape (n_unique, n_sites) containing only unique index mappings.

Return type:

np.ndarray