How to use the spglib.get_pointgroup function in spglib

To help you get started, we’ve selected a few spglib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SUNCAT-Center / CatKit / catkit / gen / utils.py View on Github external
def get_point_group(atoms, tol=1e-8):
    """Return the point group operations of a systems."""
    rotations, translations = get_symmetry(atoms, tol=tol)
    point_group = spglib.get_pointgroup(rotations)[0].strip()

    laue = ['-1', '2/m', 'mmm', '4/m', '4/mmm',
            '-3', '-3m', '6/m', '6/mmm', 'm-3', 'm-3m']

    is_laue = point_group in laue

    return point_group, is_laue
github abinit / abipy / abipy / core / site_symmetries.py View on Github external
#other_indsym = indsym_from_symrel(abispg.symrel, abispg.tnons, self.structure, tolsym=1e-8)
        #assert np.all(self.structure.indsym == other_indsym)

        # Compute symmetry operations in Cartesian coordinates (numpy arrays)
        a = self.structure.lattice.matrix.T
        self.symcart = np.matmul(a, np.matmul(abispg.symrel, np.linalg.inv(a)))

        import spglib
        self.sitesym_labels = []
        for iatom, site in enumerate(self.structure):
            rotations = [abispg.symrel[isym] for isym in range(nsym) if
                         indsym[iatom, isym, 3] == iatom and abispg.symafm[isym] == 1]
            # Passing a 0-length rotations list to spglib can segfault.
            herm_symbol, ptg_num = "1", 1
            if len(rotations) != 0:
                herm_symbol, ptg_num, trans_mat = spglib.get_pointgroup(rotations)

            self.sitesym_labels.append("%s (#%d,nsym:%d)" % (herm_symbol.strip(), ptg_num, len(rotations)))
github abinit / abipy / abipy / core / symmetries.py View on Github external
def __init__(self, rotations):
        rotations = np.reshape(rotations, (-1, 3, 3))
        self._ops = [LatticeRotation(rot) for rot in rotations]

        # Call spglib to get the Herm symbol.
        # (symbol, pointgroup_number, transformation_matrix)
        herm_symbol, ptg_num, trans_mat = spglib.get_pointgroup(rotations)
        # Remove blanks from C string.
        self.herm_symbol = herm_symbol.strip()
        #print(self.herm_symbol, ptg_num, trans_mat)

        if self.sch_symbol is None:
            raise ValueError("Cannot detect point group symbol! Got sch_symbol = %s" % self.sch_symbol)
github abinit / abipy / abipy / core / structure.py View on Github external
def spget_site_symmetries(self):
        import spglib
        indsym = self.indsym
        symrel, symafm = self.abi_spacegroup.symrel, self.abi_spacegroup.symafm
        nsym = len(symrel)
        sitesym_labels = []
        for iatom, site in enumerate(self):
            rotations = [symrel[isym] for isym in range(nsym) if
                         indsym[iatom, isym, 3] == iatom and symafm[isym] == +1]
            # Passing a 0-length rotations list to spglib can segfault.
            herm_symbol, ptg_num = "1", 1
            if len(rotations) != 0:
                herm_symbol, ptg_num, trans_mat = spglib.get_pointgroup(rotations)

            sitesym_labels.append("%s (#%d,nsym:%d)" % (herm_symbol.strip(), ptg_num, len(rotations)))

        return sitesym_labels
github materialsproject / pymatgen / pymatgen / symmetry / analyzer.py View on Github external
def get_point_group_symbol(self):
        """
        Get the point group associated with the structure.

        Returns:
            (Pointgroup): Point group for structure.
        """
        rotations = self._space_group_data["rotations"]
        # passing a 0-length rotations list to spglib can segfault
        if len(rotations) == 0:
            return '1'
        return spglib.get_pointgroup(rotations)[0].strip()
github SUNCAT-Center / CatKit / catkit / gen / utils / symmetry.py View on Github external
def get_point_group(atoms, tol=1e-8):
    """Return the point group operations of a systems."""
    rotations, translations = get_symmetry(atoms, tol=tol)
    point_group = spglib.get_pointgroup(rotations)[0].strip()

    laue = ['-1', '2/m', 'mmm', '4/m', '4/mmm',
            '-3', '-3m', '6/m', '6/mmm', 'm-3', 'm-3m']

    is_laue = point_group in laue

    return point_group, is_laue
github atztogo / spglib / python / examples / example.py View on Github external
print('')
print("[get_symmetry]")
print("  Symmetry operations of Rutile unitcell are:")
print('')
symmetry = spglib.get_symmetry(rutile)
show_symmetry(symmetry)
print('')
print("[get_symmetry]")
print("  Symmetry operations of MgB2 are:")
print('')
symmetry = spglib.get_symmetry(MgB2)
show_symmetry(symmetry)
print('')
print("[get_pointgroup]")
print("  Pointgroup of Rutile is %s." %
      spglib.get_pointgroup(symmetry['rotations'])[0])
print('')

dataset = spglib.get_symmetry_dataset( rutile )
print("[get_symmetry_dataset] ['international']")
print("  Spacegroup of Rutile is %s (%d)." % (dataset['international'],
                                              dataset['number']))
print('')
print("[get_symmetry_dataset] ['pointgroup']")
print("  Pointgroup of Rutile is %s." % (dataset['pointgroup']))
print('')
print("[get_symmetry_dataset] ['hall']")
print("  Hall symbol of Rutile is %s (%d)." % (dataset['hall'],
                                               dataset['hall_number']))
print('')
print("[get_symmetry_dataset] ['wyckoffs']")
alphabet = "abcdefghijklmnopqrstuvwxyz"