SymGroups API

Index

SymBasis.SymGroups.AbstractSymSpecType
AbstractSymSpec

An abstract type representing a symmetry specification. Concrete subtypes of AbstractSymSpec define specific symmetry specifications that can be used to create symmetry groups.

source
SymBasis.SymGroups.CombSymGroupType
CombSymGroup{B,T_s,T<:Integer,Ti<:Integer,T_f<:Number}
CombSymGroup(
    dofo::DoFObject{B,T_s,T,Ti},
    cycles::AbstractArray{<:AbstractVector{<:NamedTuple}},
    check::AbstractVector{<:Function},
    apply::AbstractVector{<:Function},
    factors::AbstractArray{T_f},
    N::Integer
) where {B,T_s,T<:Integer,Ti<:Integer,T_f<:Number}

A combined symmetry group formed by the composition of multiple symmetry groups acting on the same DoF-object. This structure allows for the representation of more complex symmetry operations by combining simpler ones.

Fields

  • dofo::SymBasis.DoFObjects.DoFObject{B,T_s,T,Ti}: The DoF-object on which the combined symmetry group acts.
  • cycles::AbstractArray{<:AbstractVector{<:NamedTuple}}: An array of vectors of named tuples representing the combined symmetry cycles.
  • check::AbstractVector{<:Function}: A vector of functions to check the validity of each set of symmetry operations.
  • apply::AbstractVector{<:Function}: A vector of functions to apply each set of symmetry operations.
  • factors::AbstractArray{T_f}: An array of factors associated with each combined symmetry cycle.
  • N::Integer: The total number of the DoF-objects in the system. This is used to check the validity of the symmetry operations.

Constructor Arguments

  • dofo::SymBasis.DoFObjects.DoFObject{B,T_s,T,Ti}: The DoF-object on which the combined symmetry group acts.
  • cycles::AbstractArray{<:AbstractVector{<:NamedTuple}}: An array of vectors of named tuples representing the combined symmetry cycles.
  • check::AbstractVector{<:Function}: A vector of functions to check the validity of each set of symmetry operations.
  • apply::AbstractVector{<:Function}: A vector of functions to apply each set of symmetry operations.
  • factors::AbstractArray{T_f}: An array of factors associated with each combined symmetry cycle.
  • N::Integer: The total number of the DoF-objects in the system. This is used to check the validity of the symmetry operations.

Returns

  • CombSymGroup{B,T_s,T,Ti,T_f}: A new CombSymGroup instance initialized with the provided parameters.

The constructor checks that the size of cycles matches the size of factors and that the number of dimensions matches the number of check and apply functions to ensure consistency.

source
SymBasis.SymGroups.RotationalType
Rotational{T_r<:Integer,Ti} <: SymBasis.SymGroups.AbstractSymSpec

A concrete subtype of SymBasis.SymGroups.AbstractSymSpec representing the specification of rotational symmetry of space. The type parameter T_r represents the spatial rotation number, while Ti represents the type of the permutation indices.

Fields

  • r::T_r: The spatial rotation number.
  • perm::AbstractVector{Ti}: The permutation vector defining the rotation.

Constructor Arguments

  • r::T_r: The spatial rotation number.
  • perm::AbstractVector{Ti}: The permutation vector defining the rotation.

Returns

  • Rotational{T_r,Ti}: An instance of Rotational representing the specified rotational symmetry of space.
source
SymBasis.SymGroups.SpatialReflectionType
SpatialReflection{T_p<:Integer,Ti} <: SymBasis.SymGroups.AbstractSymSpec

A concrete subtype of SymBasis.SymGroups.AbstractSymSpec representing a spatial reflection symmetry specification. The type parameter T_p represents the parity quantum number, while Ti represents the type of the permutation indices.

Fields

  • p::T_p: The parity number (either -1 or 1).
  • perm::AbstractVector{Ti}: The permutation vector defining the spatial reflection.

Constructor Arguments

  • p::T_p: The parity number (either -1 or 1).
  • perm::AbstractVector{Ti}: The permutation vector defining the spatial reflection.

Returns

  • SpatialReflection{T_p,Ti}: An instance of SpatialReflection representing the specified

spatial reflection symmetry.

source
SymBasis.SymGroups.SpinInversionType
SpinInversion{T_z<:Integer,T_N<:Integer} <: SymBasis.SymGroups.AbstractSymSpec

A concrete subtype of SymBasis.SymGroups.AbstractSymSpec representing a spin inversion symmetry specification. The type parameter T_z represents the spin inversion quantum number, while T_N represents the total number of DoF-objects in the system.

Fields

  • z::T_z: The parity quantum number (either -1 or 1).
  • N::T_N: The total number of DoF-objects in the system.

Constructor Arguments

  • z::T_z: The parity quantum number (either -1 or 1).
  • N::T_N: The total number of DoF-objects in the system.

Returns

  • SpinInversion{T_z,T_N}: An instance of SpinInversion representing the specified spin inversion symmetry.
source
SymBasis.SymGroups.SymGroupType
SymGroup{B,T_s,T<:Integer,Ti<:Integer,T_f<:Number}
SymGroup(
    dofo::DoFObject{B,T_s,T,Ti},
    cycles::AbstractVector{<:NamedTuple},
    check::Function,
    apply::Function,
    factors::AbstractVector{T_f},
    N::Integer
) where {B,T_s,T<:Integer,Ti<:Integer,T_f<:Number}

A symmetry group acting on a DoF-object. The symmetry group is defined by its associated DoF-object, a set of cycles representing the symmetry operations, functions to check and apply these operations, and factors associated with each symmetry cycle.

Fields

  • dofo::SymBasis.DoFObjects.DoFObject{B,T_s,T,Ti}: The DoF-object on which the symmetry group acts.
  • cycles::AbstractVector{<:NamedTuple}: A vector of named tuples representing the symmetry cycles.
  • check::Function: A function to check the validity of symmetry operations.
  • apply::Function: A function to apply the symmetry operations.
  • factors::AbstractVector{T_f}: A vector of factors associated with each symmetry cycle.
  • N::Integer: The total number of the DoF-objects in the system. This is used to check the validity of the symmetry operations.

Constructor Arguments

  • dofo::SymBasis.DoFObjects.DoFObject{B,T_s,T,Ti}: The DoF-object on which the symmetry group acts.
  • cycles::AbstractVector{<:NamedTuple}: A vector of named tuples representing the symmetry cycles.
  • check::Function: A function to check the validity of symmetry operations.
  • apply::Function: A function to apply the symmetry operations.
  • factors::AbstractVector{T_f}: A vector of factors associated with each symmetry cycle.
  • N::Integer: The total number of the DoF-objects in the system. This is used to check the validity of the symmetry operations.

Returns

  • SymGroup{B,T_s,T,Ti,T_f}: A new SymGroup instance initialized with the provided parameters.

The constructor checks that the number of cycles matches the number of factors to ensure consistency.

source
SymBasis.SymGroups.TotalMagnetizationType
TotalMagnetization{T_s<:Rational,T_N<:Integer} <: SymBasis.SymGroups.AbstractSymSpec

A concrete subtype of SymBasis.SymGroups.AbstractSymSpec representing a total magnetization symmetry specification. The type parameter T_s represents the target total magnetization value, while T_N represents the total number of DoF-objects in the system.

Constructor Arguments

  • mag::T_s: The target total magnetization value for the symmetry specification.
  • N::T_N: The total number of DoF-objects in the system.

Returns

  • TotalMagnetization{T_s,T_N}: An instance of TotalMagnetization representing the specified total magnetization symmetry.
source
SymBasis.SymGroups.TotalMagnetizationMethod
TotalMagnetization(mag::AbstractFloat, N)

Convenience constructor for TotalMagnetization that accepts a floating-point magnetization value and converts it to a rational number.

Arguments

  • mag::AbstractFloat: The target total magnetization value as a floating-point number.
  • N: The total number of DoF-objects in the system.

Returns

source
SymBasis.SymGroups.TotalMagnetizationMethod
TotalMagnetization(mag::Integer, N)

Convenience constructor for TotalMagnetization that accepts an integer magnetization value and converts it to a rational number.

Arguments

  • mag::Integer: The target total magnetization value as an integer.
  • N: The total number of DoF-objects in the system.

Returns

source
SymBasis.SymGroups.TranslationalType
Translational{T_k<:Integer,Ti} <: SymBasis.SymGroups.AbstractSymSpec

A concrete subtype of SymBasis.SymGroups.AbstractSymSpec representing a translational symmetry specification. The type parameter T_k represents the momentum quantum number, while Ti represents the type of the permutation indices.

Fields

  • k::T_k: The momentum number.
  • perm::AbstractVector{Ti}: The permutation vector defining the translation.

Constructor Arguments

  • k::T_k: The momentum number.
  • perm::AbstractVector{Ti}: The permutation vector defining the translation.

Returns

  • Translational{T_k,Ti}: An instance of Translational representing the specified

translational symmetry.

source
Base.:∘Method
∘(
    csg1::CombSymGroup{B,T_s,T,Ti,<:T_f},
    csg2::CombSymGroup{B,T_s,T,Ti,<:T_f}
) where {B,T_s,T<:Integer,Ti<:Integer,T_f<:Number}

Composition of two combined symmetry groups acting on the same DoF-object. The resulting symmetry group combines the cycles, check functions, apply functions, and factors of the input symmetry groups.

Arguments

Returns

source
Base.:∘Method
∘(
    csg::CombSymGroup{B,T_s,T,Ti,<:T_f},
    sg::SymGroup{B,T_s,T,Ti,<:T_f}
) where {B,T_s,T,Ti,T_f<:Number}

Composition of a combined symmetry group with a symmetry group acting on the same DoF-object. The resulting symmetry group combines the cycles, check functions, apply functions, and factors of the input symmetry groups.

Arguments

Returns

source
Base.:∘Method
∘(
    csg::SymGroup{B,T_s,T,Ti,<:T_f},
    sg::CombSymGroup{B,T_s,T,Ti,<:T_f}
) where {B,T_s,T<:Integer,Ti<:Integer,T_f<:Number}

Composition of a combined symmetry group with a symmetry group acting on the same DoF-object. The resulting symmetry group combines the cycles, check functions, apply functions, and factors of the input symmetry groups.

Arguments

Returns

source
Base.:∘Method
∘(
    sg1::SymGroup{B,T_s,T,Ti,<:T_f},
    sg2::SymGroup{B,T_s,T,Ti,<:T_f}
) where {B,T_s,T,Ti,T_f<:Number}

Composition of two symmetry groups acting on the same DoF-object. The resulting symmetry group combines the cycles, check functions, apply functions, and factors of the input symmetry groups.

Arguments

Returns

source
SymBasis.SymGroups._check_NₛMethod
_check_Nₛ(
    state::SymBasis.DigitBase.BaseInt{T,Ti,2},
    p::NamedTuple{N0::TN, N1::TN, N::TN}
) where {T,Ti,TN<:Integer}

Internal function to check if the given binary state has the specified counts of 0s and 1s as defined in the named tuple p.

Arguments

  • state::SymBasis.DigitBase.BaseInt{T,Ti,2}: The binary state to be checked.
  • p::NamedTuple{N0::TN, N1::TN, N::TN}: A named tuple containing the counts of 0s and 1s.

Returns

  • Bool: true if the state has the specified counts of 0s and 1s, false otherwise.
source
SymBasis.SymGroups._check_NₛMethod
_check_Nₛ(
    state::SymBasis.DigitBase.BaseInt{T,Ti,B},
    p::NamedTuple{names}
) where {T,Ti,B,names}

Internal function to check if the given state has the specified digit counts as defined in the named tuple p. Accepts any named tuple that contains the fields N, N0, N1, ..., N(B-1) (e.g. from both check_Nₛ and check_flip parameter tuples).

Arguments

  • state::SymBasis.DigitBase.BaseInt{T,Ti,B}: The state to be checked.
  • p::NamedTuple{names}: A named tuple containing at least the digit count fields.

Returns

  • Bool: true if the state has the specified digit counts, false otherwise.
source
SymBasis.SymGroups.apply_NₛMethod
apply_Nₛ(
    p::NamedTuple{names,NT},
    state::SymBasis.DigitBase.BaseInt
) where {names,NT<:Tuple{Vararg{Integer}}}

Apply the symmetry operation defined by the digit counts in p to the given state. Since this is a symmetry where the state remains unchanged, the function simply returns the input state.

Arguments

  • p::NamedTuple{names,NT}: A named tuple containing the digit counts.
  • state::SymBasis.DigitBase.BaseInt: The state to which the symmetry operation will be applied.

Returns

source
SymBasis.SymGroups.apply_flipMethod
apply_flip(
    p::NamedTuple{is_flipped::Bool, sites::T_site, N0::TN, N1::TN, N::TN},
    state::SymBasis.DigitBase.BaseInt{T,Ti,2}
) where {T,Ti,TN<:Integer,T_site<:AbstractVector{Ti}}

Apply the flip operation defined by p to the given binary state if p.is_flipped is true. If the state is flipped, the function returns the flipped state; otherwise, it returns the original state.

Arguments

  • p::@NamedTuple{is_flipped::Bool, sites::T_site, N0::TN, N1::TN, N::TN}: A named tuple containing the flip flag, sites to be flipped, and the expected counts of 0s and 1s.
  • state::SymBasis.DigitBase.BaseInt{T,Ti,2}: The binary state to which the flip operation will be applied.

Returns

source
SymBasis.SymGroups.apply_permMethod
apply_perm(
    p::@NamedTuple{perm::Tperm},
    state::SymBasis.DigitBase.BaseInt{T,Ti,B}
) where {T,Ti,B,Tperm<:AbstractVector{<:Ti}}

Apply the permutation p.perm to the given state.

Arguments

  • p::@NamedTuple{perm::Tperm}: A named tuple containing the permutation.
  • state::SymBasis.DigitBase.BaseInt{T,Ti,B}: The state to which the permutation will be applied.

Returns

source
SymBasis.SymGroups.apply_permMethod
apply_perm(
    p::@NamedTuple{perm::Tperm},
    state::SymBasis.DigitBase.BaseInt{T,Ti,2}
) where {
    T,
    Ti,
    Tperm<:BitPermutations.BitPermutation{T,<:BitPermutations.PermutationBackend{T}}
}

Apply the bit permutation p.perm to the given binary state in a more efficient way.

Arguments

  • p::@NamedTuple{perm::Tperm}: A named tuple containing the bit permutation.
  • state::SymBasis.DigitBase.BaseInt{T,Ti,2}: The binary state to which the bit permutation will be applied.

Returns

source
SymBasis.SymGroups.check_NₛMethod
check_Nₛ(
    p::NamedTuple{names,NT},
    state::SymBasis.DigitBase.BaseInt,
    prev_bool::Bool,
) where {names,NT<:Tuple{Vararg{Integer}}}

Check if the given state has the specified digit counts as defined in the named tuple p. Since this is a symmetry check, the result is combined with prev_bool.

Arguments

  • p::NamedTuple{names,NT}: A named tuple containing the digit counts.
  • state::SymBasis.DigitBase.BaseInt: The state to be checked.
  • prev_bool::Bool: The previous boolean value to be combined with the check result.

Returns

  • Bool: The combined result of the previous boolean and the digit count check.
source
SymBasis.SymGroups.check_flipMethod
check_flip(
    p::NamedTuple{names,<:Tuple{Bool,<:AbstractVector{Ti},Vararg{Integer}}},
    state::SymBasis.DigitBase.BaseInt{T,Ti,B},
    prev_bool::Bool
) where {names,T,Ti,B}

Check if the given state (for base B > 2) has the specified digit counts as defined in the named tuple p. The function checks if the flipped state has the specified digit counts. The result is combined with prev_bool.

Arguments

  • p::NamedTuple{names,<:Tuple{Bool,<:AbstractVector{Ti},Vararg{Integer}}}: A named tuple containing is_flipped, sites, and digit count fields N0, N1, ..., N(B-1), N.
  • state::SymBasis.DigitBase.BaseInt{T,Ti,B}: The state to be checked.
  • prev_bool::Bool: The previous boolean value to be combined with the check result.

Returns

  • Bool: The combined result of the previous boolean and the digit count check.
source
SymBasis.SymGroups.check_permMethod
check_perm(
    p::@NamedTuple{perm::Tperm},
    state::SymBasis.DigitBase.BaseInt{T,Ti,B},
    prev_bool::Bool
) where {
    T,
    Ti,
    B,
    Tperm<:Union{
        AbstractVector{<:Ti},
        BitPermutations.BitPermutation{T,<:BitPermutations.PermutationBackend{T}}
    }
}

Check if the given state is invariant under the permutation p.perm. Since permutations are symmetries, this function always returns prev_bool unchanged.

Arguments

  • p::@NamedTuple{perm::Tperm}: A named tuple containing the permutation.
  • state::SymBasis.DigitBase.BaseInt{T,Ti,B}: The state to be checked.
  • prev_bool::Bool: The previous boolean value to be combined with the check result.

Returns

  • Bool: The combined result of the previous boolean and the check (always prev_bool).
source
SymBasis.SymGroups.symMethod
sym(
    ss::SymBasis.SymGroups.SpinInversion{T_z,T_N},
    dofo::SymBasis.DoFObjects.DoFObject{B,T_s,T,Ti}
) where {B,T_s,T,Ti,T_z,T_N}

Create a spin inversion symmetry group for the given DoF-object dofo, and spin inversion symmetry specification ss. The function generates all combinations of spin projections that sum to zero, and constructs the spin inversion symmetry group using the check_flip and apply_flip functions.

Arguments

Returns

source
SymBasis.SymGroups.symMethod
sym(
    ss::SymBasis.SymGroups.TotalMagnetization{T_s,T_N},
    dofo::SymBasis.DoFObjects.DoFObject{B,T_s,T,Ti}
) where {B,T_s,T,Ti,T_N}

Create a total magnetization symmetry group for the given spin DoF-object dofo, and target total magnetization specification ss.

Arguments

Returns

source
SymBasis.SymGroups.symMethod
sym(
    ss::SymBasis.SymGroups.Translational{T_k,Ti},
    dofo::SymBasis.DoFObjects.DoFObject{B,T_s,T,Ti}
) where {B,T_s,T,Ti,T_k}

Create a translational symmetry group for the given DoF-object dofo, and translational symmetry specification ss.

Arguments

Returns

source
SymBasis.SymGroups.symMethod
sym(
    ss::SymBasis.SymGroups.SpatialReflection{T_p,Ti},
    dofo::SymBasis.DoFObjects.DoFObject{B,T_s,T,Ti}
) where {B,T_s,T,Ti,T_p}

Create a spatial reflection symmetry group for the given DoF-object dofo, and spatial reflection symmetry specification ss.

Arguments

Returns

source
SymBasis.SymGroups.symMethod
sym(
    ss::SymBasis.SymGroups.Rotational{T_r,Ti},
    dofo::SymBasis.DoFObjects.DoFObject{B,T_s,T,Ti}
) where {B,T_s,T,Ti,T_r}

Create a group of rotational symmetry of space for the given DoF-object dofo, and rotational symmetry specification ss. The function generates the rotational symmetry group by applying the permutation defined in ss repeatedly until it returns to the identity, and constructs the rotational symmetry group using the check_perm and apply_perm functions.

Arguments

Returns

source