diff --git a/src/other.jl b/src/other.jl index 75a4162..87ba046 100644 --- a/src/other.jl +++ b/src/other.jl @@ -74,5 +74,21 @@ function PeriodicGraphs.make_supercell(pge::PeriodicGraphEmbedding, t) newpos[n*k+i] = newpos[i] .+ pos .// t end end - return PeriodicGraphEmbedding(g, newpos, cell) + PeriodicGraphEmbedding(g, newpos, cell) +end + +function PeriodicGraphs.split_catenation(pge::PeriodicGraphEmbedding{D,T}) where {D,T} + pge.cell.hall == 1 || error("Skew a non-P1 cell is not implemented") + splits = split_catenation(pge.g) + ret = Vector{Tuple{PeriodicGraphEmbedding{D,T}, Vector{PeriodicGraphs.OffsetVertexIterator{D}}, SMatrix{D,D,Int,D*D}, Int}}(undef, length(splits)) + for (i, (subgraph, vmaps, mat, dim)) in enumerate(splits) + newcell = Cell(mat * pge.cell.mat) + invmat = inv(Rational{Int}.(mat)) + newpos = [invmat * pge[x] for x in first(vmaps)] + moffsets = [.-floor.(Int, pos) for pos in newpos] + subpge = PeriodicGraphEmbedding(copy(subgraph), newpos, newcell) + offset_representatives!(subpge, moffsets) + ret[i] = (subpge, vmaps, mat, dim) + end + ret end