These samples demonstrate the use of the Quantum Chemistry library.
Each sample is provided as a Visual Studio 2019 C# or project in their respective directories.
Each of these samples are described below.
Most of the samples consist of a Q# source file with detailed comments explaining the sample and a commented classical program Program.cs
to call into Q# operations and functions.
All the C# samples may be run with default settings by entering their root directory in command line and entering dotnet run
.
These samples focus on simple models in chemistry and material sciences. They are thoroughly commented to build familiarity with usage of the chemistry library.
-
CreateHubbardHamiltonian: Construct a Hamiltonian describing a simple one-dimensional Hubbard model.
-
SimulateHubbardHamiltonian: Import the Hubbard Hamiltonian constructed in CreateHubbardHamiltonian, and obtain estimates of its energy levels by simulating the quantum phase estimation algorithm.
-
MolecularHydrogen: Construct a Hamiltonian describing the Hydrogen molecule, and obtain estimates of its energy levels by simulating the quantum phase estimation algorithm.
-
MolecularHydrogenGUI: Import the Q# operations for energy estimation in MolecularHydrogen to create a plot of Hydrogen ground state energy with respect to distance between its two Hydrogen atoms.
-
LithiumHydrideGUI: Import the Q# operations for energy estimation in MolecularHydrogen to create a plot of Lithium Hydride ground state and excited energies with respect to distance between its atoms.
These advanced samples target arbitrary chemistry or material science models that are loaded from a file.
-
AnalyzeHamiltonian: Loads a spin-orbital Hamiltonian from a file containing orbital integrals. Features of the Hamiltonian are then computed. Currently, only the L1-norm of the coefficients is computed.
-
GetGateCount: Loads a spin-orbital Hamiltonian from a file containing orbital integrals. A resource estimate for running a single Trotter step or Qubitization step is then executed. Optional integration with PowerShell is also demonstrated.
-
RunSimulation: Loads a spin-orbital Hamiltonian from a file containing orbital integrals. A full quantum simulation of phase estimation is then run on a quantum simulation of the Hamiltonian. An estimate of an energy eigenstate is then returned. Note that the probability of returning the lowest energy state depends on the overlap of the initial state with the true ground state.
These samples show how to use Q# chemistry library from Python to load Broombridge schema files and run a simulation to obtain estimates of its energy levels.
- PythonIntegration: Basic sample on how to integrate Q# with Python.