API Reference

Lincege.Lincege — Module

A julia package for computing LINked Cluster Expansions on a GEneral GEometry (Lincege).

The general pipeline is:

  1. Define a unit cell and lattice geometry.
  2. Generate all unique clusters up to a desired order using a cluster set and hasher.
  3. Build an Expansion from those clusters.
  4. Call summation! to populate the NLCE weights.
  5. Export results with write_to_json.

See the online documentation for worked examples on the square lattice, Kagome lattice, and Pyrochlore unit cell.

source
Lincege.AbstractCluster — Type
AbstractCluster

Abstract base type for a single cluster - a connected subgraph of the lattice with an associated lattice coefficient used in the NLCE summation.

Subtypes must implement:

  • Base.length(c) - number of sites (vertices) in the cluster
  • Base.hash(c, h) - the cluster's graph hash (ghash)
  • lattice_constant - the cluster's lattice constant
source
Lincege.AbstractClusterExpansionLattice — Type
AbstractClusterExpansionLattice <: AbstractInfiniteLattice

Abstract base type for lattices where each expansion vertex represents a cluster of physical sites (a unit cell), rather than a single site.

Subtypes must implement all methods of AbstractInfiniteLattice, plus:

  • n_site_colors(lattice) - number of distinct site colors in the lattice
  • connections(lattice) - mapping from expansion vertices to their constituent lattice vertices
source
Lincege.AbstractClusterSet — Type
AbstractClusterSet{C<:AbstractCluster, H<:AbstractHasher}

Abstract base type for a collection of unique clusters sharing a common hasher. Clusters that are equivalent under the hasher's symmetry are merged

Subtypes must implement:

  • Base.length(cluster_set) - number of stored clusters
  • Base.in(c, cluster_set) - membership test
  • Base.iterate(cluster_set) / Base.iterate(cluster_set, state) - iteration over clusters
  • Base.push!(cluster_set, c) - add a cluster
  • Base.pop!(cluster_set, c) - remove and return a cluster
  • Base.get(cluster_set, ghash, default) - look up a stored cluster by its graph hash
  • ghash(cluster_set, c) / ghash(cluster_set, vertices) - delegate to the hasher
source
Lincege.AbstractExpansion — Type
AbstractExpansion

Abstract base type for an NLCE expansion. Stores the subgraph relationships between clusters and the weight matrix that summation! populates.

Subtypes must implement:

  • Base.getindex(e, cluster_hash) - get the cluster corresponding to the cluster_hash
  • each_order(e, max_order) - vector of clusters at each order up till max_order
source
Lincege.AbstractExpansionCluster — Type
AbstractExpansionCluster

Abstract base type for an expansion cluster. Stores the subgraph information for a cluster, along with necessary information to write the cluster to disk.

Subtypes must implement:

  • subgraphs(cluster) - subgraph hashes of each subgraph within the cluster
  • subtract_subcluster!(cluster, subcluster) - subtract the weight (W_p(c)) of the given subcluster from the corresponding cluster
source
Lincege.AbstractFiniteClusterExpansionLattice — Type
AbstractFiniteClusterExpansionLattice <: AbstractFiniteLattice

Abstract base type for finite lattices where each expansion vertex represents a cluster of physical sites rather than a single site.

Subtypes must implement all methods of AbstractFiniteLattice, plus:

  • n_site_colors(lattice) - number of distinct site colors in the lattice
  • connections(lattice) - mapping from expansion vertices to their constituent lattice vertices
source
Lincege.AbstractFiniteLattice — Type
AbstractFiniteLattice <: AbstractLattice

Abstract base type for a finite lattice used to enumerate clusters.

Subtypes must implement all methods of AbstractLattice, plus:

  • n_unique_sites(lattice) - total number of physical sites in the lattice
source
Lincege.AbstractHasher — Type
AbstractHasher

Abstract base type for cluster hashing. A hasher maps a vertex set to a graph hash, with two vertex sets receiving the same hash if and only if they are equivalent under the symmetry the hasher preserves.

Subtypes must implement:

  • ghash(hasher, vertices::LatticeVertices) - hash for a Site Expansions
  • ghash(hasher, vertices::ExpansionVertices) - hash for a Cluster Expansion
source
Lincege.AbstractInfiniteLattice — Type
AbstractInfiniteLattice <: AbstractLattice

Abstract base type for an infinite lattice used to enumerate clusters.

Subtypes must implement all methods of AbstractLattice, plus:

  • n_unique_sites(lattice) - number of translationally-inequivalent sites in the lattice
source
Lincege.AbstractLattice — Type
AbstractLattice

Abstract base type for a lattice geometry.

Subtypes must implement:

  • centers(lattice) - vertex set(s) used as DFS roots when generating clusters
  • max_order(lattice) - maximum cluster order (number of sites) to generate
  • neighbors(lattice, vertices) - vertex indices adjacent to the vertex set vertices but not in it
  • get_coordinates(lattice) - Cartesian coordinate matrix (dim x n_sites)
  • get_labels(lattice) - translation labels for each site
  • get_site_colors(lattice) - site colors for each site
  • bond_matrix(lattice) - integer adjacency matrix encoding bond types
source
Lincege.AbstractPhysicsSolver — Type
AbstractPhysicsSolver

Abstract base type for calculating the physical observables of a single cluster. This serves as a reference implementation of the NLCE algorithm and a test set to ensure that the clusters are generated correctly.

Subtypes must implement:

  • eigenvalues() - eigenvalues of the cluster with respect to the model
  • eigenvectors() - eigenvectors of the cluster with respect to the model
  • cluster_weights() - NLCE weights of the cluster generated by Lincege.jl
source
Lincege.AbstractVertices — Type
AbstractVertices{V}

Abstract base type for a set of vertices of element type V.

Subtypes must implement:

  • vertices(vertex_set) - return the underlying iterable of vertex indices
  • Base.collect(vertex_set) - return a sorted Vector{V}
  • Base.sort(vertex_set) - return a sorted copy
  • Base.intersect(vertex_set1, vertex_set2) - set intersection
  • Base.setdiff(vertex_set1, vertex_set2) - set difference
  • Base.union(vertex_set1, vertex_set2) - set union (two-argument form)
  • Base.in(v, vertex_set) - membership test
  • Base.eltype(vertex_set) - element type V
source
Lincege.Bond — Type
Bond(site1, site2, direction, bond_type)

Bond of given type between two sites along the given direction, in primitive lattice vector notation

source
Lincege.Expansion — Type
Expansion(clusters, lattice, max_order)

Arbitrary expansion of clusters in the NLCE sense, contains the weights necessary to perform the NLCE summation.

source
Lincege.ExpansionBond — Type
ExpansionBond(site1, site2, direction, bond_type)

Bond of given type between two sites inside of the expansion basis, indexed [expansion basis, element number] along the given direction, in primitive lattice vector notation

source
Lincege.ExpansionCluster — Type
ExpansionCluster(cluster, lattice)

Cluster from a set of clusters that contains information necessary for summation! and writing to disk.

source
Lincege.ExpansionUnitCell — Type
ExpansionUnitCell(basis, primitive_vectors, site_colors, bonds, expansion_bonds)

Unit cell containing the given information, generally to be used for a cluster expansion. The bonds are between sites in the basis, and the expansion bonds are between the unit cells in the expansion. Coordinates are written [x1 x2 x3 ...; y1 y2 y3 ...; z1 z2 z3 ...;].

source
Lincege.ExpansionVertices — Type
ExpansionVertices{V}

A set of expansion-lattice vertices (TaggedVertices tagged :expansion), indexing sites of a cluster-expansion lattice's expansion unit cell.

source
Lincege.FiniteLattice — Type
FiniteLattice(dims, unit_cell, max_order; periodic=false)
FiniteLattice(dim_specs, unit_cell, max_order; periodic_dims=fill(false, N))
FiniteLattice(uc_positions, unit_cell, max_order; supercell_vecs=nothing)

A finite lattice built from unit_cell for a site expansion.

Boundary conditions:

  • periodic=true gives full periodic boundary conditions based on the primitive lattice vectors
  • The dim_specs
  • The uc_positions constructor builds a lattice from an explicit list of unit-cell positions, supercell_vecs is then needed to be able to determine periodicity along the given axes in primitive lattice coordinates.
source
Lincege.FiniteStrongClusterExpansionLattice — Type
FiniteStrongClusterExpansionLattice(dims, expansion_unit_cell, max_order; periodic_dims=fill(false, N))

A finite lattice for a strong-embedding cluster expansion of size dims unit cells. Each expansion vertex is a cluster (unit cell) of physical sites.

Pass periodic_dims to choose which dimensions use periodic boundary conditions; by default all boundaries are open.

source
Lincege.FiniteWeakClusterExpansionLattice — Type
FiniteWeakClusterExpansionLattice(dims, expansion_unit_cell, max_order; periodic_dims=fill(false, N))

A finite lattice for a weak-embedding cluster expansion of size dims unit cells. Each expansion vertex is a cluster of physical sites.

Pass periodic_dims to choose which dimensions use periodic boundary conditions; by default all boundaries are open.

source
Lincege.ImportedCluster — Type
ImportedCluster

A single cluster deserialized from a JSON file produced by write_to_json. To be used in subsequent physics algorithms

source
Lincege.IsingSolver — Type
IsingSolver <: AbstractPhysicsSolver

Concrete implementation of a physics solver for the Ising model.

source
Lincege.IsomorphicHasher — Type
IsomorphicHasher(lattice)

Hasher that identifies clusters equivalent under graph isomorphism, using Nauty for canonicalization.

source
Lincege.LatticeVertices — Type
LatticeVertices{V}

A set of lattice vertices (TaggedVertices tagged :lattice), indexing physical sites of a lattice.

source
Lincege.NLCEResult — Type
NLCEResult

Stores the results of an NLCE computation, can be plotted by accessing temperatures and the corresponding observable.

source
Lincege.NotImplementedError — Type
NotImplementedError{M}(m)

Exception thrown when a method required for a NLCE is not implemented. Taken directly from Graphs.jl.

source
Lincege.SiteExpansionLattice — Type
SiteExpansionLattice(max_order, unit_cell)

An infinite lattice that contains the information necessary to perform the site expansion utilizing the given unit_cell

source
Lincege.SymmetricHasher — Type
SymmetricHasher(lattice, lattice_symmetries)

Hasher that identifies clusters equivalent under the lattice's point-group symmetries.

source
Lincege.UnitCell — Type
UnitCell(basis, primitive_vectors, bonds, site_colors)

Unit cell containing the given information, generally to be used for a site expansion. Coordinates are written [x1 x2 x3 ...; y1 y2 y3 ...; z1 z2 z3 ...;].

source
Lincege.ConnectedClusterSet — Method
ConnectedClusterSet(lattice)

ClusterSet constructor that initializes a ClusterSet with a hasher that treats each distinct set of vertices as unique.

source
Lincege.IsomorphicClusterSet — Method
IsomorphicClusterSet(lattice)

ClusterSet constructor that initializes a ClusterSet with a hasher that preserves invariance under graph isomorphisms

source
Lincege.SymmetricClusterSet — Method
SymmetricClusterSet(lattice, symmetries)

ClusterSet constructor that initializes a ClusterSet with a hasher that preserves invariance under the given point group symmetries of the lattice.

source
Lincege.TranslationClusterSet — Method
TranslationClusterSet(lattice)

ClusterSet constructor that initializes a ClusterSet with a hasher that preserves translational invariance

source
Lincege.apply_resummations — Method
apply_resummations(result, resummations)

Applies resummations to a given NLCEResult in order of the given resummation vector. The vector is of the form [(:Euler, 3), (:Wynn, 4), ...] which translates to euler summation starting at order 3, and wynn's resummation with 4 cycles of improvement.

source
Lincege.cluster_weights — Method
cluster_weights(solver::AbstractPhysicsSolver)

Return the NLCE weights of the solver's cluster as generated by Lincege.jl.

source
Lincege.clusters_from_lattice! — Method
clusters_from_lattice!(clusters, lattice; spawn_depth=3)

Generates all clusters from an infinite lattice up till the given max_order, populates clusters with all the corresponding clusters reduced by the hashing function

source
Lincege.eigenvalues — Method
eigenvalues(solver::AbstractPhysicsSolver)

Return the energy eigenvalues of the solver's cluster Hamiltonian.

source
Lincege.eigenvectors — Method
eigenvectors(solver::AbstractPhysicsSolver)

Return the eigenvectors of the solver's cluster Hamiltonian.

source
Lincege.euler_resummation — Function
euler_resummation(result, sum_start)

Performs euler's resummation technique for alternating series to an NLCE result. sumstart is the order index at which the Euler sum begins; the early orders (below sumstart) are left as bare sums.

source
Lincege.image_lattice — Function
image_lattice(unit_cell; cells=nothing)
image_lattice(expansion_unit_cell; cells=-2:2, show_expansion_bonds=false)

Return a Plots object showing a repeated lattice in two or three dimensions. Load Plots and ColorSchemes first. cells supplies the integer translations along each primitive vector; cells=0:1 repeats two cells per direction. Ordinary UnitCell plots default to -6:6 in 2D and -2:2 in 3D. ExpansionUnitCell plots default to -2:2 in both dimensions.

For expansion cells, show_expansion_bonds=true adds dashed connections between element centers. Physical bonds retain their types, shared sites retain their colors, and coincident sites and duplicate physical bonds are drawn once as in image_unit_cell. Outgoing physical bonds include neighboring endpoints. The returned object can be saved with Plots.savefig.

source
Lincege.image_unit_cell — Function
image_unit_cell(unit_cell)
image_unit_cell(expansion_unit_cell; show_expansion_bonds=false)

Return a Plots object showing the sites, physical bonds, and unlabeled primitive cell boundary in two or three dimensions. Load Plots and ColorSchemes first.

For an ExpansionUnitCell, enable show_expansion_bonds to draw dashed connections between expansion-element centers. Coincident sites with the same color and duplicate physical bonds of the same type are drawn once, matching coordinates rounded to ten decimal places. Neighboring physical bond endpoints are also marked as sites in expansion-cell plots.

source
Lincege.import_from_json — Method
import_from_json(filepath) -> Vector{ImportedCluster}

Read a JSON file produced by write_to_json and return a vector of ImportedCluster, one per cluster entry in the file.

source
Lincege.import_from_json_by_order — Method
import_from_json_by_order(filepath) -> Vector{Vector{ImportedCluster}}

Like import_from_json, but returns clusters grouped by order. The returned vector is indexed by order: result[order] holds all clusters of that order.

source
Lincege.observables — Method
observables(solver::AbstractPhysicsSolver, betas)

Compute the thermodynamic observables of the solver's cluster at each inverse temperature in betas, returned as a NamedTuple of vectors (energy, specific_heat, entropy).

source
Lincege.perform_nlce — Method
perform_nlce(solvers, temperatures) -> NLCEResult

Calls the given NLCE solvers and computes their corresponding observables.

source
Lincege.print_ascii_table — Method
print_ascii_table([io], expansion, cluster_sets, max_order)

Prints an ASCII table akin to those found in scientific papers that utilize NLCE.

source
Lincege.print_html_table — Method
print_html_table([io], expansion, cluster_sets, max_order)

Prints an HTML table akin to those found in scientific papers that utilize NLCE.

source
Lincege.print_latex_table — Method
print_latex_table([io], expansion, cluster_sets, max_order)

Prints a LaTeX table akin to those found in scientific papers that utilize NLCE.

source
Lincege.reduce_clusters! — Method
reduce_clusters!(new_clusters, old_clusters)

Populate new_clusters by grouping clusters in old_clusters using the destination hasher and summing the lattice constants of equivalent clusters. Return new_clusters.

source
Lincege.summation! — Method
summation!(expansion, max_order)

Performs the recursive NLCE summation up till the max_order and populates the given expansion with the resultant weights

source
Lincege.weights — Method
weights(e::Expansion, order::Int) -> Dict{UInt, Float64}

Return the NLCE weights at the given order for all clusters. Call summation! first to populate the underlying weights.

source
Lincege.write_to_json — Method
write_to_json(expansion, lattice, filepath)

Serialize an Expansion and its associated lattice geometry to a JSON file at filepath.

  • cluster_hash - unique cluster identifier (string representation of UInt64)
  • order - 1-based order index into the expansion's order_ids
  • n_sites - number of sites in the cluster
  • coordinates - list of Cartesian coordinate vectors (one per site)
  • site_colors - list of integer site-color labels (one per site)
  • bonds - edge list [i, j, weight] using local 1-based indices
  • weights - vector of weights per order for the cluster
source
Lincege.write_to_json — Method
write_to_json(iso_expansion, iso_set, sym_expansion, sym_set,  lattice, filepath)

Serialize an Expansion and its associated lattice geometry to a JSON file at filepath. The file contains a similar output to the original writetojson function, but with the addition of relating multiple symmetrically distinct clusters to their isomorphic equivalent.

source
Lincege.write_to_txt_file — Method
write_to_txt_file(expansion, lattice, filepath)

Write the same cluster data as write_to_json in a colon-separated text format, with one line per cluster:

n_sites : cluster_hash : bonds : coordinates : site_colors : weights : order

source
Lincege.write_to_txt_file — Method
write_to_txt_file(iso_expansion, iso_set, sym_expansion, sym_set, lattice, filepath)

Write all fields of the joint write_to_json export as colon-separated records:

isomorphic : n_sites : cluster_hash : canonical_bonds : canonical_site_colors : weights : order

symmetric : isomorphic_hash : cluster_hash : permuted_coordinates : weights

source
Lincege.wynn_resummation — Function
wynn_resummation(result, n_cycles)

Performs wynn's resummation technique based on pade approximants to an NLCE result. The number of cycles of improvement should generally be maximized, this is the default.

source