Qu & Co Quantum Code - Chemistry
The Qu & Co Chemistry package is an open source library (licensed under Apache 2) for compiling and running quantum chemistry algorithms on Rigetti's Forest quantum computing platform.
To start using Qu & Co Chemistry library, you need to first install the Rigetti's Forest SDK which contains both the Quantum Virtual Machine and the Rigetti's quantum compiler.
You can install the library in two different ways.
From PyPi or conda
Using pip install the latest version from PyPi within a virtual environment:
python -m pip install qucochemistry
Alternatively, the library can be installed within a conda environment:
conda install -c quco qucochemistry
Using pip, install the library within a virtual environment:
python -m pip install -r deploy/requirements.txt python -m pip install -e .
Alternatively, install within a Conda environment using the provided environment:
conda env create -n <env_name> -f deploy/environment.yml conda activate <env_name> python -m pip install -e .
In order to use this library within your program, Rigetti's quantum virtual machine and quantum compilers must be running in the background. If you run on Linux or OSX and the Rigetti's Forest SDK is correctly installed, you can start them in the background with the following commands:
screen -dm -S qvm qvm -S screen -dm -S quilc quilc -S
On Windows just execute
qvm -S and
quilc -S commands in two separate cmd terminals.
For more details on how to use the library, several tutorials on Jupyter notebook are available here. To be able run end-to-end programs, you should install PySCF and OpenFermion-PySCF as additional dependencies with pip:
python -m pip install openfermionpyscf pyscf
If you created the Conda environment as described in the previous section, you should be able to install these dependencies within the environment with the same command.
The unit tests are built using the pytest framework. In order to run them, install the qucochemistry package using the previous instruction and add the following dependencies:
# for Conda environment conda install pytest pytest-cov # for standard virtual environment python -m pip install pytest pytest-cov
The tests can be executed in the root project directory as follows:
pytest -v --cov=qucochemistry
An automatic code coverage report will be generated after running the above command. In order to visualize the details of the code coverage for each module, an HTML report can be generated and rendered with your favorite browser
pytest -v --cov=qucochemistry --cov-report html firefox htmlcov/index.html
How to contribute
We'd love to accept your contributions and patches to Qu & Co Chemistry. There are a few guidelines you need to follow. Contributions to Qu & Co Chemistry must be accompanied by a Contributor License Agreement. You (or your employer) retain the copyright to your contribution, this simply gives us permission to use and redistribute your contributions as part of the project.
All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult GitHub Help for more information on using pull requests. Furthermore, please make sure your new code comes with extensive tests! We use automatic testing to make sure all pull requests pass tests and do not decrease overall test coverage by too much. Make sure you adhere to our style guide. Just have a look at our code for clues. We mostly follow PEP 8 and use the corresponding linter to check for it. Code should always come with documentation.
Vincent Elfving (Qu & Co B.V.)
We are happy to include future contributors as authors on later Qu & Co Chemistry releases.