diff --git a/src/CondensedMatterSOS.jl b/src/CondensedMatterSOS.jl index 16b5efd..6adfce3 100644 --- a/src/CondensedMatterSOS.jl +++ b/src/CondensedMatterSOS.jl @@ -41,6 +41,8 @@ include("monom-set.jl") include("ising.jl") include("symmetry.jl") +export Lattice1Group + include("action.jl") include("sos.jl") diff --git a/src/action.jl b/src/action.jl index 17aa3f6..9985317 100644 --- a/src/action.jl +++ b/src/action.jl @@ -1,3 +1,4 @@ +import SumOfSquares.Symmetry export Action struct Action <: Symmetry.OnMonomials @@ -11,7 +12,7 @@ function Symmetry.SymbolicWedderburn.action(a::Action, el::DirectSum, mono::Cond rel_id = var.id - a.σ[1][1].id rel_index = var.index + 1 @assert a.σ[rel_index][rel_id + 1] == var - id = ((rel_id + el.c.id) % el.c.n) + a.σ[1][1].id + id = ((rel_id + el.h.id) % el.h.n) + a.σ[1][1].id index = (rel_index^el.k.p) - 1 new_var = CondensedMatterSOS.SpinVariable(id, index) if el.k.k.id != 0 && el.k.k.id != index + 1 diff --git a/src/symmetry.jl b/src/symmetry.jl index 75717d4..5cd2fdd 100644 --- a/src/symmetry.jl +++ b/src/symmetry.jl @@ -1,4 +1,3 @@ -using SumOfSquares import Random using GroupsCore @@ -8,8 +7,6 @@ function __symmetric_grp_gens(n::Integer) end symmetric_group(n::Integer) = PermGroup(__symmetric_grp_gens(n)...) -export Lattice1Group - ## Klein C₂⊕C₂ group struct KleinGroup <: Group end """ @@ -130,12 +127,11 @@ function Base.rand(rng::Random.AbstractRNG, ::Random.SamplerTrivial{KleinPermGro end function Base.deepcopy_internal(g::KleinPermElement, dict::IdDict) - p = if haskey(dict, objectid(g.p)) - dict[objectid(g.p)] - else - Base.deepcopy_internal(g.p, dict) - end - return KleinPermElement(p, g.k) + haskey(dict, g) && return dict[g] + + h = KleinPermElement(Base.deepcopy_internal(g.p, dict), g.k) + dict[g] = h + return h end # CyclicGroup @@ -233,22 +229,24 @@ function Base.rand(rng::Random.AbstractRNG, st::Random.SamplerTrivial{<:DirectSu end function Base.deepcopy_internal(g::DirectSumElem, dict::IdDict) + haskey(dict, g) && return g h = if isbits(g.h) g.h - elseif haskey(dict, objectid(g.h)) - dict[objectid(g.h)] + elseif haskey(dict, g.h) + dict[g.h] else Base.deepcopy_internal(g.h, dict) end - k = if isbits(g.k) g.k - elseif haskey(dict, objectid(g.k)) - dict[objectid(g.k)] + elseif haskey(dict, g.k) + dict[g.k] else Base.deepcopy_internal(g.k, dict) end - return DirectSumElem(h, k) + new_g = DirectSumElem(h, k) + dict[g] = new_g + return new_g end # two aliases