This is a public implementation of "Molecular docking via quantum approximate optimization algorithm".
This repository includes the QUBO problem formulation, QAOA circuit construction and execution. Some additional features have also been added in hopes of accelerating research in the area and helping others learn about quantum computing's potential in a biological context. Issues/pull requests are welcome!
Create a virtual environment (e.g. anaconda, venv), then install requirements via pip install -r requirements.txt
. Make sure to build the environment with python 3.9.
View problems.py
for specific parameters for the experiments used in the paper. If you experimentally obtain pharmacophore interaction values for different molecules, this is where you would initialize your problem. The number of qubits required is equal to the product of the number of pharmacophore points on the ligand and the protein.
Next, view qubo.py
for details on the Quadratic Unconstrained Binary Optimization (QUBO) formulation. Quadratic Unconstrained Binary Optimization (QUBO) is an NP-hard problem where the goal is to minimize
which can be thought of as a cost function. This can be converted into an Ising "hamiltonian" (energy function, amenable to solving by quantum computers).
Generally speaking, the flow of the program is as such: Labeled Distance Graph (LDG) & Experimentally Defined Pharmacophore Matrix -> Binding Interaction Graph (BIG) -> Maximum Weighted Clique Problem -> QUBO -> Solve the QUBO using QAOA -> Results.
I have also added code for graph generation to reproduce the different graphs from the paper. In particular, it seems that the graphs in the paper were made with the "non-flexible" epsilon, so I have added an option to enable/disable this feature.
Run base_qaoa.py
and change parameters as needed. In addition to the regular QAOA, I have also added an option to use ry gates for the counterdiabatic terms in the DC-QAOA. Below is an example of a DC-QAOA circuit (1 layer) for the 8-qubit system.
Some other additional features available in this code:
- Adding gaussian noise to entries (quadratic and linear terms). This can be useful just for the user to understand how the graph structure can be affected by random perturbations.
- Visualizing the cost landscape (i.e. plotting the expectation value from running the circuit against beta and gamma for a single-layer QAOA)
- The optimizer used here is COBYLA, but the one in the paper is quantum gradient descent. Drawing comparisons between the two would be useful in the future.
I have also made a GPU-accelerated implementation of the code and will release it in the future if there's interest. Preliminarily, each iteration takes longer but the QAOA converges in fewer iterations.
Thanks to the authors of the paper, Dr. Qi-Ming Ding, Dr. Yi-Ming Huang, and Dr. Xiao Yuan, for publishing their results and serving as the inspiration for this code implementation.
The Qiskit SDK has also been integral to the development of this study.
This work was done as part of an internship at the Regeneron Genetics Center (RGC), exploring the current and future potential for the application of quantum algorithms to the biological realm. I am deeply grateful to my advisor, Dr. Jeffrey Reid, for introducing me to quantum computing, getting me excited about the subject and for his guidance throughout.