Skip to content

Add `Permutation(Group).permute_index` and refactor group-matrix `@`

Vicentini Filippo requested to merge github/fork/attila-i-szabo/apply_group into master

Created by: attila-i-szabo

This PR adds the permute_index apply_to_id method to both Permutation and PermutationGroup. They take an array of integers as input and return what they are mapped to by the permutation (or all permutations along the 0th axis). This is useful for generating all symmetry-equivalent configurations of a set of sites. For example, you can get every square of a (PBC) square lattice as

graph = nk.graph.Square(6)
square = [0,1,7,6] # this is a square
squares = graph.translation_group().permute_index(square)

Incidentally, I also implemented the application of whole PermutationGroups and PointGroups to an Array more efficiently. Now, these are also added to the dispatch system around @. Everything works the same way as it used to, except now group @ array is valid and equivalent to group(array).

Merge request reports