def generate_symmetry_distinct_superlattices( index: int, structure: Structure, return_symops=False ): """ generate symmetry distict HNF Parameters ---------- index: positive integer structure: pymatgen.core.Structure return_symops: bool Returns ------- list_reduced_HNF: list of matrices, unique by symmetry (Optional) rotations: array, (# of symmetry operations, 3, 3) (Optional) translations: array, (# of symmetry operations, 3) """ rotations, translations = get_symmetry_operations(structure) list_HNF = generate_all_superlattices(index) list_reduced_HNF = reduce_HNF_list_by_parent_lattice_symmetry(list_HNF, rotations) if return_symops: return list_reduced_HNF, rotations, translations else: return list_reduced_HNF
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
def remove_symmetry_duplicates_from_generator( base_structure, hnf, num_type, list_colorings, color_exchange: bool, leave_superperiodic: bool, use_all_colors: bool, method="direct", n_jobs=1, ): displacement_set = base_structure.frac_coords rotations, translations = get_symmetry_operations(base_structure) cl_generator = ListBasedColoringGenerator(num_type, list_colorings) ds_permutation = DerivativeStructurePermutation(hnf, displacement_set, rotations, translations) sc_enum = SiteColoringEnumerator( num_type, ds_permutation, cl_generator, color_exchange, leave_superperiodic, use_all_colors, method=method, n_jobs=n_jobs, ) colorings = sc_enum.unique_colorings() return colorings
def from_structure(cls, structure: Structure, transformation: np.ndarray, symprec: float = 1e-2): """ create EquivalentPointClusterGenerator from pymatgen.core.Structure Parameters ---------- structure: pymatgen.core.Structure, base structure transformation: transformation matrix of sublattice symprec: float """ frac_coords = structure.frac_coords rotations, translations = get_symmetry_operations(structure, symprec) converter = DerivativeMultiLatticeHash(transformation, frac_coords) return cls( frac_coords=frac_coords, rotations=rotations, translations=translations, converter=converter, )