Introduction

# Welcome to the documentation of Lattice.jl

This is a Julia package for defining lattices in Julia.

All lattice type in this package is duck typed. Any Julia type with the (Geometric) Region/Lattice Interface can be considered as a (geometric) region/lattice.

## Interfaces

#### Site iterator

function: `sites`

#### Edge iterator

function: `edges`

#### Surround iterator (Optional)

function: `surround`

#### Face iterator (Optional)

function: `faces`

#### Neighbor sites iterator (Optional)

function `neighbors`

## Lattices

``BoundedLattice{N, BC} <: AbstractLattice{N}``

A lattice with boundary conditions `BC` on `N` dimension.

``Fixed <: BoundaryCondition``

Fixed boundary condition.

``HyperRect{N, Shape, BC} <: BoundedLattice{N, BC}``

Hyper Rectangle lattice on `N` dimension with size `Shape`.

``Periodic <: BoundaryCondition``

Periodic boundary condition.

``boundary(lattice) -> BoundaryCondition``

Returns lattice's boundary condition.

``edges(lattice; [order=1]) -> iterator``

Returns an iterator for all edges of the lattice of a given `order`. For example, `order = 1` means nearest neighbor edges and `order = 2` means next-nearest neighbors edges.

``faces(lattice) -> iterator``

Returns an iterator of all faces.

``isperiodic(lattice) -> Bool``

Check if this lattice's boundary condition is periodic.

``neighbors(lattice, s; order=1) -> iterator``

Returns an iterator of the surrounding sites of given site `s`.

``sites(lattice) -> iterator``

Returns an iterator for all sites on the lattice.

``surround(lattice) -> iterator``

Returns an iterator of surroundings of all sites.

``surround(lattice, site) -> iterator``

Returns an iterator of surrounding sites of given `site`.

``AbstractLattice{N}``

Abstract type for general lattices. `N` indicates the dimension. For a more concrete definition please refer the following material:

• Lattice (group): https://en.wikipedia.org/wiki/Lattice_(group)
• Lattice Model: https://en.wikipedia.org/wiki/Latticemodel(physics)
• Lattice Graph: https://en.wikipedia.org/wiki/Lattice_graph
``BoundaryCondition``

Boundary conditions for lattices. There usually has two:

``````- Fixed boundary
- Periodic boundary``````

``length(lattice) -> Int``

Returns the length of this lattice, or the production of each dimension size.

``name(lattice) -> String``

Returns the name of this lattice.

``ndims(lattice) -> N``

Returns number of dimensions of the lattice.

``size(lattice) -> Tuple``

Returns the size of this `lattice`.

``fastmod1(::Val{X}, ::Val{Y})``

`mod1` in compile time, 40x faster if the value can be determined