Skip to content

Geometry

Fully-resolved lattice geometry struct for one MPS simulation.

Geometry dataclass

Geometry(
    cfg: dict, ord_map: dict[tuple[int, ...], int], latt: list[tuple[int, ...]]
)

Fully-resolved lattice geometry for one MPS simulation.

Constructed by build_geometry from a raw [geometry] config dict. Passed to intrcmap_* builders and to traversal-aware utilities such as to_1d / to_2d.

Attributes:

Name Type Description
cfg dict

Original geometry config dict ([geometry] section from TOML). Contains all geometry parameters including lattice, traverse, lx, ly, boundary conditions, and bond-inclusion flags.

ord_map dict[tuple[int, ...], int]

Dict mapping coordinate tuples to 1D site indices (0-based). Key length depends on the lattice: (row, col) for chain/square, (row, col, u) for multi-sublattice lattices such as Kagome.

latt list[tuple[int, ...]]

List where latt[site] gives the coordinate tuple for that site. Element type matches the key type of ord_map.

Attributes

lattice property

lattice: str

Lattice-type key, e.g. 'chain' or 'square'.

traverse property

traverse: Optional[str]

Traversal-order key. None when not set.

lx property

lx: int

Number of columns (sites along x).

ly property

ly: int

Number of rows (sites along y); 1 for a 1D chain.

L property

L: int

Total number of MPS/MPO sites (length of the tensor network).

Equals len(latt), which is the authoritative site count for all lattice types. For single-sublattice lattices (chain, square) this coincides with lx * ly. For multi-sublattice lattices (e.g. Kagome with 3 sites per unit cell) it equals lx * ly * n_sub.

Functions

to_1d

to_1d(coord: tuple[int, ...]) -> int

Convert a lattice coordinate tuple to a 1D site index.

to_2d

to_2d(site: int) -> tuple[int, ...]

Convert a 1D site index to a lattice coordinate tuple.

See Also