https://github.com/sotashimozono/lattice2d.jl
A Julia package for generating and manipulating 2D lattice structures for quantum many-body physics simulations.
https://github.com/sotashimozono/lattice2d.jl
grid julia simulation two-dimension
Last synced: about 2 months ago
JSON representation
A Julia package for generating and manipulating 2D lattice structures for quantum many-body physics simulations.
- Host: GitHub
- URL: https://github.com/sotashimozono/lattice2d.jl
- Owner: sotashimozono
- License: mit
- Created: 2025-12-03T14:45:19.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2026-04-29T08:26:08.000Z (about 2 months ago)
- Last Synced: 2026-04-29T08:29:50.818Z (about 2 months ago)
- Topics: grid, julia, simulation, two-dimension
- Language: Julia
- Homepage: http://codes.sota-shimozono.com/Lattice2D.jl/
- Size: 876 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lattice2D.jl
[](https://sotashimozono.github.io/Lattice2D.jl/dev/)
[](https://julialang.org)
[](https://github.com/invenia/BlueStyle)
[](https://codecov.io/gh/sotashimozono/Lattice2D.jl)
[](https://github.com/sotashimozono/Lattice2D.jl/actions/workflows/CI.yml?query=branch%3Amain)
[](https://github.com/JuliaTesting/Aqua.jl)
[](https://opensource.org/licenses/MIT)
## Features
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
## Installation
```julia
using Pkg
Pkg.add("Lattice2D")
```
## Example
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.
```julia
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)
```

## Plots dependency
`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 `Plots` and pays no precompilation cost for it.
- A user that wants visualisation should `using Plots` alongside
`using 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.toml` currently lists `Plots` as 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.
## Quality assurance
The test suite runs [Aqua.jl](https://github.com/JuliaTesting/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.
## Contributing
Contributions are welcome! Please feel free to open an Issue or submit a pull requests.