bsym.symmetry_operation

class bsym.symmetry_operation.SymmetryOperation(matrix: ndarray | list[list[int]], label: str | None = None)[source]

Bases: object

SymmetryOperation class.

as_vector(count_from_zero: bool = False) list[int][source]

Return a vector representation of this symmetry operation

Parameters:

count_from_zero – Set to True if the vector representation counts from zero

Returns:

A vector representation of this symmetry operation (as a list)

character() int[source]

Return the character of this symmetry operation (the trace of self.matrix).

Parameters:

None

Returns:

The trace of self.matrix

classmethod from_vector(vector: list[int], count_from_zero: bool = False, label: str | None = None) SymmetryOperation[source]

Initialise a SymmetryOperation object from a vector of site mappings.

Parameters:
  • vector – Vector of integers defining a symmetry operation mapping.

  • count_from_zero – Set to True if the site index counts from zero.

  • label – Optional string label for this SymmetryOperation object.

Returns:

A new SymmetryOperation object

invert(label: str | None = None) SymmetryOperation[source]

Invert this SymmetryOperation object.

Parameters:

label – Optional label for the inverted symmetry operation.

Returns:

A new SymmetryOperation object corresponding to the inverse matrix operation.

operate_on(configuration: Configuration) Configuration[source]

Return the Configuration generated by applying this symmetry operation

Parameters:

configuration – The configuration / occupation vector to operate on

Returns:

The new configuration obtained by operating on configuration with this symmetry operation.

pprint() None[source]

Pretty print for this symmetry operation

Parameters:

None

Returns:

None

set_label(label: str) SymmetryOperation[source]

Set the label for this symmetry operation.

Parameters:

label – Label to set for this symmetry operation

Returns:

self

similarity_transform(s: SymmetryOperation, label: str | None = None) SymmetryOperation[source]

Generate the SymmetryOperation produced by a similarity transform S^{-1}.M.S

Parameters:
  • s – The symmetry operation or matrix S.

  • label – The label to assign to the new SymmetryOperation.

Returns:

The SymmetryOperation produced by the similarity transform

bsym.symmetry_operation.is_permutation_matrix(m: ndarray) bool[source]

Test whether a numpy array is a `permutation matrix`_.

Parameters:

m – The matrix.

Returns:

True if matrix is a permutation matrix, False otherwise.

bsym.symmetry_operation.is_square(m: ndarray) bool[source]

Test whether a numpy matrix is square.

Parameters:

m – The matrix.

Returns:

True if matrix is square, False otherwise.