H2 Ground State Energy Calculation background cover

H2 Ground State Energy Calculation

Learn how to compete on the Aqora platform

aqora

Hosted by

aqora

Setting everything up

First things first! To get started with using Aqora you will need to signup for an Aqora account. Once you have signed up, come back here to follow the next steps. We also recommend you have Visual Studio Code as it will be used in this tutorial as a reference editor. To follow along you can open a new window in Visual Studio code and continue with the steps below.
Visual Studio Code > File > New Window

Installing the CLI

Aqora provides a command line interface (or CLI) to interact with the platform. The CLI will help you download templates, configure your environment, and upload your solutions. To install the CLI you will need to have Python 3.9 or greater installed on your machine. If you are using Visual Studio Code, make sure you also have the Python and Jupyter extensions installed in Visual Studio Code Once you have everything installed you can follow the instructions below to install the CLI.
Open the terminal in Visual Studio Code by clicking on Terminal > New Terminal
Visual Studio Code > Terminal > New Terminal
In the terminal, run one of the following commands to install the CLI
# with pip
pip install aqora-cli

# with pipx
pipx install aqora-cli

# on Windows with Python installed from python.org
py -m pip install aqora-cli

# on Windows with Python installed from the Windows Store
python -m pip install aqora-cli
If you are running on Windows there are helpful tips on the PyPi page to help you get started.
Installing the CLI
To verify the installation, the following should output helpful information
aqora help
aqora help

Logging in

To log in to the CLI, you will need to have an account on Aqora. If you don't have an account, you can sign up here. Once you have an account, you can log in to the CLI by running the following command in the terminal
aqora login
This will open a browser window where you can log in to your Aqora account. Once you have logged in, you can close the browser window and return to the terminal.
Logging in

Downloading the template

To download the template for this tutorial, you can run the following command in the terminal
aqora template h2-groundstate-energy
Downloading the template
This will download the template into a folder called h2-groundstate-energy.
Template downloaded
You can then open the folder in Visual Studio Code by running the following command in the terminal
aqora lab -p h2-groundstate-energy
Opening the folder in Visual Studio Code
This should open the folder in Visual Studio Code. If you receive the following prompt, you can click on "Yes, I trust the authors".
Trust the authors

Running the Jupyter notebook

The template comes with a Jupyter notebook that has an example implementation of the solution using Pennylane. You can find the notebook under submission/start_here.ipynb.
Jupyter notebook
To run the notebook, you can click on the Run All button in the toolbar.
Run All
You may need to select the kernel for the notebook. You can select the kernel by clicking on Python Environments
Python environments
And then clicking on .venv
.venv kernel
The notebook will run and you should see the output of the cells in the notebook.
output

A note on the Environment

Aqora helps you manage your environment by providing a virtual environment to run in. This ensures that you have the correct dependencies installed and that your code runs in a consistent environment. You can add dependencies to your environment by opening the terminal and running
aqora add <dependency name>

Getting on the Leaderboard

This is the most exciting part! Once you have your solution ready, you'll want to submit it to see how you rank against other participants. To see your score and get your solution ready to be submitted run
aqora test
Running tests
This will run the tests on your solution and give you a score! You can iterate on your solution to see if you can increase your score. Once you are happy with your score, you can upload your solution and your results by running
aqora upload
Uploading the solution
Congratulations! You have just made your first submission to the Aqora Platform!
Your submission will soon appear on the leaderboard and in your profile’s submissions section.

Iterating on your solution

You may want to further tweak your solution to improve your score. For this, consider adjusting:
  • Number of Iterations: Increase max_iterations to give the algorithm more room to converge to a lower energy state. However, be mindful of the trade-off between computational time and accuracy.
  • Step Size: The step_size in the gradient descent optimizer controls the learning rate. Experiment with this value to find a balance between convergence speed and the risk of overshooting the minimum.
  • Initial Parameters: The initial parameters for the quantum circuit might influence the optimization path.
After making changes, run aqora test again to see if your modifications have improved the performance. Creating an optimized solution requires this iterative process of testing and refining.
You can run aqora upload again to submit your updated solution to the platform, and climb the leaderboard!

Using Phototonic Quantum Computing

Photonics provides a promising pathway to practical quantum computing. Quandela's photonic quantum computing platform is a leading example of this technology. Included in the template you can find a notebook that demonstrates how to use Quandela's photonic quantum computing platform to solve the problem using their Perceval SDK. If you want to give it a try, you can find the notebook under submission/perceval.ipynb. To use the notebook with aqora test, open the pyproject.toml and change the following lines
[tool.aqora.refs]
groundstate_energy = { path = "submission.start_here", notebook = true }
# groundstate_energy = { path = "submission.perceval", notebook = true }
to
[tool.aqora.refs]
# groundstate_energy = { path = "submission.start_here", notebook = true }
groundstate_energy = { path = "submission.perceval", notebook = true }
Everything else should be the same!

In summary

Joining Aqora's competitions offers you the chance to showcase your quantum skills to a larger audience in addition to solving challenging tasks. Aqora contests frequently provide alluring incentives, such as cash payouts, badges, internships, and more. Every challenge offers you the chance to hone your quantum computing talents, gain recognition and incentives, and learn more.
Once more, congratulations on your achievements and contributions to the realm of quantum computing!
See other contests related to quantum computing at https://aqora.io.