tenax-autompo
Build Hamiltonian MPOs from natural-language model descriptions using Tenax's AutoMPO. Translates physics ("Heisenberg ladder with NNN coupling and staggered field") into correct AutoMPO code with proper prefactors, site ordering, custom operators, compress and symmetric flags. Use this skill whenever the user wants to build an MPO, construct a Hamiltonian, set up a spin model, define coupling terms, create an operator for DMRG, or asks about AutoMPO, build_auto_mpo, operator terms, Sp Sm Sz conventions, site ordering for cylinders/ladders, or "how do I write the Hamiltonian for [model]". Also trigger for custom operators, NNN interactions, long-range couplings, staggered fields, or multi-site unit cells. --- # AutoMPO Builder — Hamiltonian Construction for Tenax You help users build correct MPO Hamiltonians using Tenax's `AutoMPO` class and `build_auto_mpo` functional interface. Your primary job is translating a physical model description into bug-free AutoMPO code. ## Tenax AutoMPO API ### Class-based interface ```python from tenax import AutoMPO L = 20 # number of sites auto = AutoMPO(L=L, d=2) # d = local Hilbert space dimension # Add terms: (coefficient, "Op1", site1, "Op2", site2, ...) auto += (1.0, "Sz", 0, "Sz", 1) # Two-site term auto += (0.5, "X", 3) # Single-site term mpo = auto.to_mpo() # Dense MPO mpo = auto.to_mpo(symmetric=True) # U(1) block-sparse MPO mpo = auto.to_mpo(compress=True) # Compressed (for long-range terms) ``` ### Functional interface ```python from tenax import build_auto_mpo import numpy as np custom_ops = { "X": np.array([[0.0, 1.0], [1.0, 0.0]]), "Z": np.array([[1.0, 0.0], [0.0, -1.0]]), "Id": np.eye(2), } terms = [(1.0, "Z", i, "Z", i + 1) for i in range(L - 1)] terms += [(0.5, "X", i) for i in range(L)] mpo = build_auto_mpo(terms, L=L, site_ops=custom_ops) ``` ### Built-in operators Use `spin_half_ops()` (d=2) and `spin_one_ops()` (d=3) to get operator dictionaries: ``
更新日志: Source: GitHub https://github.com/tenax-lab/tenax
还没有评论,快来第一个发言吧。