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_symmetries — Functionfind_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.
PeriodicGraphEmbeddings.SymmetryGroup3D — TypeSymmetryGroup3D{T} <: PeriodicGraphs.AbstractSymmetryGroupStore 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).
PeriodicGraphEmbeddings.PeriodicSymmetry3D — TypePeriodicSymmetry3D{T} <: PeriodicGraphs.AbstractSymmetrySingle symmetry of a PeriodicGraphEmbedding3D{T}.
See PeriodicGraphs.AbstractSymmetry for information on the API.
Space group database API
PeriodicGraphEmbeddings.SPACE_GROUP_HALL — ConstantDictionnary 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"
PeriodicGraphEmbeddings.SPACE_GROUP_HM — ConstantDictionnary mapping the HM symbol of a symmetry group to its Hall number.
In the keys, letters are lowercase and space is removed.
PeriodicGraphEmbeddings.SPACE_GROUP_FULL — ConstantDictionnary 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.
PeriodicGraphEmbeddings.SPACE_GROUP_IT — ConstantList mapping the International Table number of a symmetry group to its Hall number
PeriodicGraphEmbeddings.HALL_SYMBOLS — ConstantList of Hall symbols and crystal system corresponding to each Hall number
Internal API
PeriodicGraphEmbeddings.find_hall_number — Functionfind_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.
PeriodicGraphEmbeddings.SpglibDataset — TypeSpglibDatasetWrapper 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}.
PeriodicGraphEmbeddings.get_symmetry_equivalents — Functionget_symmetry_equivalents([T=Rational{Int},] hall::Integer)The list of EquivalentPosition{T} corresponding to a symmetry group given by its Hall number.
Wrapper around spg_get_symmetry_from_database.
PeriodicGraphEmbeddings.get_spglib_dataset — Functionget_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.
PeriodicGraphEmbeddings.check_valid_symmetry — Functioncheck_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.