Ejemplo n.º 1
0
def plot_permutation_groups(base_structure, output_name):
    rotations, translations = get_symmetry_operations(base_structure)
    displacement_set = base_structure.frac_coords

    list_data = []
    for index in range(2, 10 + 1):
        for hnf in tqdm(generate_all_superlattices(index)):
            dsperm = DerivativeStructurePermutation(hnf, displacement_set,
                                                    rotations, translations)
            perms = [
                Permutation(g)
                for g in dsperm.get_symmetry_operation_permutations()
            ]
            gens = get_generators(perms)
            G = PermutationGroup(gens)
            data = {
                "index": index,
                "hnf": hnf,
                "generators": gens,
                "group": G,
                "order": G.order(),
                "orbits": G.orbits(),
            }
            list_data.append(data)

    df = pd.DataFrame(list_data)
    sns.swarmplot(x="index", y="order", data=df)
    plt.title(output_name)
    plt.savefig(output_name + ".png")
    return df
Ejemplo n.º 2
0
def test_number_of_snf():
    # confirm table-3
    num_hnf_expected = [
        1, 7, 13, 35, 31, 91, 57, 155, 130, 217, 133, 455, 183, 399, 403, 651
    ]
    num_snf_expected = [1, 1, 1, 2, 1, 1, 1, 3, 2, 1, 1, 2, 1, 1, 1, 4]
    max_index = len(num_hnf_expected)

    for index, hnf_expected, snf_expected in zip(range(1, max_index + 1),
                                                 num_hnf_expected,
                                                 num_snf_expected):
        list_HNF = generate_all_superlattices(index)
        assert len(list_HNF) == hnf_expected

        list_SNF = set()
        for hnf in list_HNF:
            snf, _, _ = smith_normal_form(hnf)
            dag = tuple(snf.diagonal())
            list_SNF.add(dag)

        assert len(list_SNF) == snf_expected
Ejemplo n.º 3
0
def test_generate_all_superlattices():
    # https://oeis.org/A001001
    num_expected = [
        1,
        7,
        13,
        35,
        31,
        91,
        57,
        155,
        130,
        217,
        133,
        455,
        183,
        399,
        403,
        651,
        307,
        910,
        381,
        1085,
        741,
        931,
        553,
        2015,
        806,
        1281,
        1210,
        1995,
        871,
        2821,
        993,
        2667,
        1729,
        2149,
        1767,
        4550,
        1407,
        2667,
        2379,
        4805,
        1723,
        5187,
        1893,
        4655,
        4030,
        3871,
        2257,
        8463,
        2850,
        5642,
        3991,
        6405,
        2863,
    ]
    max_index = len(num_expected)

    for index, expected in zip(range(1, max_index + 1), num_expected):
        list_HNF = generate_all_superlattices(index)
        assert len(list_HNF) == expected