Symmetries

Symmetry detection is provided by the spglib library, wrapped in helper functions detailed below.

Manual

The main function is find_symmetries which returns a SymmetryGroup3D:

PeriodicGraphEmbeddings.find_symmetriesFunction
find_symmetries(pge::PeriodicGraphEmbedding3D, vtypes=nothing, check_symmetry=check_valid_symmetry; tolerance::Union{Nothing,Cdouble}=nothing)

Return a SymmetryGroup3D object storing the list of symmetry operations on the graph embedding, found using spglib. Use retrieve_symmetries to simply extract the symmetries already specified in the Cell of the graph embedding.

If vtypes !== nothing, ensure that two vertices x and y cannot be symmetry-related if vtypes[x] != vtypes[y].

check_symmetry must be a function that takes the same four arguments pge, t, r and vtypes as check_valid_symmetry and return either (vmap, offsets) or nothing if the input is not a valid symmetry. It can be used to specify additional constraints that cannot be carried by vtypes alone.

An explicit tolerance can be set. Otherwise, the default is a loose tolerance if the positions are floating points, or a stringent tolerance if they are rationals.

source
PeriodicGraphEmbeddings.SymmetryGroup3DType
SymmetryGroup3D{T} <: PeriodicGraphs.AbstractSymmetryGroup

Store the information on the symmetry operations available on a PeriodicGraphEmbedding3D.

T is the numeric type parameter of each individual PeriodicSymmetry3D, which can be obtained by iterating over the SymmetryGroup3D. For example, if symms is a SymmetryGroup3D{Rational{Int}}, then first(symms) will be a PeriodicSymmetry3D{Rational{Int64}}. collect(symms) gives the full list of symmetries stored in the SymmetryGroup3D.

The list of the symmetrically-unique vertices of the PeriodicGraphEmbedding3D can be retrieved by calling unique(symms). The mapping between any vertex i and its corresponding unique vertex can be obtained by calling symms itself with the vertex, like symms(i).

source

Space group database API

PeriodicGraphEmbeddings.SPACE_GROUP_HALLConstant

Dictionnary mapping the Hall symbol of a symmetry group to its Hall number.

In the keys, letters are lowercase, underscores are removed and space is kept to differentiate "p 6 2" from "p 62" and "p 3 2" from "p 32"

source
PeriodicGraphEmbeddings.SPACE_GROUP_FULLConstant

Dictionnary mapping the full notation representation of a symmetry group to its Hall number, if the full notation is distinct from the H-M symbol.

In the keys, letters are lowercase and space is removed.

source

Internal API

PeriodicGraphEmbeddings.find_hall_numberFunction
find_hall_number(hallsymbol::AbstractString, hm::AbstractString=hallsymbol, it::Integer=0, warnonnotfound=false)

Determine the hall number corresponding to the given hallsymbol. The Hermann-Mauguin symbol hm can alternatively be used, or simply the International Table number of the space group it to get the hall number of the standard setting of the group.

Passing an empty string to hallsymbol or hm or 0 to it disregards the argument.

The optional argument warnonnotfound specifies whether to print a warning if one of the provided arguments was not reckognized.

source
PeriodicGraphEmbeddings.SpglibDatasetType
SpglibDataset

Wrapper around the SpglibDataset type exported by spglib. Its accessible fields are the same as in the C counterpart, except that strings are already converted to String, lists to Vector and matrices to Matrix.

To access the raw pointers without conversion, prepend an underscore to the field: for example dataset._rotations yields a Ptr{Cint} where dataset.rotations is a 3×3 Matrix{Int}.

source
PeriodicGraphEmbeddings.get_spglib_datasetFunction
get_spglib_dataset(pge::PeriodicGraphEmbedding3D, vtypes=nothing; tolerance::Union{Nothing,Cdouble}=nothing)

Wrapper around spg_get_dataset.

If vtypes !== nothing, ensure that two vertices x and y cannot be symmetry-related if vtypes[x] != vtypes[y].

An explicit tolerance can be set. Otherwise, the default is a loose tolerance if the positions are floating points, or a stringent tolerance if they are rationals.

source
PeriodicGraphEmbeddings.check_valid_symmetryFunction
check_valid_symmetry(pge::PeriodicGraphEmbedding{D,T}, t::SVector{D,T}, r=nothing, vtypes=nothing, issorted=false)

Check that the periodic graph embedding is identical to that rotated by r (if it is not nothing) then translated by t. If vtypes is not nothing, any vertex x must additionally be mapped to a vertex y such that vtypes[x] == vtypes[y]. If issorted is set and T <: Rational, assume that issorted(pge.pos) to use a faster dichotomy approach.

If so, return the the vmap between the initial vertices and their symmetric images, as well as the offsets of each symmetric image compared to the origin. Otherwise, return nothing.

source