Skip to main content

Lattice QED Hamiltonian for Quantum Computing

Project description

DOI

Lattice QED Hamiltonian for Quantum Computing

This repository contains useful Python functions and classes for seamlessly designing and obtaining Quantum Electrodynamic (QED) Hamiltonians for 1D, 2D or 3D lattices with staggered fermionic degrees of freedom, i.e., Kogut and Susskind formulation[^1].

The implementation is useful for carrying out research on QED quantum simulation assisted by quantum computing and quantum algorithms, as well as for analysis and comparison with known exact-diagonalization (ED) methods. In turn, the classes in this module are compatible with exact diagonalization libraries and the Qiskit library.

Related work:

Installation

This source code is now available at PyPI as a package for quick installation and usage. One can simply pip install it with the command below:

pip install qclatticeh

Note: if you are not using a python environment (recommended), you may need to use the pip3 command instead of pip in MacOS and Linux.

Manual Installation through Github

It may be useful to some researchers to adapt the current package to their own models. In that case, a manual installation may be easier for making changes in the hamiltonian formulation.

Clone

The first step is to download the latest stable release of this package below and unzip de file.

Latest Release

Altenatively, you can clone this repo for development builds:

git clone https://github.com/ariannacrippa/QC_lattice_H.git

Virtual Environment

Before installing this package manually, make sure you have made a dedicated Python virtual environment and installed all required dependencies.

There are many distinct ways of creating Python environments which might be suitable for different applications, e.g., Anaconda, Miniconda, PyEnv, Venv, and others. Use the one that best suits your needs.

For convenience purposes, we provide an example of how to create and activate a simple environment using Venv:

Unix Systems (Zsh and Bash):

python3 -m venv qc_lattice_h && source qc_lattice_h/bin/activate

Windows:

python -m venv qc_lattice_h && qc_lattice_h/Scripts/activate

To leave this environment, simply run 'deactivate'.

Dependencies

  • General Dependencies: numpy, matplotlib, networkx, sympy, iteration_utilities

  • For Exact Diagonalization: scipy

  • For Quantum Computation: qiskit, qiskit.quantum_info

It is possible to install all dependencies with the command below:

pip install numpy matplotlib networkx sympy scipy qiskit iteration_utilities

Manual installation

You can use pip to carry out the manual installation. With your python environment activated, run:

pip install .

Usage

This module consists of three main Python classes found in three separate submodules, as explained below, each focused on a particular component of QED Hamiltonian creation.

Important Submodules

-Contains a python class 'HCLattice' that builds a lattice in generic N dimensions, with periodic or open boundary conditions. It finds the set of links and sites, builds plaquettes and chains for Jordan-Wigner[^2] definition (version up to 3D).

-Has a python class 'HamiltonianQED_sym' that builds a symbolic expression of QED Hamiltonian N-dimensional lattice, both with open and periodic boundary conditions. The formulation considered is from Kogut and Susskind and the Gauss’ law can be applied. By doing so, it results in a gauge-invariant system, reducing the number of dynamical links needed for the computation, leading to a resource-efficient Hamiltonian. It is also possible to consider a formulation for a magnetic basis[^3].

-Also contains a 'HamiltonianQED_oprt' class. It imports the Hamiltonian from symbolic expression and builds its respective operator form (sparse matrices or PauliOp, suitable for qiskit quantum circuits). It considers two types of encoding: ed returns sparse matrix; gray with option sparse=False returns PauliOp expression. Otherwise, a sparse matrix is returned.

-Contains an 'Ansatz' class. Consists of ansaetze proposals of variational circuits for Gray encoding (for gauge fields) and zero-charge sector (for fermionic degrees of freedom).

Importing classes

As shorthand, you can import all the classes into your python project as below.

from qclatticeh.lattice import HCLattice
from qclatticeh.hamiltonian import HamiltonianQED_sym, HamiltonianQED_oprt
from qclatticeh.circuits import Ansatz

Migration Guide

In case you were using older versions of this source code before packaging, you may have imported the same python classes as seen below:

import sys
sys.path.append("../") # go to parent dir
from Hamiltonian_QED_sym import HamiltonianQED_sym
from Hamiltonian_QED_oprt import HamiltonianQED_oprt
from HC_Lattice import HCLattice
from Ansaetze import Ansatz

You can simply replace the imports with the new package import commands, and most of the old functionality and codebase should work successfully:

from qclatticeh.lattice import HCLattice
from qclatticeh.hamiltonian import HamiltonianQED_sym, HamiltonianQED_oprt
from qclatticeh.circuits import Ansatz

Examples

For code examples illustrating a typical workflow with this module, please refer to the notebooks folder and the Jupyter Notebooks examples there:

For an example of Hamiltonian design, let us consider a 2x2 OBC system as in the following figure: Image

where the black arrow represents the gauge field that remains dynamical after Gauss law is applied, i.e.

$$- E_{00x} - E_{00y} - q_{00} = 0 $$

$$ E_{00y} - E_{01x} - q_{01} = 0 $$

$$ E_{00x} - E_{10y} - q_{10} = 0 $$

$$ E_{01x} + E_{10y} - q_{11} = 0 $$

$$ q_{00} + q_{01} + q_{10} + q_{11} = 0. $$

After this step, the Hamiltonian will be:

$$ H_{E} = \frac{g^{2} \left(E_{10y}^{2} + \left(- E_{10y} + q_{11}\right)^{2} + \left(E_{10y} + q_{10}\right)^{2} + \left(- E_{10y} + q_{01} + q_{11}\right)^{2}\right)}{2} $$

for the electric part,

$$ H_{B} = - \frac{U_{10y} + h.c.}{2 g^{2}} $$

for magnetic. If matter fields are considered, then we have a mass term

$$ H_{m} = m \left(\Phi_{1}^{\dagger} \Phi_{1} - \Phi_{2}^{\dagger} \Phi_{2} + \Phi_{3}^{\dagger} \Phi_{3} - \Phi_{4}^{\dagger} \Phi_{4}\right) $$

and a kinetic term

$$ H_{K} = \Omega \left(0.5 i \left(- h.c.(x) + \Phi_{1}^{\dagger} \Phi_{2} + \Phi_{4}^{\dagger} \Phi_{3}\right) - 0.5 \left(h.c.(y) + \Phi_{1}^{\dagger} \Phi_{4} - \Phi_{2}^{\dagger} U_{10y}^{\dagger} \Phi_{3}\right)\right). $$

One can visualize the Hamiltonian and then decide which encoding to use and if the final expression must be written in terms of Qiskit's Pauli operators.

It is also possible to put static charges on the sites and study the static potential.

To encode the fermions for a quantum circuit implementation we consider the Jordan-Wigner formulation with:

$$ \begin{aligned}\Phi_j &= \prod_{k} (-i\sigma^z_k) \sigma^{+}_j , \quad \text{where } k < j, \end{aligned} $$

$$ \begin{aligned}\Phi_j^{\dagger}&= \prod_{k} (i\sigma^z_k) \sigma^{-}_j, \quad \text{where } k < j. \end{aligned} $$

The dynamical charges can be written as

$$q_{\vec{n}} = \Phi^{\dagger} \Phi-\frac{1}{2}(1+(-1)^{n_{x} +n_{y} + 1}) \ \to \ \ \begin{cases} \frac{I-\sigma_{z}}{2}, & \text{if $\vec{n}$ even}\ -\frac{I+\sigma_{z}}{2}, & \text{if $\vec{n}$ odd} \end{cases}$$

Gray circuit

After discretizing and truncating the U(1) gauge group to the discrete group Z(2l+1), the gauge fields can be represented in the electric basis as

$$ \hat{E} = \sum_{i=-l}^l i \ket{i}\bra{i}, $$

$$ \hat{U} = \sum_{i=-l}^{l-1} \ket{i+1}\bra{i}, $$

$$ \hat{U^\dagger} = \sum_{i=-l+1}^l \ket{i-1}\bra{i}, $$

$$\text{where}\ket{i}=\ket{i}_{\text{ph}} $$.

For numerical calculations, it is advantageous to employ a suitable encoding that accurately represents the physical values of the gauge fields. In this work, we consider the Gray encoding. For the truncation l=1, we can use the circuit in the following Figure to represent a gauge field.

Image

The action of the circuit is straightforward: starting from the state |00>, setting both parameters θ1 and θ2 to zero allows for the exploration of the physical state |-1>. The introduction of a non-zero value for θ1 allows the state to change to |01>, which represents the physical vacuum state |0>, with a certain probability. A complete rotation occurs if θ1 = π, resulting in the exclusive presence of the second state with a probability of 1.0. Subsequently, the second controlled gate operates only when the first qubit is |1>, limiting the exploration to |11> (i.e., physical |1>) and excluding |10>.

Circuits for larger truncations (l=3,7,15) are:

Image

Image

Image

Fermionic circuit

For simulating the fermionic degrees of freedom we employ the iSWAP gate, see Ref.[^4].

Feedback and Bugs

If any bugs related to installation, usage and workflow are encountered, and in case of suggestions for improvements and new features, please open a New Issue

Contributing

To assist with potential contributions, please submit a Pull Request.

License

MIT licence

References

[^1]: Lattice fermions L Susskind - Physical Review D, 1977 - APS [^2]: P. Jordan and E. P. Wigner, Über das paulische äquivalenzverbot, in The Collected Works of Eugene Paul Wigner (Springer, New York, 1993), pp. 109–129 [^3]: JF Haase, L Dellantonio, A Celi, D Paulson, A Kan, K Jansen, CA Muschik Quantum, 2021•quantum-journal.org [^4]: D. Paulson, L. Dellantonio, J. F. Haase, A. Celi, A. Kan, A. Jena, C. Kokail, R. van Bijnen, K. Jansen, P. Zoller, C. A. Muschik, arXiv:2008.09252

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

qclatticeh-0.1.0.tar.gz (43.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qclatticeh-0.1.0-py3-none-any.whl (46.8 kB view details)

Uploaded Python 3

File details

Details for the file qclatticeh-0.1.0.tar.gz.

File metadata

  • Download URL: qclatticeh-0.1.0.tar.gz
  • Upload date:
  • Size: 43.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for qclatticeh-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ccc16f268288c45fa871c69e1517b224e723b8a3a46dba8e55372fa226258938
MD5 8c2f82eba712ab34ba892e4277f64d6b
BLAKE2b-256 10799f069eb04a8d4629e941ef4b7cfaed494300814e34224d31999c74731ac1

See more details on using hashes here.

File details

Details for the file qclatticeh-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: qclatticeh-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 46.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for qclatticeh-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 17b2271a1e64b3d3a52aaf8528a21ea5632dac11f5dbfdb6f3b43a003b1c29d4
MD5 27450270455f71da1b6bc992c36f745c
BLAKE2b-256 032b778afb6f2b6741dff57f6c8f4ca87bceca61621543df348996c7e8982ae6

See more details on using hashes here.

Supported by

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