Spglib is the C libraries to find and handle crystal symmetries.. This was originally a C-port of the ABINIT symmetry finder.
Extract download file.
Change directory, configure, and make:
% cd spglib-0.7.0
% ./configure
% make
Copy the libraries where you want. If you didn’t make install, the libraries may be in src/.libs.
Python extension for ASE is prepared in the python/ase directory. See http://spglib.sourceforge.net/pyspglibForASE/
Comments, questions or bug reports are welcome.
Atomic positions (in fractional coordinates)
[ [ x1_a, x1_b, x1_c ],
[ x2_a, x2_b, x2_c ],
[ x3_a, x3_b, x3_c ],
... ]
Atom types, i.e., species are differenciated by integer numbers.
[ type_1, type_2, type_3, ... ]
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 vectors corresponding to symmetry operations in fractional coordinates.
[ t_a, t_b, t_c ]
Tolerance of atomic positions when finding symmetry operations.
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 ]
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
.
This is under development, and requires huge memory space.