Skip to main content

Manipulate quantum many-body operators

Project description

Opyrators

Opyrators is a lightweight python package that represents many-body fermion- and spin-operators as strings.

For example, the fermionic string "012003" stands for a 6-site operator formed by a creation operator on site 2, an annihilation operator on site 3, a density operator on site 6 and identity operators on the rest. See the encodings below.

In this representation, operator manipulations such as addition and multiplication are easily implemented. Super useful if you want to quickly compute commutators (and/or use this for research projects). See the example below.

Installation

pip install opyrators

Example

Here is a quick example showing some of the basic features of fermionic opyrators.

# Import the fermion operators.
from fermions import operator

# The operator takes a dictionary as input, with its key-value pairs being
# the operator string and its coefficient.
A = operator({"112233":1.3})
B = operator({"221133":0.34})
C = A * B - B * A

# The output of the print operation shows that this complex
# operator consists of 6 terms, but is fully diagonal.
print(C)
# Term 0: 330033 0.442
# Term 1: 330333 -0.442
# Term 2: 333033 -0.442
# Term 3: 003333 -0.442
# Term 4: 033333 0.442
# Term 5: 303333 0.442

# As another example, here is an operator describing the hopping terms on a
# 3-site periodic lattice.
J = operator({"120":1, "012":1, "201":1})
J = J + J.conj()

Encodings

Fermions

For particles, the encoding works as follows:

  • 0 = Identity operator
  • 1 = Creation operator
  • 2 = Annihilation operator
  • 3 = Density operator

Spins

For spin-1/2 operators, the encoding works as follows:

  • 0 = Identity operator
  • 1 = Pauli-X operator
  • 2 = Pauli-Y operator
  • 3 = Pauli-Z operator

An operator with X on site 2, Y on site 4 and Z on site 5, in a system of 8 sites, hence would be "01023000".

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opyrators-1.0.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

opyrators-1.0.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file opyrators-1.0.0.tar.gz.

File metadata

  • Download URL: opyrators-1.0.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0.post20200308 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for opyrators-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f292413c7c1994405ac8046e2c461aa9dd870ddd4dcc28396514b8fcca81124e
MD5 b30a2716fe54409afbb82280e7f0429d
BLAKE2b-256 6e741b7763423c3a50d6a4bcafaebc7de3136ad3a781bb22a52521227b05df7d

See more details on using hashes here.

File details

Details for the file opyrators-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: opyrators-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0.post20200308 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for opyrators-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f8d7348dbd99aba0dff67cadb988b6b6b1eac57d7d458a9bc9f3863a8b5a9a6
MD5 8fb162e073aa358ade6121016804b6f2
BLAKE2b-256 440e5c65704f5740f90874c7cf2ce3a3581d54f288a743784b1ecad246d9700f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page