Installation and quick start¶
Requirements¶
LatticeGeom supports Python 3.10 and newer. The core runtime depends only on NumPy.
python -m pip install latticegeom
Optional extras are independent: latticegeom[plot] installs Matplotlib and
latticegeom[bz] installs SciPy for two-dimensional first-BZ geometry.
For development:
python -m pip install -e ".[test,plot,bz,docs]"
python -m pytest -q
Construct a lattice¶
from latticegeom import triangular
lat = triangular((6, 4), pbc=(True, False))
print(lat)
print(lat.positions.shape)
print(lat.bonds.pairs.shape)
extent contains one positive integer per primitive direction. pbc may be one
boolean for all directions or a matching boolean sequence for mixed boundaries.
Inspect compiled arrays¶
print(lat.n_cells, lat.n_sites, lat.n_bonds, lat.n_plaquettes)
nearest = lat.bonds.indices(type="a1")
crossing = lat.bonds.indices(crossing=True)
vectors = lat.bond_vectors()
Compiled arrays are read-only. Treat a Lattice as a stable geometry value and build
mutable model arrays separately.
Next steps¶
Read Core concepts before declaring custom geometry. The Geometry guide covers predefined lattices, custom unit cells, queries, composition, and integer supercell transformations.