bsym.symmetry_group
- class bsym.symmetry_group.SymmetryGroup(symmetry_operations: list[SymmetryOperation] | None = None)[source]
Bases:
objectSymmetryGroupclass.A
SymmetryGroupobject contains a set ofSymmetryOperationobjects.e.g.:
SymmetryGroup( symmetry_operations=[s1, s2, s3])
where s1, s2, and s3 are
SymmetryOperationobjects.SymmetryGroupobjects 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
SymmetryOperationto thisSymmetryGroup.- Parameters:
symmetry_operation (
SymmetryOperation) – TheSymmetryOperationto add.- Returns:
self (
SymmetryGroup)
- by_label(label: str) SymmetryOperation | None[source]
Returns the
SymmetryOperationwith a matching label.- Parameters:
label (str) – The label identifying the chosen symmetry operation.
- Returns:
The symmetry operation that matches this label.
- Return type:
- 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
SymmetryOperationobjects.- Returns:
self (
SymmetryGroup)
- property labels: list[str | None]
A list of labels for each
SymmetryOperationin 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
SymmetryGroupobject 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
SymmetryGroupobject 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:
- save_symmetry_operation_vectors_to(filename: str) None[source]
Save the set of vectors describing each symmetry operation in this
SymmetryGroupto 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