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

Conversion between lattice position and serial number

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.

Lattices.FixedType.
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.

Lattices.boundaryFunction.
boundary(lattice) -> BoundaryCondition

Returns lattice's boundary condition.

Lattices.edgesFunction.
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.

Lattices.facesFunction.
faces(lattice) -> iterator

Returns an iterator of all faces.

Lattices.isperiodicFunction.
isperiodic(lattice) -> Bool

Check if this lattice's boundary condition is periodic.

Lattices.neighborsFunction.
neighbors(lattice, s; order=1) -> iterator

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

Lattices.sitesFunction.
sites(lattice) -> iterator

Returns an iterator for all sites on the lattice.

Lattices.surroundFunction.
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

Ref: https://nanohub.org/resources/7577/download/MartiniL5BoundaryConditions.pdf

Base.lengthMethod.
length(lattice) -> Int

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

Base.nameofMethod.
name(lattice) -> String

Returns the name of this lattice.

Base.ndimsMethod.
ndims(lattice) -> N

Returns number of dimensions of the lattice.

Base.sizeMethod.
size(lattice) -> Tuple

Returns the size of this lattice.

Lattices.fastmod1Method.
fastmod1(::Val{X}, ::Val{Y})

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