Quick links: Back to Rok Zitko's home page "NRG Ljubljana" page

SNEG library

SNEG library is a Mathematica package that provides a framework for performing calculations using the operators of the second quantization with an emphasis on the anti-commuting fermionic operators in the context of solid-state and atomic physics. It consists of a collection of transformation rules that define the algebra of operators and a comprehensive library of utility functions. SNEG library is the foundation of the NRG Ljubljana package, however it can also be used as a stand-alone package.

The cornerstone of SNEG is a definition of non-commutative multiplication with automatic reordering of operators in a standard form (usually the conventional normal ordering with creation operators preceding the annihilation operators), which takes into account selected (anti)commutation rules. Standard form reordering allows simplifications of expressions and the choice of normal ordering permits efficient evaluation of matrix elements in a given basis.

The library makes otherwise tedious calculations a routine operation. Especially, it prevents inauspicious sign errors when commuting fermionic operators.


Note: you need to have Mathematica or Mathematica Player installed in order to view the following examples.
Additional examples can be found in the Further examples sections of the Help notebooks for SNEG functions. See also Quick start manual in the form of Mathematica notebook.




The SNEG library is useful beyond the NRG calculations. It has been applied to perform exact diagonalizations on Hubbard clusters, perturbation theory to higher orders and calculation of commutators of complex operator expressions. It should also be suitable for educational purposes, since it simplifies tedious calculations with second-quantization operators, much like Mathematica eased learning calculus. A number of examples is included in the SNEG library distribution; they can easily be extended to non-trivial calculations.


Download current stable version 1.250 (includes the SNEG package, the manual and a set of Mathematica notebooks with examples)
Library (Mathematica code only, version 1.250)

Installation: On macOS, copy the archive contents to

in your home directory. On Linux, copy the archive contents to
in your home directory. The minimal installation consists of copying just the library file (sneg.m) to this directory. The documentation is optional.

Please cite R. Zitko, Comp. Phys. Comm. 182 2259, (2011) if you make extensive use of SNEG in your research.

Older releases

SNEG version 1.234 (Sep 2013)

SNEG version 1.232 (Nov 2012)

SNEG version 1.228 (March 2011)

SNEG version 1.191 (April 2008)

SNEG version 1.168 (January 2007)

SNEG version 1.76 (November 2006)

Last modified: 17.2.2019 Request more information Rok Zitko's home page