Table Of Contents

This Page

Spglib

Spglib is the C libraries to find and handle crystal symmetries.. This was originally a C-port of the ABINIT symmetry finder.

Features

  • Find symmetry operations (with tolerance)
  • Identify space group
  • Search irreducible k-points
  • Find a primitive cell
  • Find a reduced lattice

Install

  1. Extract download file.

  2. Change directory, configure, and make:

    % cd spglib-0.7.0
    % ./configure
    % make
  3. Copy the libraries where you want. If you didn’t make install, the libraries may be in src/.libs.

Usage

  1. Include spglib.h
  2. Link libsymspg.a or libsymspg.so
  3. Examples are shown in example.c.
  4. Fortran wrapper is spglib_f.c.

Python extension

Python extension for ASE is prepared in the python/ase directory. See http://spglib.sourceforge.net/pyspglibForASE/

For more information

Comments, questions or bug reports are welcome.

Arrays and a variable

lattice

Lattice vectors (in Cartesian)

[ [ a_x, b_x, c_x ],
  [ a_y, b_y, c_y ],
  [ a_z, b_z, c_z ] ]

position

Atomic positions (in fractional coordinates)

[ [ x1_a, x1_b, x1_c ],
  [ x2_a, x2_b, x2_c ],
  [ x3_a, x3_b, x3_c ],
  ...                   ]

types

Atom types, i.e., species are differenciated by integer numbers.

[ type_1, type_2, type_3, ... ]

rotation

Rotation matricies of symmetry operations. r_xx is 1, 0, or -1.

[ [ r_aa, r_ab, r_ac ],
  [ r_ba, r_bb, r_bc ],
  [ r_ca, r_cb, r_cc ] ]

translation

Translation vectors corresponding to symmetry operations in fractional coordinates.

[ t_a, t_b, t_c ]

symprec

Tolerance of atomic positions when finding symmetry operations.

How to operate symmetry

Definition of the operation:

x' = r * x + t:
[ x'_a ]   [ r_aa r_ab r_ac ]   [ x_a ]   [ t_a ]
[ x'_b ] = [ r_ba r_bb r_bc ] * [ x_b ] + [ t_b ]
[ x'_c ]   [ r_ca r_cb r_cc ]   [ x_c ]   [ t_c ]

API

spg_get_symmetry

int spg_get_symmetry(int rotation[][3][3], double translation[][3],
                     const int max_size, const double lattice[3][3],
                     const double position[][3], const int types[],
                     const int num_atom, const double symprec);

Find symmetry operations. The operations are stored in rotatiion and translation. The number of operations is return as the return value. Rotations and translations are given in fractional coordinates, and rotation[i] and translation[i] with same index give a symmetry oprations, i.e., these have to be used togather.

spg_get_bravais_lattice

void spg_get_bravais_lattice(double bravais_lattice[3][3],
                             const double lattice[3][3],
                             const double symprec);

Bravais lattice is estimated from lattice vectors. Internal coordinates of atoms are not considered. Therefore it is not correctly handled in the case of virtual structure.

spg_get_smallest_lattice

void spg_get_smallest_lattice(double smallest_lattice[3][3],
                              const double lattice[3][3],
                              const double symprec);

Considering periodicity of crystal, one of the possible smallest lattice is searched. The lattice is stored in smallest_lattice.

spg_get_multiplicity

int spg_get_multiplicity(const double lattice[3][3], const double position[][3],
                         const int types[], const int num_atom,
                         const double symprec);

Return exact number of symmetry operations. This function may be used in advance to allocate memoery space for symmetry operations. Only upper bound is required, spg_get_max_multiplicity can be used instead of this function and spg_get_max_multiplicity is faster than this function.

spg_get_max_multiplicity

int spg_get_max_multiplicity(const double lattice[3][3], const double position[][3],
                             const int types[], const int num_atom,
                             const double symprec);

Upper bound of number of symmetry operations is found. See spg_get_multiplicity.

spg_find_primitive

int spg_find_primitive(double lattice[3][3], double position[][3],
                       int types[], const int num_atom, const double symprec);

A primitive cell is found from an input cell. Be careful that lattice, position, and types are overwritten. num_atom is returned as return value.

spg_show_symmetry

void spg_show_symmetry(const double lattice[3][3], const double position[][3],
                       const int types[], const int num_atom, const double symprec);

Output space- and point-groups to standard output. This may be useful for testing, tasting, or debugging.

spg_get_international

int spg_get_international(char symbol[21], const double lattice[3][3],
                        const double position[][3],
                        const int types[], const int num_atom,
                        const double symprec);

Space group is found in international table symbol (symbol) and as number (return value). 0 is returned when it fails.

spg_get_schoenflies

int spg_get_schoenflies(char symbol[10], const double lattice[3][3],
                        const double position[][3],
                        const int types[], const int num_atom,
                        const double symprec);

Space group is found in schoenflies (symbol) and as number (return value). 0 is returned when it fails.

spg_get_ir_kpoints

int spg_get_ir_kpoints(int map[], const double kpoints[][3],
                       const int num_kpoint,
                       const double lattice[3][3],
                       const double position[][3], const int types[],
                       const int num_atom,
                       const int is_time_reversal,
                       const double symprec)

Irreducible k-points are searched from the input k-points (kpoints). The result is returned as a map of numbers (map), where kpoints and map have to have the same number of elements. The array index of map corresponds to the reducible k-point numbering. After finding irreducible k-points, the indices of the irreducible k-points are mapped to the elements of map, i.e., number of unique values in map is the number of the irreducible k-points. The number of the irreducible k-points is also returned as the return value.

spg_get_ir_reciprocal_mesh

int spg_get_ir_reciprocal_mesh(int grid_point[][3], int map[], const int num_grid,
                               const int mesh[3], const int is_shift[3],
                               const int is_time_reversal,
                               const double lattice[3][3],
                               const double position[][3], const int types[],
                               const int num_atom, const double symprec)

Irreducible reciprocal grid points are searched from uniform mesh grid points specified by mesh and is_shift. mesh stores three integers. Reciprocal primitive vectors are divided by the number stored in mesh with (0,0,0) point centering. The centering can be shifted only half of one mesh by setting 1 for each is_shift element. If 0 is set for is_shift, it means there is no shift. This limitation of shifting enables the irreducible k-point search significantly faster when the mesh is very dense.

The reducible uniform grid points are returned in reduced coordinates as grid_point. A map between reducible and irreducible points are returned as map as in the indices of grid_point. The number of the irreducible k-points are returned as the return value. The time reversal symmetry is imposed by setting is_time_reversal 1.

spg_get_stabilized_reciprocal_mesh

int spg_get_stabilized_reciprocal_mesh( int grid_point[][3],
                                        int map[],
                                        const int num_grid,
                                        const int mesh[3],
                                        const int is_shift[3],
                                        const int is_time_reversal,
                                        const double lattice[3][3],
                                        const int num_rot,
                                        const int rotations[][3][3],
                                        const int num_q,
                                        const double qpoints[][3],
                                        const double symprec )

The irreducible k-points are searched from unique k-point mesh grids from real space lattice vectors and rotation matrices of symmetry operations in real space with stabilizers. The stabilizers are written in reduced coordinates. Number of the stabilizers are given by num_q. Reduced k-points are stored in map as indices of grid_point. The number of the reduced k-points with stabilizers are returned as the return value.

spg_get_triplets_reciprocal_mesh

int spg_get_triplets_reciprocal_mesh( int triplets[][3],
                                      int weight_triplets[],
                                      int grid_point[][3],
                                      const int num_triplets,
                                      const int num_grid,
                                      const int mesh[3],
                                      const int is_time_reversal,
                                      const double lattice[3][3],
                                      const int num_rot,
                                      const int rotations[][3][3],
                                      const double symprec )

Irreducible triplets of k-points are searched under conservation of \mathbf{k}_1 + \mathbf{k}_2 + \mathbf{k}_3 = \mathbf{G}.

This is under development, and requires huge memory space.

sflogo