page_type | languages | products | urlFragment | description | ||||
---|---|---|---|---|---|---|---|---|
sample |
|
|
h2-command-line |
This sample demonstrates using Quantum Development Kit to estimate ground state energies of molecular hydrogen. |
This sample demonstrates using Q# to estimate the ground state energy of molecular hydrogen (H₂), outputting the results to the command line.
- The Microsoft Quantum Development Kit.
This sample can be run in a number of different ways, depending on your preferred environment.
At a terminal, run the following command:
python host.py
At a terminal, run the following command:
dotnet run
Open the folder containing this sample in Visual Studio ("Open a local folder" from the Getting Started screen or "File → Open → Folder..." from the menu bar) and set H2SimulationSampleCmdLine.csproj
as the startup project.
Press Start in Visual Studio to run the sample.
- Operations.qs: Q# code defining how estimate H₂ energy levels.
- Host.cs: C# code to call the operations defined in Q#.
- H2SimulationSampleCmdLine.csproj: Main C# project for the example.
- host.py: a sample Python program to call the Q# simulation operation.