Site type API
See Site types and layouts for the narrative version and Site types and spin models for the physics.
Abstract type and interface
LatticeCore.AbstractSiteType — Type
AbstractSiteTypeAbstract supertype for site types — value-level descriptors of the physical degree of freedom living on a lattice site.
Concrete subtypes are deliberately lightweight (typically singletons or thin parametric singletons) so they can be embedded in lattice structs and used as a dispatch key by MC models.
Required interface
state_type(st)::Type— the Julia type used to store a staterandom_state(rng, st)— sample a uniformly random state
Optional interface
zero_state(st)— a canonical zero state (if defined)domain(st)— iterable over the state space (for small discrete site types)element_type(st)::AbstractLatticeElement— which geometric element the DOF lives on. Defaults toVertexCenter. Override for bond / plaquette-centered variables such as dimer or gauge fields.
See dev/note/04_architecture/04_site_type/README.md.
LatticeCore.state_type — Function
state_type(st::AbstractSiteType) → TypeJulia type used to store a state of site type st.
LatticeCore.random_state — Function
random_state(rng, st::AbstractSiteType)Sample a uniformly random state on site type st.
LatticeCore.zero_state — Function
zero_state(st::AbstractSiteType)Canonical zero state (e.g. 0 for Ising, 0.0 for XY). Not all site types have to define this.
LatticeCore.domain — Function
domain(st::AbstractSiteType)Iterable over the state space. Only meaningful for small discrete site types (Ising, Potts); continuous types leave this unimplemented.
LatticeCore.element_type — Function
element_type(st::AbstractSiteType) → AbstractLatticeElementWhich geometric element the DOF lives on. Defaults to VertexCenter. Override for bond / plaquette / cell-centered site types.
Built-in site types
LatticeCore.IsingSite — Type
IsingSite{T <: Integer}()Ising spin: state is ±1 stored as T (default Int8).
LatticeCore.PottsSite — Type
PottsSite{Q, T <: Integer}()Q-state Potts spin: state is an integer in 1..Q stored as T.
LatticeCore.XYSite — Type
XYSite{T <: AbstractFloat}()Planar rotor: state is an angle θ ∈ [0, 2π) stored as T (default Float64).
LatticeCore.HeisenbergSite — Type
HeisenbergSite{T <: AbstractFloat}()Classical Heisenberg spin: state is a unit vector in ℝ³ stored as SVector{3, T} (default Float64).
LatticeCore.EmptySite — Type
EmptySite()Vacancy / empty site: stores nothing. Useful for diluted models and as a placeholder where a site has no degrees of freedom.