Пример #1
0
    def __init__(self, n):
        self._sym_n = SymmetricGroup(n)
        self._elements = self._sym_n._elements
        self._permutation_group = PermutationGroup(self._sym_n._elements)
        self._path_serialization = os.path.join(
            os.path.dirname(__file__),
            'symmetric_groups/sym_{0}.json'.format(n))
        self._subgroups = self.subgroups()
        self._trivial_group = PermutationGroup(
            Permutation([i for i in range(0, n)]))

        with open(self._path_serialization, 'w') as write_file:
            json.dump(self._subgroups, write_file)
Пример #2
0
def conjugate_subgroup(g, subgroup):
    elements_conjugated = []

    for h in subgroup._elements:
        elements_conjugated.append(g * h * inv(g))

    return PermutationGroup(elements_conjugated)
Пример #3
0
 def __init__(self,
              name,
              permgroupgens, # permutation group generators
              irrepgens_dict, # dictionary with irrep generators,
              svwf_rep_gen_func, # function that generates a tuple with svwf representation generators
              rep3d_gens = None, # 3d (quaternion) representation generators of a point group: sequence of qpms.irep3 instances
             ):
     self.name = name
     self.permgroupgens = permgroupgens
     self.permgroup = PermutationGroup(*permgroupgens)
     self.irrepgens_dict = irrepgens_dict
     self.svwf_rep_gen_func = svwf_rep_gen_func
     self.irreps = dict()
     for irrepname, irrepgens in irrepgens_dict.items():
         is1d = isinstance(irrepgens[0], (int,float,complex))
         irrepdim = 1 if is1d else irrepgens[0].shape[0]
         self.irreps[irrepname] = generate_grouprep(self.permgroup, 
                                                    1 if is1d else np.eye(irrepdim),
                                                    permgroupgens, irrepgens,
                                                    immultop = None if is1d else np.dot,
                                                    imcmp = None if is1d else np.allclose
                                                   )
     self.rep3d_gens = rep3d_gens
     self.rep3d = None if rep3d_gens is None else generate_grouprep(
             self.permgroup,
             IRot3(),
             permgroupgens, rep3d_gens,
             immultop = None, imcmp = (lambda x, y: x.isclose(y))
             )
Пример #4
0
    def _to_perm_group(self):
        '''
        Return an isomorphic permutation group and the isomorphism.
        The implementation is dependent on coset enumeration so
        will only terminate for finite groups.

        '''
        from sympy.combinatorics import Permutation, PermutationGroup
        from sympy.combinatorics.homomorphisms import homomorphism
        from sympy import S
        if self.order() == S.Infinity:
            raise NotImplementedError("Permutation presentation of infinite "
                                      "groups is not implemented")
        if self._perm_isomorphism:
            T = self._perm_isomorphism
            P = T.image()
        else:
            C = self.coset_table([])
            gens = self.generators
            images = [[C[i][2 * gens.index(g)] for i in range(len(C))]
                      for g in gens]
            images = [Permutation(i) for i in images]
            P = PermutationGroup(images)
            T = homomorphism(self, P, gens, images, check=False)
            self._perm_isomorphism = T
        return P, T
Пример #5
0
    def __init__(self, group, space=None):
        """
        Create a new GroupAction
        :param group: `group` is either a SymPy Permutation, a list of SymPy
            Permutations, or a SymPy PermutationGroup.
        :param space: `space` is a set {0,1,2,...,n-1} that specifies the
            set to be acted upon.
        """

        self.group = None
        if isinstance(group, PermutationGroup):
            self.group = group
        elif isinstance(group, Permutation):
            self.group = PermutationGroup([group])
        elif isinstance(group, list):
            if len(group) > 0:
                self.group = PermutationGroup(group)
            else:
                self.group = PermutationGroup()
Пример #6
0
def symbolic_symmetry_group(
        permutation_indices: List[Tuple[int, ...]]) -> PermutationGroup:
    generators = []

    for indices in permutation_indices:
        if len(indices) > 1:
            generators.extend(starmap(Permutation, combinations(indices, 2)))
        else:
            generators.append(Permutation(indices[0]))

    return PermutationGroup(*generators)
Пример #7
0
 def group_Klein4(self):
     return PermutationGroup(
         [Permutation([1, 0, 2, 3]),
          Permutation([0, 1, 3, 2])])
Пример #8
0
 def group_Z4(self):
     return PermutationGroup([Permutation([3, 0, 1, 2])])
Пример #9
0
 def group_Klein4_N(self):
     return PermutationGroup([
         Permutation([1, 0, 3, 2]),
         Permutation([2, 3, 0, 1]),
         Permutation([3, 2, 1, 0])
     ])
Пример #10
0
 def group_S3_twisted(self):
     return PermutationGroup([Permutation([2, 0, 1, 3, 4]), Permutation([1, 0, 2, 4, 3])])
Пример #11
0
 def group_Dbl_Trans(self):
     return PermutationGroup([Permutation([1, 0, 3, 2])])
Пример #12
0
 def group_A4(self):
     return PermutationGroup(
         [Permutation([2, 0, 1, 3]),
          Permutation([1, 0, 3, 2])])
Пример #13
0
 def group_pair_disj_trans(self):
     return PermutationGroup([Permutation([1, 0, 2, 3, 4]), Permutation([0, 1, 3, 2, 4]), Permutation([1, 0, 3, 2, 4])])
Пример #14
0
 def group_A5(self):
     return PermutationGroup([Permutation([4, 0, 1, 2, 3]), Permutation([2, 0, 1, 3, 4])])
Пример #15
0
 def group_Z3(self):
     return PermutationGroup([Permutation([2, 0, 1, 3, 4]), Permutation([1, 2, 0, 3, 4])])
Пример #16
0
 def group_D10(self):
     return PermutationGroup([Permutation([4, 0, 1, 2, 3]), Permutation([0, 4, 3, 2, 1])])
Пример #17
0
 def group_GA1_5(self):
     return PermutationGroup([Permutation([4, 0, 1, 2, 3]), Permutation([0, 3, 1, 4, 2])])
Пример #18
0
 def group_Z5(self):
     return PermutationGroup([Permutation([4, 0, 1, 2, 3])])
Пример #19
0
 def group_S4(self):
     return PermutationGroup([Permutation([3, 0, 1, 2, 4]), Permutation([1, 0, 2, 3, 4])])
Пример #20
0
 def group_S3_prod_S2(self):
     return PermutationGroup([Permutation([2, 0, 1, 3, 4]), Permutation([1, 0, 2, 3, 4]), Permutation([0, 1, 2, 4, 3])])
Пример #21
0
 def group_D8(self):
     return PermutationGroup(
         [Permutation([3, 0, 1, 2]),
          Permutation([2, 1, 0, 3])])
Пример #22
0
def explicit_symbolic_symmetry_group(
        permutation_indices: List[Tuple[int, ...]]) -> PermutationGroup:
    generators = starmap(Permutation, permutation_indices)
    return PermutationGroup(*generators)
Пример #23
0
 def group_S3(self):
     return PermutationGroup(
         [Permutation([2, 0, 1, 3]),
          Permutation([1, 0, 2, 3])])
Пример #24
0
 def group_Trivial(self):
     return PermutationGroup([Permutation([0, 1, 2, 3])])
Пример #25
0
 def group_dbl_trans_four(self):
     return PermutationGroup([Permutation([1, 0, 3, 2, 4]), Permutation([2, 3, 0, 1, 4]), Permutation([3, 2, 1, 0, 4])])
Пример #26
0
 def group_S2(self):
     return PermutationGroup([Permutation([1, 0, 2, 3])])
Пример #27
0
            theprojector[np.isclose(theprojector,x)] = x
        projectors[repi] = theprojector
    if do_bases:
        return projectors, bases
    else:
        return projectors


# Group D3h; mostly legacy code (kept because of the the honeycomb lattice K-point code, whose generalised version not yet implemented)
# Note that the size argument of permutations is necessary, otherwise e.g. c*c and  b*b would not be evaluated equal
# N.B. the weird elements as Permutation(N) – it means identity permutation of size N+1.
rot3_perm = Permutation(0,1,2, size=5) # C3 rotation
xflip_perm = Permutation(0,2, size=5) # vertical mirror
zflip_perm = Permutation(3,4, size=5) # horizontal mirror
D3h_srcgens = [rot3_perm,xflip_perm,zflip_perm]
D3h_permgroup = PermutationGroup(*D3h_srcgens) # D3h

D3h_irreps = {
    # Bradley, Cracknell p. 61
    "E'" : generate_grouprep(D3h_permgroup, epsilon, D3h_srcgens, [alif, lam, epsilon], immultop = np.dot, imcmp = np.allclose),
    "E''" : generate_grouprep(D3h_permgroup, epsilon, D3h_srcgens, [alif, lam, -epsilon], immultop = np.dot, imcmp = np.allclose),
    # Bradley, Cracknell p. 59, or Dresselhaus, Table A.14 (p. 482)
    "A1'" : generate_grouprep(D3h_permgroup, 1, D3h_srcgens, [1,1,1]),
    "A2'" : generate_grouprep(D3h_permgroup, 1, D3h_srcgens, [1,-1,1]),
    "A1''" : generate_grouprep(D3h_permgroup, 1, D3h_srcgens, [1,-1,-1]),
    "A2''" : generate_grouprep(D3h_permgroup, 1, D3h_srcgens, [1,1,-1]),
}

#TODO lepší název fce; legacy, use group_info['D3h'].generate_grouprep() instead
def gen_point_D3h_svwf_rep(lMax, vflip = 'x'):
    '''
Пример #28
0
 def group_Z6(self):
     return PermutationGroup([Permutation([2, 0, 1, 3, 4]), Permutation([0, 1, 2, 4, 3])])