pwtools.symmetry.spglib_get_primitive

pwtools.symmetry.spglib_get_primitive(struct, **kwds)[source]

Find primitive structure for given Structure.

If struct is irreducible (is already a primitive cell), we return None, else a Structure.

Uses spglib.

Parameters:
  • struct (Structure) –

  • **kwds (keywords) – passed to spglib.find_primitive(), e.g. symprec and angle_tolerance last time I checked

Return type:

Structure or None

Notes

spglib used to return (None,None,None) if no primitive cell can be found, i.e. the given input Structure cannot be reduced, which can occur if (a) a given Structure is already a primitive cell or (b) any other reason like a too small value of symprec. Now [py]spglib >= 1.8.x seems to always return data instead. We use is_same_struct() to determine if the struct is irreducible. In that case we return None in order to keep the API unchanged.

Also note that a primitive cell (e.g. with 2 atoms) can have a number of different realizations. Therefore, you may not always get the primitive cell which you would expect or get from other tools like Wien2K’s sgroup. Only things like natoms and the spacegroup can be safely compared.