In CellListMap.jl I have a function that replicates the a periodic system according to the unit cell matrix, it works like this:
julia> using CellListMap
julia> x = SVector{2,Float64}[ [0,0], [0,1], [0.5,0.5] ];
julia> CellListMap.replicate_system!(x,[ 1 0 ; 0.5 1 ],(0:5,0:5)); # replicate (updates x)
julia> using Plots
julia> scatter(Tuple.(x))
where the second argument is the unit cell matrix, and the third is a tuple that defines how many times the system is replicated in each direction. With that you get:
Not sure if that helps, I was intending to split some of this functionality into another package, but didn’t have the time, for now it is an internal function.