This directory contains example scripts demonstrating how to use QDK/Chemistry for various quantum computing chemistry tasks.
Important: The
mainbranch is the active development branch and may contain changes that are incompatible with the version ofqdk-chemistryinstalled via pip. If you installedqdk-chemistryfrom PyPI (e.g.,pip install qdk-chemistry), checkout thestable/major.minorbranch corresponding to your installed version to ensure the examples work correctly. For example, if you haveqdk-chemistry1.0.x installed:git clone https://github.com/microsoft/qdk-chemistry.git cd qdk-chemistry git checkout stable/1.0You can check your installed version with
pip show qdk-chemistry.
The base pip install qdk-chemistry is sufficient for importing the library, but running the examples requires additional dependencies.
The table below summarizes which optional extras or packages are needed for each example:
| Example | Install command |
|---|---|
qpe_stretched_n2.ipynb |
pip install 'qdk-chemistry[jupyter]' |
state_prep_energy.ipynb |
pip install 'qdk-chemistry[jupyter]' |
factory_list.ipynb |
pip install 'qdk-chemistry[plugins]' |
interoperability/pennylane/ |
pip install pennylane |
interoperability/qiskit/ |
pip install 'qdk-chemistry[qiskit-extras]' |
interoperability/openFermion/ |
pip install 'qdk-chemistry[openfermion-extras]' |
interoperability/rdkit/ |
pip install rdkit |
To install everything needed for all examples at once:
python -m pip install 'qdk-chemistry[all]'
python -m pip install pennylane rdkitdata: Data directory for examplesfactory_list.ipynb: Jupyter notebook that lists available factory methods in QDK/Chemistry along with their descriptions and settingslanguage/cpp: C++ example programs using the QDK/Chemistry C++ APIlanguage/sample_sci_workflow.py: Python script demonstrating a sample classical workflow for selected CI quantum chemistry calculations.qpe_stretched_n2.ipynb: Jupyter notebook demonstrating multi-reference quantum chemistry state preparation and iterative quantum phase estimationstate_prep_energy.ipynb: Jupyter notebook demonstrating quantum state preparation and energy calculation using quantum simulators.
Additional curated datasets and benchmark materials that complement these examples are available at microsoft/qdk-chemistry-data.
The interoperability/pennylane directory contains example programs demonstrating interoperability between QDK/Chemistry and PennyLane, including:
qpe_no_trotter.py: Example of Quantum Phase Estimation (QPE) without Trotterization using PennyLane and QDK/Chemistry.
The interoperability/qiskit directory contains example programs demonstrating interoperability between QDK/Chemistry and Qiskit, including:
iqpe_model_hamiltonian.py: Example of Iterative Quantum Phase Estimation (IQPE) using a model Hamiltonian with Qiskit and QDK/Chemistry.iqpe_no_trotter.py: Example of Iterative Quantum Phase Estimation (IQPE) without Trotterization using Qiskit and QDK/Chemistry.iqpe_trotter.py: Example of Iterative Quantum Phase Estimation (IQPE) with Trotterization using Qiskit and QDK/Chemistry.
The interoperability/openFermion directory contains example programs demonstrating interoperability between QDK/Chemistry and OpenFermion, including:
molecular_hamiltonian_jordan_wigner.py: Example of Jordan-Wigner transformation using OpenFermion and QDK/Chemistry.
The interoperability/rdkit directory contains example programs demonstrating interoperability between QDK/Chemistry and RDKit, including:
sample_rdkit_geometry.py: Example of obtaining geometry from RDKit and calculate a simple energy with QDK/Chemistry.