A project for the Open Hackathon @ QHACK 2024.
This repository holds the source code developed during the Open Hackathon, as well as some Jupyter Notebook tutorials. This work is heavily based on P. García-Molina et al., PRA 105, 012433 (2022), and written on the Pennylane framework for Python.
On each file contained in the tutorial/
directory we show, respectively, how to
- Create and evaluate quadrature operators in first quantization!
- Find the ground state of the quantum harmonic oscillator!
- Find the ground state of coupled harmonic oscillators!
- Find the first five states of the hydrogen atom with orthogonal subspace optimization!
- Impose (anti-)symmetry to find the ground and first excited state of the H2 molecule, without resorting to orthogonal subspace optimization!
- Employ the framework to prepare elliptic curves in quantum computers!
- Solve the quantum harmonic oscillator, using semi-classical Fourier Transforms, reducing the circuit complexity!
The source code is contained in the main/
directory, with the following structure:
main/
├── __init__.py
├── VarQFT.py
├── operators.py
├── circuits.py
└── measurements.py
-
As usual,
__init__.py
is the entry point, and we use it to re-export definitions from the following files. -
VarQFT.py
is the central pivot of our project. It defines the classVarFourier
, which can hold a list of Hamiltonian operators, variational forms (circuits), a quantum device simulator from Pennylane, and other optional parameters. Once an intance has been defined, the methodVarFourier.run
allows to solve Schrodinger-like equations for a given Hamiltionian in a variational manner. All methods required for state preparation, and expectation value or gradient evaluations are contained within. This class also allows to use lagrange multipliers to optimize over an orthogonal space for a given state found. In this way, we can not only find ground states, but higher-energy states iteratively. -
operators.py
provides tools to define continuous-variable operators$X$ and$P$ , and methods for operator arithmetic. This even allows to contruct an operator list encoding a partial differential differential equation to pass toVarFourier
. Moreover, this operators hold the space-discretization information and even, in the case of the momentum operator, if it should be measured in the standard manner, or using clever techniques like the semi-classical Fourier transform and in the future, circuit cutting. -
circuits.py
provides classes of ansatze (variational circuits) to pass toVarFourier
, including a rotational ansatz, Ry ansatz and the a version of the Zalka-Grover-Rudolph (ZGR) ansatz. We also provide the symmetrization ansatz which takes a circuit inN-1
qubits and extends it toN
qubits with no parameters added, by imposing (anti-)symmetry in the encoded state. -
measurements.py
provides what is needed to evualuate the measurements required throughout the library, making use of Pennylane's QuantumTape's.