Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes after the rewrite of symmetry.jl #33

Merged
merged 3 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/CondensedMatterSOS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ include("monom-set.jl")
include("ising.jl")

include("symmetry.jl")
export Lattice1Group

include("action.jl")
include("sos.jl")

Expand Down
3 changes: 2 additions & 1 deletion src/action.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import SumOfSquares.Symmetry
export Action

struct Action <: Symmetry.OnMonomials
Expand All @@ -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
Expand Down
28 changes: 13 additions & 15 deletions src/symmetry.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using SumOfSquares
import Random
using GroupsCore

Expand All @@ -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
"""
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading