Square Lattice

This example computes the linked cluster expansion on a square lattice up to order 3.

Setup

Define the unit cell with basis positions, primitive vectors, and nearest-neighbour bonds:

using Lincege

square_basis = [[0.0, 0.0]]
square_pvecs = [[1.0, 0.0], [0.0, 1.0]]
square_bonds = [Bond(1, 1, [1, 0], 1), Bond(1, 1, [0, 1], 1)]
square_uc = UnitCell(square_basis, square_pvecs, square_bonds, [1])
UnitCell([0.0; 0.0;;], [1.0 0.0; 0.0 1.0], [1], Bond[Bond(1, 1, [1, 0], 1), Bond(1, 1, [0, 1], 1)])

Building the lattice and clusters

m_order = 3
lattice = SiteExpansionLattice(m_order, square_uc)

trans_clusters = TranslationClusterSet(lattice)
clusters_from_lattice!(trans_clusters, lattice)

iso_clusters = IsomorphicClusterSet(lattice)
clusters_from_clusters!(iso_clusters, trans_clusters)
ClusterSet{IsomorphicHasher} with 3 clusters

Computing the expansion

expansion = Expansion(iso_clusters, lattice, m_order)
summation!(expansion, m_order)
expansion.weights
3×3 Matrix{Float64}:
 1.0  -4.0    6.0
 0.0   2.0  -12.0
 0.0   0.0    6.0

Writing to JSON

write_to_json(expansion, lattice, iso_clusters, "square_lattice.json")