Rapid development of novel quantum algorithms
Tequila is an Extensible Quantum Information and Learning Architecture where the main goal is to simplify and accelerate implementation of new ideas for quantum algorithms. It operates on abstract data structures allowing the formulation, combination, automatic differentiation and optimization of generalized objectives. Tequila can execute the underlying quantum expectation values on state of the art simulators as well as on real quantum devices.
You can get an overview from this presentation or from it's video recording
Get started with our Tutorials
or checkout our overview article
Currently supported - Qulacs - Qibo - Qiskit - Cirq - PyQuil
Tequila detects backends automatically if they are installed on your systems.
All of them are available over standard pip installation like for example
pip install qulacs.
qulacsinstalled.
Currently supported
- Psi4.
In a conda environment this can be installed with
bash conda install psi4 -c psi4Here is a small tutorial that illustrates the usage.
develbranch of tequila (coming to master soon).
We recommend installing in editable mode with
bash git clone https://github.com/aspuru-guzik-group/tequila.git cd tequila pip install -e .
Do not install over PyPi (Minecraft lovers excluded)
pip install tequila
You can install
tequiladirectly with pip over:
bash pip install git+https://github.com/aspuru-guzik-group/tequila.git
Recommended Python version is 3.7 or 3.6.
Python 3.8 works, but not all (optional) dependencies support it yet.
Check out the tutorial notebooks provided in tutorials.
# optimize a one qubit exampledefine a variable
a = tq.Variable("a")
define a simple circuit
U = tq.gates.Ry(angle=a*pi, target=0)
define an Hamiltonian
H = tq.paulis.X(0)
define an expectation value
E = tq.ExpectationValue(H=H, U=U)
optimize the expectation value
result = tq.minimize(method="bfgs", objective=E**2)
check out the optimized wavefunction
wfn = tq.simulate(U, variables=result.angles) print("optimized wavefunction = ", wfn)
plot information about the optimization
result.history.plot("energies") result.history.plot("angles") result.history.plot("gradients")
# define a molecule within an active space active = {"a1": [1], "b1":[0]} molecule = tq.quantumchemistry.Molecule(geometry="lih.xyz", basis_set='6-31g', active_orbitals=active, transformation="bravyi-kitaev")get the qubit hamiltonian
H = molecule.make_hamiltonian()
create an k-UpCCGSD circuit of order k
U = molecule.make_upccgsd_ansatz(order=1, include_singles=True)
define the expectationvalue
E = tq.ExpectationValue(H=H, U=U)
compute reference energies
fci = molecule.compute_energy("fci") cisd = molecule.compute_energy("detci", options={"detci__ex_level": 2})
optimize
result = tq.minimize(objective=E, method="BFGS", initial_values=0.0)
print("VQE : {:+2.8}f".format(result.energy)) print("CISD: {:+2.8}f".format(cisd)) print("FCI : {:+2.8}f".format(fci))
Do you want to create your own methods? Check out the tutorials!
J.S. Kottmann, A. Anand, A. Aspuru-Guzik.
A Feasible Approach for Automatically Differentiable Unitary Coupled-Cluster on Quantum Computers.
Chemical Science, 2021, doi.org/10.1039/D0SC06627C.
arxiv.org/abs/2011.05938
General techniques are implemented in the chemistry modules of tequila.
See the tutorials for examples.
J.S. Kottmann, P. Schleich, T. Tamayo-Mendoza, A. Aspuru-Guzik.
Reducing Qubit Requirements while Maintaining Numerical Precision for the Variational Quantum Eigensolver: A Basis-Set-Free Approach.
J.Phys.Chem.Lett., 2021, doi.org/10.1021/acs.jpclett.0c03410.
arxiv.org/abs/2008.02819
example code
tutorial on the madness interface
A. Cervera-Lierta, J.S. Kottmann, A. Aspuru-Guzik.
The Meta-Variational Quantum Eigensolver.
arxiv.org/abs/2009.13545
example code
J.S. Kottmann, M. Krenn, T.H. Kyaw, S. Alperin-Lea, A. Aspuru-Guzik.
Quantum Computer-Aided design of Quantum Optics Hardware.
arxiv.org/abs/2006.03075
example code
A. Anand, M. Degroote, A. Aspuru-Guzik.
Natural Evolutionary Strategies for Variational Quantum Computation.
arxiv.org/abs/2012.00101
Let us know, if you want your research project to be included in this list!
Support for additional optimizers can be activated by intalling them in your environment.
Tequila will then detect them automatically.
Currently those are: Phoenics
and GPyOpt.
You can build the documentation by navigating to
docsand entering
make html.
firefox docs/build/html/index.html
sphinxand
mr2that are not explicitly listed in the requirements.txt
You can also visit our prebuild online documentation
that will correspond to the github master branch
If you find any bugs or inconveniences in
tequilaplease don't be shy and let us know.
If you already found a solution you can contribute to
tequilaover a pull-request.
tequilato your own github account.
develbranch and make sure it is up to date with the main github repository.
develvia
git branch pr-my-branch-namefollowed by
git checkout pr-my-branch-name. By typing
git branchafterwards you can check which branch is currently checked out on your computer.
develbranch (but we can also change that afterwards).
If you plan to introduce major changes to the base library it can be beneficial to contact us first.
This way we might be able to avoid conflicts before they arise.
If you used
tequilafor your research, feel free to include your algoritms here, either by integrating it into the core libraries or by demonstrating it with a notebook in the tutorials section. If you let us know about it, we will also add your research article in the list of research projects that use tequila (see above).
If you experience trouble of any kind or if you either want to implement a new feature or want us to implement a new feature that you need:
don't hesitate to contact us directly or raise an issue here on github
You will need cmake to install the qulacs simulator
pip install cmake
You don't need
qulacsfor tequila to run (although is is recommended)
qulacsjust remove the
qulacsline from
requirements.txt
tequila.
tequilacan detect them.
You can in principle use tequila with windows as OS and have almost full functionality.
You will need to replace
Jaxwith
autogradfor it to work.
jaxand
jaxlibfrom
setup.pyand
requirements.txtand add
autogradinstead.
In order to install qulacs you will need latest GNU compilers (at least gcc-7).
They can be installed for example over visual studio.
Tequila runs on Macs OSX.
You might get in trouble with installing qulacs since it currently does not work with Apple's clang compiler.
You need to install latest GNU compile (at least gcc-7 and g++7) and set them as default before installing qulacs over pip.
Currently you can't use Qibo and GPyOpt within the same environment