This package provides two dimensional lattices. If you know unit cell information (basic vectors, connection), you can construct arbitrary lattices.
Available lattices by defaults are ...
- Square lattice
- Triangular lattice
- Honeycomb lattice
- Kagome lattice
- Lieb lattice
- Shastry-Sutherland lattice
using Pkg
Pkg.add("Lattice2D")Here we show Honeycomb lattice as an example. The Module enables us to have unit cell informations and connection infos, reciprocal vectors etc. And more, we can know the graph is bipartite or not, we can set periodic boundary and open boundary.
using Lattice2D
# Create a 4x4 Honeycomb lattice with Periodic Boundary Conditions (PBC)
lat = build_lattice(Honeycomb, 4, 4; boundary=PBC())
# Check basic properties
println("Total sites: ", lat.N)
println("Is bipartite? ", lat.is_bipartite)Lattice2D re-exports materialize and require_finite from
LatticeCore. Plotting helpers (e.g. via Plots.plot(lat)) are
provided through LatticeCore's LatticeCorePlotsExt package
extension, which activates only when both LatticeCore and Plots
are loaded. As a result:
- A user that only computes neighbours / bonds / plaquettes / momenta
does not need
Plotsand pays no precompilation cost for it. - A user that wants visualisation should
using Plotsalongsideusing Lattice2D; the recipe / plot method is then picked up automatically.
The docs/ build environment loads Plots explicitly so the gallery
figures are rendered; see docs/src/Gallery.md for visualisation
examples.
Note:
Project.tomlcurrently listsPlotsas a regular dependency for backward compatibility with downstream code that imports it transitively. Migrating it to a[weakdeps]extension is tracked separately and will be a breaking release.
The test suite runs Aqua.jl
checks (ambiguities / unbound args / undefined exports / stale deps /
piracy / persistent tasks) on every CI build, with Plots excluded from
stale_deps while its migration to [weakdeps] is pending.
Contributions are welcome! Please feel free to open an Issue or submit a pull requests.
