Lattice2D.jl
A Julia package for constructing and visualizing 2D lattices for quantum many-body physics simulations.
Installation
using Pkg
Pkg.add("Lattice2D")Models
The models implemented in this module is below.
Lattice2D.AbstractBoundaryCondition — Type
AbstractBoundaryCondition格子の境界条件の抽象型。
- PBC: 周期境界条件
- OBC: 開境界条件
- SSD: Sine-Square Deformation 境界条件
Lattice2D.AbstractLattice — Type
AbstractLattice{D}abstract type for lattices in D dimensions.
Lattice2D.AbstractLatticeConnection — Type
AbstractLatticeConnectionabstract type for lattice connections (edges, bonds).
Lattice2D.AbstractTopology — Type
AbstractTopologyAbstract type for lattice topologies.
Lattice2D.Bond — Type
Bondstruct for a bond (edge) in the lattice.
src::Int: start site indexdst::Int: destination site indextype::Int: type of the bond for categorizationvector::Vector{Float64}: expresses the bond vector from src to dst
Lattice2D.Connection — Type
ConnectionConnection rules within or between unit cells.
src_sub: sublattice index of the start point (1, 2, ...)dst_sub: sublattice index of the end pointdx,dy: relative cell position of the end point (0,0 means within the same unit cell)type: type of the connection
Lattice2D.Dice — Type
Dice <: AbstractTopology{2}struct which represents Dice lattice (T3 lattice) Bipartite lattice with coordination numbers 6 (Hub) and 3 (Rim).
Lattice2D.Honeycomb — Type
Honeycomb <: AbstractTopology{2}struct which represents Honeycomb lattice
Lattice2D.Kagome — Type
Kagome <: AbstractTopology{2}struct which represents Kagome lattice
Lattice2D.Lattice — Type
Lattice{Topology<:AbstractTopology, T, B<:AbstractBoundaryCondition, I<:AbstractIndexing} It mainly represents 2-dimiensional lattice, but it can be used as 1-dimensional lattice as well.
Lx::Int: x direction lattice sizeLy::Int: y direction lattice sizeN::Int: total number of sitespositions::Vector{Vector{T}}: position vectors of each sitenearest_neighbors::Vector{Vector{Int}}: nearest neighbor indices for each sitebonds::Vector{Bond}: list of bonds (edges) in the latticebasis_vectors::Vector{Vector{T}}: lattice basis vectorsreciprocal_vectors::Union{Vector{Vector{T}}, Nothing}: reciprocal lattice vectorssublattice_ids::Vector{Int}: sublattice IDs of each siteis_bipartite::Bool: whether the lattice is bipartitesite_map::Union{Matrix{Int}, Nothing}: mapping of site indices on the latticetranslation_x::Vector{Int}: x direction translation vectortranslation_y::Vector{Int}: y direction translation vectorboundary::B: boundary conditionindex_method::I: indexing method
Lattice2D.Lieb — Type
Lieb <: AbstractTopology{2}struct which represents Lieb lattice
Lattice2D.ShastrySutherland — Type
ShastrySutherland <: AbstractTopology{2}struct which represents Shastry-Sutherland lattice
Lattice2D.Square — Type
Square <: AbstractTopology{2}struct which represents Square lattice
Lattice2D.Triangular — Type
Triangular <: AbstractTopology{2}struct which represents Triangular lattice
Lattice2D.UnionJack — Type
UnionJack <: AbstractTopology{2}struct which represents Union Jack (Centered Square) lattice.
Lattice2D.UnitCell — Type
UnitCell{D, T}Geometric definition data of the lattice. Basically, the lattice is constructed based on this information. The get_unit_cell(::Type{T}) function retrieves the unit cell data corresponding to each topology.
Lattice2D._coord_to_index — Method
_coord_to_index(lat::Lattice, x::Int, y::Int, s::Int)this function converts lattice coordinates to a linear index based on the lattice's indexing method.
- ColMajorIndexing
- RowMajorIndexing
- SnakeIndexing
are available indexing methods.
Lattice2D.build_lattice — Method
build_lattice(Topology::Type{<:AbstractTopology}, Lx::Int, Ly::Int; boundary::AbstractBoundaryCondition=PBC())Construct a lattice with the specified topology, size, and boundary conditions. this function is available if unitcell information is defined.
Lattice2D.calc_reciprocal_vectors — Method
calc_reciprocal_vectors(basis)Calculate reciprocal lattice vectors from the given basis vectors.
Lattice2D.check_bipartite_bfs — Method
check_bipartite_bfs(N, neighbors)check whether the given lattice is bipartite using BFS.
Lattice2D.get_coordinates — Method
get_coordinates(lat::Lattice, idx::Int)Get the lattice coordinates (x, y, sublattice) from a linear site index.
Arguments
lat::Lattice: The lattice structureidx::Int: The linear site index
Returns
Tuple{Int, Int, Int}: A tuple (x, y, s) where x, y are unit cell coordinates and s is sublattice index
Examples
lat = build_lattice(Honeycomb, 4, 4)
x, y, s = get_coordinates(lat, 10)Lattice2D.get_position — Method
get_position(lat::Lattice, idx::Int)Get the spatial position (coordinates) of a site given its linear index.
Arguments
lat::Lattice: The lattice structureidx::Int: The linear site index
Returns
Vector{Float64}: The position vector [x, y] in real space
Examples
lat = build_lattice(Square, 4, 4)
pos = get_position(lat, 5) # Get position of site 5Lattice2D.get_site_index — Function
get_site_index(lat::Lattice, x::Int, y::Int, s::Int=1)Get the linear site index from lattice coordinates (x, y) and sublattice index s. For single-sublattice lattices, s defaults to 1.
Arguments
lat::Lattice: The lattice structurex::Int: x-coordinate (1 to Lx)y::Int: y-coordinate (1 to Ly)s::Int: sublattice index (1 to number of sublattices), defaults to 1
Returns
Int: The linear site index
Examples
lat = build_lattice(Square, 4, 4)
idx = get_site_index(lat, 2, 3) # Get index at (2,3)
lat = build_lattice(Honeycomb, 4, 4)
idx_A = get_site_index(lat, 1, 1, 1) # Get sublattice A at (1,1)
idx_B = get_site_index(lat, 1, 1, 2) # Get sublattice B at (1,1)Lattice2D.get_unit_cell — Method
get_unit_cell(::Type{T}) where T <: AbstractTopologythis function returns the UnitCell associated with the given Topology type. If the Topology type is not recognized, it throws an error.