Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branding (Tangelo, Good Chemistry Company) #87

Merged
merged 6 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/github_actions_automated_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ jobs:
$(which dotnet-iqsharp) install --user
pip install qsharp

- name: qsdk install
- name: tangelo install
run: |
python -m pip install .
if: always()

- name: qsdk tests
- name: tangelo tests
run: |
cd qsdk
cd tangelo
pytest --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
if: always()

- name: qsdk notebooks as tests
- name: tangelo notebooks as tests
run: |
cd examples
pytest --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html test_notebooks.py
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ RUN pip3 install --upgrade pip
RUN pip3 install h5py==2.9.0 ipython jupyter setuptools wheel sphinx py3Dmol sphinx_rtd_theme nbsphinx scikit-build

# Copy and set root directory,
ENV PYTHONPATH=/root/qsdk:$PYTHONPATH
ENV PYTHONPATH=/root/tangelo:$PYTHONPATH
WORKDIR /root/
COPY . /root

# Install qSDK and its immediate dependencies (pyscf, openfermion, ...)
# Install Tangelo and its immediate dependencies (pyscf, openfermion, ...)
RUN python3 /root/setup.py install

# Install Microsoft QDK qsharp package
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 1QB Information Technologies Inc.
# Copyright 2021 Good Chemistry Company
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
21 changes: 8 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
qSDK overview
Tangelo overview
=============

Welcome !
Expand Down Expand Up @@ -41,19 +41,14 @@ root directory:
If the installation of a dependency fails and the reason is not obvious, we suggest installing that dependency
separately with ``pip``\ , before trying again.

If you would like to modify or develop code in ``qSDK``\ , you can add the path to this folder to your ``PYTHONPATH``
environment variable instead of installing it with pip:

.. code-block::

export PYTHONPATH=<path_to_this_folder>:$PYTHONPATH
You can also add the path to this folder to your ``PYTHONPATH`` environment variable to facilitate your own developments.

Optional dependencies
^^^^^^^^^^^^^^^^^^^^^

qSDK enables users to target various backends. In particular, it integrates quantum circuit simulators such as
Tangelo enables users to target various backends. In particular, it integrates quantum circuit simulators such as
``qulacs``\ , ``qiskit``\ , ``cirq`` or ``qdk``. We leave it to you to install the packages of your choice.
Backends such as ``qulacs`` and ``cirq`` show good overall performance. Most packages can be installed through pip in a straightforward way:
Most packages can be installed through pip in a straightforward way:

.. code-block::

Expand Down Expand Up @@ -91,7 +86,7 @@ Tests
-----

Unit tests can be found in the ``tests`` folders, located in the various toolboxes they are related to. To automatically
find and run all tests (assuming you are in the ``qsdk`` subfolder that contains the code of the package):
find and run all tests (assuming you are in the ``tangelo`` subfolder that contains the code of the package):

.. code-block::

Expand All @@ -100,8 +95,8 @@ find and run all tests (assuming you are in the ``qsdk`` subfolder that contains
Citations
---------

If you use qSDK in your research, please cite
If you use Tangelo in your research, please cite

[TODO: this is a placeholder for our qSDK paper, to be written and put on arxiv in October]
[TODO: this is a placeholder for our Tangelo paper, to be written and put on arxiv in October]

Copyright 1QBit 2021. This software is released under the Apache Software License version 2.0.
Copyright Good Chemistry Company 2021. This software is released under the Apache Software License version 2.0.
4 changes: 2 additions & 2 deletions dev_tools/build_sphinx_docs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Make sure you build qsdk and all relevant dependencies before attempting to generate documentations
# Make sure you build tangelo and all relevant dependencies before attempting to generate documentations
# or mock the desired packages in docs/source/conf.py
cd ../docs || cd docs
pip install sphinx sphinx_rtd_theme nbsphinx
Expand All @@ -13,5 +13,5 @@ pip install -r requirements.txt
sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended pandoc dvipng

# Build html documentation in ../docs/source/html
sphinx-apidoc -o source ../qsdk
sphinx-apidoc -o source ../tangelo
make clean; make html
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

# -- Project information -----------------------------------------------------

project = 'qsdk'
copyright = '2021 1QBit'
project = 'tangelo'
copyright = '2021 Good Chemistry Company'
author = 'Valentin senicourt, Alexandre Fleury, Ryan Day, James Brown'

# The full version, including alpha/beta/rc tags
Expand Down
6 changes: 3 additions & 3 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.. qsdk documentation master file, created by
.. tangelo documentation master file, created by
sphinx-quickstart on Fri Oct 15 15:20:40 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Welcome to qsdk's documentation!
Welcome to tangelo's documentation!
================================

.. toctree::
Expand All @@ -12,7 +12,7 @@ Welcome to qsdk's documentation!

README
tutorials
qsdk
tangelo

Indices and tables
==================
Expand Down
26 changes: 13 additions & 13 deletions examples/adapt.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"\n",
"In ADAPT-VQE, an ansatz which approximates not UCCSD/UCCGSD, but in fact FCI, is built iteratively. Over a series of cycles, the ansatz circuit is grown to achieve an approximation to FCI with a minimal number of circuit elements. In this way, ADAPT-VQE can be thought as a meta-VQE: at each cycle, a new ansatz is defined, and its parameters optimized according to conventional VQE. As the cycles proceed, the ansatz grows in both complexity and expressibility. This algorithm comes at the expense of a significant increase in measurement overhead. In order to identify the best operator to append to the present ansatz circuit, a large number of measurements are performed to rank the available operators in order of their ability to further reduce the ansatz state energy.\n",
"\n",
"In this notebook, we explore the implementation of this algorithm, available in qSDK. The original algorithm is examined first, and has shown some success in reducing the number of variational parameters required to express the quantum state. Then, we examine another version of ADAPT-VQE which is successful at reducing the circuit size by using a pool of operators defined from the Qubit Hamiltonian."
"In this notebook, we explore the implementation of this algorithm, available in Tangelo. The original algorithm is examined first, and has shown some success in reducing the number of variational parameters required to express the quantum state. Then, we examine another version of ADAPT-VQE which is successful at reducing the circuit size by using a pool of operators defined from the Qubit Hamiltonian."
],
"metadata": {}
},
Expand Down Expand Up @@ -67,8 +67,8 @@
"cell_type": "code",
"execution_count": null,
"source": [
"from qsdk import SecondQuantizedMolecule\n",
"from qsdk.algorithms import ADAPTSolver\n",
"from tangelo import SecondQuantizedMolecule\n",
"from tangelo.algorithms import ADAPTSolver\n",
"\n",
"H4 = [(\"H\", (0, 0, 0)), (\"H\", (0, 1.4, 0)), (\"H\", (0, 2.8, 0)), (\"H\", (0, 4.2, 0))]\n",
"mol = SecondQuantizedMolecule(H4, q=0, spin=0, basis=\"sto-3g\", frozen_orbitals=[])\n",
Expand Down Expand Up @@ -98,7 +98,7 @@
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"from qsdk.algorithms import FCISolver\n",
"from tangelo.algorithms import FCISolver\n",
"\n",
"fci_solver = FCISolver(mol)\n",
"exact = fci_solver.simulate()\n",
Expand All @@ -125,7 +125,7 @@
"cell_type": "code",
"execution_count": null,
"source": [
"from qsdk.algorithms import VQESolver, BuiltInAnsatze\n",
"from tangelo.algorithms import VQESolver, BuiltInAnsatze\n",
"\n",
"vqe_solver = VQESolver({'molecule': mol, 'ansatz': BuiltInAnsatze.UCCSD})\n",
"vqe_solver.build()\n",
Expand Down Expand Up @@ -204,7 +204,7 @@
" pool_generators (list of QubitOperator): list of generators\n",
" \"\"\"\n",
" import numpy as np\n",
" from qsdk.toolboxes.operators.operators import QubitOperator\n",
" from tangelo.toolboxes.operators.operators import QubitOperator\n",
"\n",
" pauli_lookup = {'Z':1, 'X':2, 'Y':3}\n",
" pauli_reverse_lookup = ['I', 'Z', 'X', 'Y']\n",
Expand Down Expand Up @@ -255,7 +255,7 @@
"cell_type": "code",
"execution_count": null,
"source": [
"from qsdk.toolboxes.operators import QubitOperator\n",
"from tangelo.toolboxes.operators import QubitOperator\n",
"qubit_operator = QubitOperator(((0, 'X'), (1, 'X'), (2, 'Y'), (3, 'Y')), -1.0) \\\n",
" + QubitOperator(((0, 'X'), (1, 'Y'), (2, 'Y'), (3, 'X')), 1.0) \\\n",
" + QubitOperator(((0, 'Y'), (1, 'X'), (2, 'X'), (3, 'Y')), 1.0) \\\n",
Expand Down Expand Up @@ -285,8 +285,8 @@
"cell_type": "code",
"execution_count": null,
"source": [
"from qsdk.toolboxes.qubit_mappings.mapping_transform import fermion_to_qubit_mapping\n",
"from qsdk.toolboxes.operators import count_qubits\n",
"from tangelo.toolboxes.qubit_mappings.mapping_transform import fermion_to_qubit_mapping\n",
"from tangelo.toolboxes.operators import count_qubits\n",
"\n",
"fermion_operator = mol._get_fermionic_hamiltonian()\n",
"qubit_operator = fermion_to_qubit_mapping(fermion_operator, 'jw', mol.n_active_sos, mol.n_electrons)\n",
Expand All @@ -306,7 +306,7 @@
"cell_type": "code",
"execution_count": null,
"source": [
"from qsdk.algorithms import ADAPTSolver\n",
"from tangelo.algorithms import ADAPTSolver\n",
"\n",
"opt_dict = {\"molecule\": mol,\n",
" \"frozen_orbitals\": 0,\n",
Expand Down Expand Up @@ -425,8 +425,8 @@
"cell_type": "code",
"execution_count": null,
"source": [
"from qsdk.toolboxes.ansatz_generator.penalty_terms import combined_penalty\n",
"from qsdk.toolboxes.operators.operators import qubitop_to_qubitham\n",
"from tangelo.toolboxes.ansatz_generator.penalty_terms import combined_penalty\n",
"from tangelo.toolboxes.operators.operators import qubitop_to_qubitham\n",
"\n",
"# Define dictionary of desired quantum numbers [penalty_weight, desired_quantum_number]\n",
"penalty_weight = 1/2\n",
Expand Down Expand Up @@ -497,7 +497,7 @@
"source": [
"## Conclusion\n",
"\n",
"In this notebook, we've explored an implementation of the original ADAPT-VQE algorithm, and the Hamiltonian-inspired qubit variant, using the tools available in qSDK. It is clear that the number of parameters required for accurate results can be made much smaller with the orignal algorithm, while the qubit version can reduce the circuit depth greatly. The second section illustrates how users can create their own pool of qubit operators through their own `get_pool` function, to explore their own avenues. "
"In this notebook, we've explored an implementation of the original ADAPT-VQE algorithm, and the Hamiltonian-inspired qubit variant, using the tools available in Tangelo. It is clear that the number of parameters required for accurate results can be made much smaller with the orignal algorithm, while the qubit version can reduce the circuit depth greatly. The second section illustrates how users can create their own pool of qubit operators through their own `get_pool` function, to explore their own avenues. "
],
"metadata": {}
}
Expand Down
22 changes: 11 additions & 11 deletions examples/backendbuddy/1.the_basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"`backendbuddy` is a submodule of `qsdk` that helps you connect to and leverage the features of various backends, may they be simulators or QPUs. This notebook talks about the abstract format used in this python package to represent a quantum circuit, and how we can then translate it to other formats or objects used in popular packages such as Qiskit, ProjectQ, Qulacs (...) and leverage the different features and performance they offer.\n",
"`backendbuddy` is a submodule of `tangelo` that helps you connect to and leverage the features of various backends, may they be simulators or QPUs. This notebook talks about the abstract format used in this python package to represent a quantum circuit, and how we can then translate it to other formats or objects used in popular packages such as Qiskit, ProjectQ, Qulacs (...) and leverage the different features and performance they offer.\n",
"\n",
"This functionality is pretty useful because it means that you can derive a given quantum circuit for any supported compute backend available with minimal effort, whether it is a simulator or an actual QPU. You therefore do not need to rewrite your program to run on a different platform, or to share your code in a specific format that your collaborators or clients expect, for publication or running an actual hardware experiment. It also means that whatever new method or code you develop can now suddenly run on all the compute backends available, enabling researchers and product users to benefit from your contributions regardless of the compute platform they intend to use.\n",
"\n",
Expand All @@ -34,7 +34,7 @@
"source": [
"## Requirements\n",
"\n",
"In order to run the contents of this notebook, you need to have the `qsdk` package installed in your python environment. Some cells may require that a specific backend (such as `qiskit`, `qulacs`...) is installed to run.\n",
"In order to run the contents of this notebook, you need to have the `tangelo` package installed in your python environment. Some cells may require that a specific backend (such as `qiskit`, `qulacs`...) is installed to run.\n",
"\n",
"Please have a look at the installation instructions, if you need.\n",
"\n",
Expand Down Expand Up @@ -85,7 +85,7 @@
}
],
"source": [
"from qsdk.backendbuddy import Gate\n",
"from tangelo.backendbuddy import Gate\n",
"\n",
"# Create a Hadamard gate acting on qubit 2\n",
"H_gate = Gate(\"H\", 2)\n",
Expand Down Expand Up @@ -166,7 +166,7 @@
}
],
"source": [
"from qsdk.backendbuddy import Circuit\n",
"from tangelo.backendbuddy import Circuit\n",
"\n",
"# Here's a list of abstract gates\n",
"mygates = [Gate(\"H\", 2), Gate(\"CNOT\", 1, control=0), Gate(\"CNOT\", target=2, control=1),\n",
Expand Down Expand Up @@ -266,7 +266,7 @@
}
],
"source": [
"from qsdk.backendbuddy.helpers.circuits import measurement_basis_gates, pauli_string_to_of\n",
"from tangelo.backendbuddy.helpers.circuits import measurement_basis_gates, pauli_string_to_of\n",
"\n",
"def theta_sweep(theta, m_basis):\n",
" \"\"\" A single-parameter circuit, with change of basis at the end if needed \"\"\"\n",
Expand Down Expand Up @@ -316,7 +316,7 @@
}
],
"source": [
"from qsdk.backendbuddy import SUPPORTED_GATES\n",
"from tangelo.backendbuddy import SUPPORTED_GATES\n",
"\n",
"for backend, gates in SUPPORTED_GATES.items():\n",
" print(f'{backend} : {gates}')"
Expand All @@ -330,7 +330,7 @@
"\n",
"**Note**: Do not use the `MEASURE` Gate in your noiseless/shotless simulations, unless your circuit requires a mid-circuit measurement. This gate is intended for the simulation of **mixed states**. \n",
"\n",
"**Note**: If you actually had a closer look at some simulation backends, such as Qiskit, Qulacs or ProjectQ, you'd find out that none of them have the same definition for the $R_z(\\theta)$ operation: they all differ up to a phase or sign convention for $\\theta$! Since the outcome of your simulation should not depend on the target backend, the translation step enforce a given convention, detailed in the documentation. In particular, this implies that the native circuit written for a given backend may not be equivalent to the same one written in abstract format, and then translated to this backend. Be mindful of that as you try to take some code written for a given backend, to port it to `qsdk`.\n",
"**Note**: If you actually had a closer look at some simulation backends, such as Qiskit, Qulacs or ProjectQ, you'd find out that none of them have the same definition for the $R_z(\\theta)$ operation: they all differ up to a phase or sign convention for $\\theta$! Since the outcome of your simulation should not depend on the target backend, the translation step enforce a given convention, detailed in the documentation. In particular, this implies that the native circuit written for a given backend may not be equivalent to the same one written in abstract format, and then translated to this backend. Be mindful of that as you try to take some code written for a given backend, to port it to `tangelo`.\n",
"\n",
"Below, we show how the translation function returns backend-specific objects, all with their usual built-in functionalities! See how the print function behaves differently for each of them for instance, and remember that you can use their built-in methods to accomplish many things (ex: after translating your circuit into a `Qiskit.QuantumCircuit` object, you can use the `draw` method to export it in a nice format: https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.draw.html). \n",
"\n",
Expand Down Expand Up @@ -427,7 +427,7 @@
}
],
"source": [
"from qsdk.backendbuddy.translator import translate_qulacs, translate_qiskit, translate_projectq, translate_qsharp, translate_openqasm, translate_cirq, translate_json_ionq, translate_braket\n",
"from tangelo.backendbuddy.translator import translate_qulacs, translate_qiskit, translate_projectq, translate_qsharp, translate_openqasm, translate_cirq, translate_json_ionq, translate_braket\n",
"\n",
"circ3_projectq = translate_projectq(circuit3)\n",
"print(f\"{circ3_projectq}\\n\")\n",
Expand Down Expand Up @@ -640,7 +640,7 @@
}
],
"source": [
"from qsdk.backendbuddy import Simulator, backend_info\n",
"from tangelo.backendbuddy import Simulator, backend_info\n",
"\n",
"for backend, info in backend_info.items():\n",
" print(f'{backend} : {info}')"
Expand Down Expand Up @@ -859,9 +859,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "qsdk_sept_21",
"display_name": "tangelo_sept_21",
"language": "python",
"name": "qsdk_sept_21"
"name": "tangelo_sept_21"
},
"language_info": {
"codemirror_mode": {
Expand Down
Loading