Skip to content

SNEG 2.2.0

Choose a tag to compare

@rokzitko rokzitko released this 27 Nov 19:25

SNEG 2.2.0: changes since SNEG 2.1.

SNEG is a Wolfram Language package for symbolic calculations with noncommuting second-quantization operators. This release adds support for momentum space, periodic lattices, and finite periodic clusters, extends the spin algebra with spin sizes, representations, exact diagonalization of spin clusters, Stevens operators, and Hubbard X-operators, adds Bogoliubov transformations and mean-field theory for quadratic Hamiltonians, derives effective Hamiltonians by the Schrieffer-Wolff transformation, and computes Green's functions from closed equations of motion.

New functionality

Momentum space and lattices

See README_momentum.md for worked examples.

  • sneglatticeindexes[{R, ...}, Ns] and snegmomentumindexes[{k, ...}, Ns] declare real summation indexes that label the unit cells and the crystal momenta of a periodic lattice with Ns cells. sneglatticevectors[a1, ...] declares lattice vectors used as displacements, e.g. c[R + a1].
  • sumSimplifyKD eliminates Kronecker deltas of linear combinations of declared lattice or momentum indexes, e.g. Sum_k delta(p, k + q) f(k) = f(p - q), and reduces delta(k, k + q) to delta(q, 0). Only coefficients of +-1 are solved; mixed lattice-momentum deltas and generic indexes keep the previous behavior.
  • Sums over declared indexes that do not appear in the summand evaluate to Ns.
  • blochphase[k, R] represents exp(i k.R). sumSimplifyKD performs the lattice sums Sum_R exp(i K.R) = Ns delta(K, 0) and Sum_k exp(i k.X) = Ns delta(X, 0). blochphaseexp converts the phases to exponentials for explicit vectors.
  • fourier[expr, c -> ck, R -> k] transforms fermionic and bosonic site operators to momentum operators with the convention c_R = Ns^(-1/2) Sum_k exp(i k.R) c_k, and back with "Inverse" -> True. Momentum conservation is applied automatically.
  • sumShift shifts summation variables, and sumMomentumCanonical canonicalizes momentum labels and dummy-index names so that equivalent sums can be collected. sumFullSimplify uses this canonicalization. Sums containing SEA-ordered operators are never shifted, because for linearized bands the shift is not a symmetry of the Fermi sea.
  • blochhamiltonian[H, {ck[a], ...}, k] returns the Bloch Hamiltonian matrix h(k) of a bilinear fermionic or bosonic Hamiltonian, checks translation invariance and hermiticity, and supports the orbital-position convention through "OrbitalPositions".

Finite periodic clusters

  • fourierrules[c -> ck, {L1, ...}] gives the explicit Fourier transformation on a finite cluster, with optional twisted boundary conditions ("Twist").
  • clusterhop[T, c[a], d[b], delta, {L1, ...}] constructs scalar or spin-matrix hopping on periodic or twisted clusters.
  • sumCluster[expr, {L1, ...}, rules] specializes symbolic lattice and momentum sums to an explicit periodic cluster, folding site and momentum labels and evaluating Kronecker deltas modulo the cluster size.
  • momentumbasis[bz, {L1, ...}] splits basis subspaces according to the total crystal momentum, which is appended to the quantum numbers.

Spin algebras and Hubbard X-operators

See README_spin.md for conventions and worked examples.

  • snegspinoperators[{S, s}] declares the spin size s (a half-integer or a symbol). Products of operators on the same site are reduced automatically to the unique normal form Sum p(S^z) (S^+-)^a, using the Casimir operator and, for numeric sizes, the finite dimension of the representation. Spin-1/2 products of Cartesian components follow the Pauli rule and stay Cartesian. Spins without a declared size keep the size-independent su(2) algebra.
  • spincomponents rewrites spin operators in terms of S^z, S^+- (default) or S^x, S^y, S^z. snegspincomponentindexes and levicivita support symbolic Cartesian components.
  • spinclustermatrices builds sparse matrices of spin Hamiltonians in the subspaces of total S^z. spinketbrarules maps spin operators to the bra-ket representation, and QSZaddspinket accepts several spins, so that spins coupled to fermions can be diagonalized with the existing basis functions.
  • jordanwigner, holsteinprimakoff (exact normal-ordered expansion truncated by the number of boson operators, symbolic spin size allowed), schwingerbosons, and abrikosov map spin operators to fermions and bosons. Together with fourier, blochhamiltonian, bdghamiltonian, and bogoliubov this gives linear spin-wave theory, also for antiferromagnets.
  • spintensor (spherical tensor operators), stevens (Stevens operators O_k^q), and rotatespin (site-dependent rotations of spin vectors).
  • snegxoperators declares Hubbard X-operators X^ab = |a><b| for local states with fermion parities, with the graded algebra; xoperator and xtofermions give the X-operators of the Hubbard atom in terms of fermions.

Quadratic forms, Bogoliubov transformations, and mean-field theory

See README_quadratic.md for conventions and worked examples.

  • quadraticform[H, modes] returns the BdG matrix M and constant E0 of a quadratic Hamiltonian, H = 1/2 Psi^dagger M Psi + E0 with Psi = (a, a^dagger), including anomalous and (for bosons, with "Linear" -> True) linear terms; "BdG" -> False returns the hopping matrix of number-conserving Hamiltonians. quadraticoperator is the inverse.
  • bdghamiltonian[H, {ck[a], ...}, k] returns the Bloch BdG matrix H(k) for Psi_k = (c_k, c_-k^dagger) and the constant E0.
  • bogoliubov diagonalizes fermionic (unitary) and bosonic (paraunitary, Colpa's method) BdG matrices, numerically or symbolically for blocks of at most two modes, and returns the quasiparticle energies, the transformation, and the ground-state energy. Fermionic zero modes are handled. "Momentum" -> True treats Bloch BdG matrices, whose particle-hole symmetry relates k and -k. bogoliubovrules rewrites expressions in quasiparticle operators.
  • gaussianaverage computes thermal and ground-state averages of arbitrary products of mode operators in the Gaussian state of a quadratic Hamiltonian with Wick's theorem, in real space and in momentum space.
  • meanfield decouples products of four or more operators in the Hartree, Fock, and pairing channels (or with a user-defined selection) into mean-field Hamiltonians with the averages avg[...]; meanfieldsolve solves the mean-field equations self-consistently on finite sets of modes, at finite temperature and at fixed particle number.

Schrieffer-Wolff transformation

See README_schriefferwolff.md for conventions and worked examples.

  • schriefferwolff[H0, V, P, n] returns the contributions of order 0, ..., n to the effective Hamiltonian P e^S H e^-S P of the canonical Schrieffer-Wolff transformation (anti-Hermitian, block-off-diagonal generator), to arbitrary order for finite sets of modes. H0 must be diagonal in the occupation numbers of the local modes; band energies, linear bosons, Zeeman terms, and atomic Hamiltonians in X-operators are allowed for the other operators, and momentum sums are supported. For lattice sums, the projector can be given as a local rule (up to second order). Examples: Anderson to Kondo model, Hubbard to Heisenberg and t-J models, fourth-order exchange.
  • eigenoperators[O, H0] splits an operator into eigenoperators of H0.
  • schriefferwolffmatrix performs the canonical transformation for matrices.
  • fermionstox (inverse of xtofermions) and xtospin convert projected results to X-operators and spin operators.

Equations of motion, Green's functions, and sum rules

See README_greens.md for conventions and worked examples.

  • liouvillian[A, H, n] returns the iterated commutators [...[A, H], ..., H], also with symbolic sums.
  • spectralmoments[A, B, H, n] returns the moments (sum rules) of the spectral function of the retarded Green's function <<A; B>>, with the anticommutator for fermion-odd A and the commutator otherwise.
  • eomclosure[A, H] generates the closed set of operators of the equations of motion and the matrix of [O_i, H]; greensfunction[A, B, H, z] solves the closed equations with symbolic averages avg[...] or a given averaging function.
  • thermalaverage and lehmann give exact thermal averages and the Lehmann representation of finite fermion systems.

Documentation

  • Help pages integrated in the Wolfram Documentation Center (Mathematica 14 or newer): reference pages with details, caveats, developer notes, and evaluated examples, and the guide page paclet:SNEG/guide/SNEG. In notebooks, the startup message links to the guide page when the help pages are installed.
  • The help pages are generated from Markdown sources in doc/src (doc/build-docs.wl); the example outputs are cached in doc/cache and verified by doc/test-docs.m. See doc/README.md.
  • The stand-alone LaTeX manual combines a tutorial, worked solid-state models, an illustrated Hubbard-dimer calculation, a grouped function reference, exercises and solutions. Build it with wolframscript -file doc/manual/build-manual.wl. The downloadable chapter notebooks in doc/notebooks use the same evaluated examples as the manual. The documentation and teaching material are licensed under CC BY 4.0.
  • Usage messages no longer contain the "More..." buttons of the former help browser.

LaTeX output

  • snegtex[expr] returns a LaTeX string in physics notation, e.g. c^\dagger_{1\uparrow} c_{2\uparrow}, S^+_1, \sum_k ..., for expressions with fermion, boson, spin, Majorana, and X-operators.

Matrix-valued hopping (released in 2.1.1)

  • matrixhop[T, a[i], b[j]] constructs the spin-dependent hopping a^dagger T b + h.c. for a dense or sparse 2 by 2 matrix T, with Pauli decomposition of symbolic matrices (including MatrixExp results). See README_matrixhop.md.

Behavior changes

  • Internal helper functions and the names of local and pattern variables moved from Sneg` to Sneg`Private`. Names such as s, u, k, states, or energy in user code therefore no longer trigger shadowing warnings or attach definitions to package symbols. All documented functions, the developer interface (ordering, cmt, acmt, isnumericQ, operatorQ, operator lists, constants such as EMPTY, SEA, NONE, BASIS), and the undocumented functions used in existing notebooks and in NRG Ljubljana (e.g. qbasis, genhop, hopphi, bcs, der, projectorE, transformtoLRvc, quickDBL) remain public. Code that called other internal helpers must use the qualified name, e.g. Sneg`Private`snegswdummies.
  • Summation indexes created by automatic renaming (for example k1 when two sums over k are multiplied) now inherit the realness (Conjugate[k] = k) and the lattice or momentum declaration of the original index.
  • Spin operators commute with all other operators and are now moved to the left of bosons, Majorana and Dirac fermions in products; operators of different spin symbols are sorted. Mixed expressions are therefore printed in a different order, and identities such as the conservation laws of the Kondo model with an abstract impurity spin now reduce to zero.
  • conj is defined for spin operators ((S^+)^dagger = S^-).
  • blochhamiltonian returns $Failed with a message for Hamiltonians with anomalous or linear terms, which were previously dropped silently from h(k).

Fixes

  • Contractions check the ordering convention of both operators.
  • Contractions between independent operator families with NONE ordering vanish, respecting a custom fermionic anticommutator.
  • Fixed iterator capture in sumAbstractIndex, sumNameIndex, and snegold2newrules.
  • vevwick2 handles single operators.
  • Matrix blocks that vanish only in floating-point arithmetic are filtered out in makeallmatricesbzop and makeallmatricesbzvc.
  • SU2combine applies the spin-projection selection rule, avoiding messages for nonphysical Clebsch-Gordan arguments.
  • Coefficients built from declared real or complex functions, e.g. 1 + ε[k] or -ε[k] after snegrealfunctions[ε], are now recognized as numbers by isnumericQ, so that nc factors them out of operator products.

Testing

  • The regression scripts return a nonzero exit status on failure. Missing expected values, evaluation messages, aborts, and timeouts count as failures.
  • Expanded regression coverage with independent finite-space checks of bases, matrices, symmetry transformations, and Wick contractions.
  • New regression groups for momentum-space deltas and lattice sums, Fourier transformations and Bloch Hamiltonians (chain, SSH, graphene, Rashba chain, bosons), momentum shifts, and finite clusters. The finite-cluster tests compare real-space and momentum-space spectra of the four-site Hubbard ring.
  • New regression groups for spin algebras: normal forms checked against spin matrices for s = 1/2 to 5/2, Kondo conservation laws, Heisenberg ring, bra-ket and direct matrices, Jordan-Wigner XXZ spectra, magnon dispersions, Stevens-operator tables, rotations, and the X-operator algebra against its fermion representation (t-J dimer).
  • New regression groups for quadratic forms: many-body spectra and thermal and ground-state averages of random BdG Hamiltonians compared with exact diagonalization, bosonic averages compared with truncated Fock spaces, Kitaev-chain zero modes and Bloch spectra, BCS coherence factors, antiferromagnetic magnons, the Wick consistency of mean-field Hamiltonians, the Hartree-Fock solutions of the Hubbard dimer, and the BCS gap equation on a ring.
  • New regression groups for the Schrieffer-Wolff transformation: exchange of the Hubbard dimer to fourth order against the exact solution, operator against matrix transformations, the fifth-order remainder of the block-off-diagonal part, the Kondo coupling of the Anderson model with momentum sums against a discrete bath, the Heisenberg and t-J models on a lattice against explicit clusters, and the convergence of three-site t-J spectra. examples/schriefferwolff-plaquette.m checks the fourth-order plaquette against exact diagonalization.
  • Tests of the public and private contexts, and of snegtex.
  • doc/test-docs.m re-evaluates examples for the help pages and LaTeX chapters and compares them with the cached outputs.
  • New regression group for equations of motion: the Hubbard atom, the resonant level, spins and bosons, and the closed equations of the interacting Hubbard dimer against the Lehmann representation and its moments at zero and finite temperature.

Distribution

The release contains versioned SNEG-2.2.0.paclet and stable SNEG.paclet assets.

PacletInstall[
  "https://github.com/rokzitko/sneg/releases/latest/download/SNEG.paclet"
]

Links