In this module, QuasiCrystals structures are available including,
- Fibonacci Lattice
- Penrose Tile
- Amman Beenker Lattice
Package quality is checked on CI via Aqua.jl
(Aqua.test_all), covering ambiguities, unbound type parameters, undefined
exports, stale dependencies, and Method-of-piracy.
QuasiCrystal.jl provides a unified interface (AbstractLattice{D}) that allows both periodic lattices and aperiodic quasicrystals to be accessed consistently. This design enables applications like Lattice2DMonteCarlo to work uniformly with either structure type through consistent access to:
- Sites/positions: Access vertex positions in the structure
- Bonds/connections: Query nearest-neighbor relationships
- Indexing: Uniform site and bond indexing
AbstractLattice{D}: Base abstract type for all lattice-like structures in D dimensionsAbstractQuasicrystal{D}: Abstract type for quasicrystals (inherits from AbstractLattice)AbstractTopology{D}: Abstract type for periodic lattice topologiesUnitCell{D,T}: Unit cell definition for periodic latticesLattice{Topology,T,B,I}: Concrete type for periodic lattices with unit cell structureQuasicrystalData{D,T,TileType}: Data structure for generated quasicrystal patternsBond: Represents connections between sitesConnection: Connection rules for unit cell-based lattices
# Works for both quasicrystals and periodic lattices
get_positions(lattice) # Get site positions
get_bonds(lattice) # Get bond list
get_nearest_neighbors(lattice) # Get neighbor indices for each site
num_sites(lattice) # Total number of sites
num_bonds(lattice) # Total number of bonds
# Build nearest-neighbor connectivity
build_nearest_neighbor_bonds!(qc_data; cutoff=2.0)using QuasiCrystal
# Generate a Fibonacci lattice (1D quasicrystal)
fibonacci_qc = generate_fibonacci_projection(20)
# Build nearest neighbor bonds
build_nearest_neighbor_bonds!(fibonacci_qc; cutoff=2.0)
# Access properties via unified interface
println("Number of sites: ", num_sites(fibonacci_qc))
println("Number of bonds: ", num_bonds(fibonacci_qc))
positions = get_positions(fibonacci_qc)
bonds = get_bonds(fibonacci_qc)
neighbors = get_nearest_neighbors(fibonacci_qc)
# Generate a 2D Penrose tiling
penrose_qc = generate_penrose_projection(3.0)
build_nearest_neighbor_bonds!(penrose_qc; cutoff=1.5)# Get unit cell for square lattice
uc = get_unit_cell(Square)
# Access unit cell properties
println("Basis vectors: ", uc.basis)
println("Sublattice positions: ", uc.sublattice_positions)
println("Connections: ", uc.connections)See example/lattice_interface.jl for a comprehensive demonstration of the unified interface.
Tight-binding model is available in example/tight_binding.jl