How to use the spglib.spglib.spg 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 MaterialsDiscovery / PyChemia / pychemia / symm / symmetry.py View on Github external
keys = ('number',
                'hall_number',
                'international',
                'hall',
                'transformation_matrix',
                'origin_shift',
                'rotations',
                'translations',
                'wyckoffs',
                'equivalent_atoms',
                'brv_lattice',
                'brv_types',
                'brv_positions')
        dataset = {}
        for key, data in zip(keys, spg.spglib.spg.dataset(self._transposed_cell,
                                                          self._reduced,
                                                          self._numbers,
                                                          symprec,
                                                          angle_tolerance)):
            dataset[key] = data

        dataset['international'] = dataset['international'].strip()
        dataset['hall'] = dataset['hall'].strip()
        dataset['transformation_matrix'] = np.array(
            dataset['transformation_matrix'], dtype='double', order='C')
        dataset['origin_shift'] = np.array(dataset['origin_shift'], dtype='double')
        dataset['rotations'] = np.array(dataset['rotations'],
                                        dtype='intc', order='C')
        dataset['translations'] = np.array(dataset['translations'],
                                           dtype='double', order='C')
        letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
github MaterialsDiscovery / PyChemia / pychemia / crystal / symmetry.py View on Github external
def spglib_version():
    from pychemia import Structure
    from . import CrystalSymmetry

    # Testing version of spglib
    st = Structure(symbols=['H'])
    symm = CrystalSymmetry(st)
    ret = spg.spglib.spg.dataset(symm.transposed, symm.reduced, symm.numbers, 1e-5, -1.0)
    if type(ret[3]) is list:
        HAS_SPGLIB = False
        version = "%d.%d.%d" % spg.get_version()
        print('SPGLIB current version is %s, please install spglib > 1.9' % version)
    else:
        HAS_SPGLIB = True
    return HAS_SPGLIB