# Finding the Ground State of H2O and Solving Other Hamiltonian Simulation Problems with Classiq

This note demonstrates how to use the Classiq platform to solve the Hamiltonian Simulation problem that was part of our recent coding competition. We then demonstrate a more complex example - simulating an H_{2}O molecule.

## Introduction

Chemical simulation is one of the most exciting applications for quantum computers. When precise simulations of electron-electron interactions are necessary, it is sometimes possible to use a classical computer, but classical computers struggle to simulate more complex molecular interactions. It is best to simulate these particle interactions at the quantum level, and an excellent way to do this is with a quantum computer.

The ability to accurately simulate molecular interactions will have extensive applications. When used for drug discovery, it will allow for the rapid development of vaccines and new cures for diseases. In materials research, we can hope to discover materials with higher strength-to-weight ratios and environmentally-friendly building materials.

## The Lithium Hydride Hamiltonian Simulation Problem

In our recent coding competition, we asked contestants to generate a circuit, using no more than ten qubits, that approximates the unitary e^{−iH}* *where H is the qubit hamiltonian of a LiH (lithium hydride) molecule. The LiH Hamiltonian is composed of 276 Pauli strings and can be found **here**. The approximation error should be less than 0.1, and the circuit should be composed only of the CX and single-qubit gates.

## Coding with Classiq

To solve this problem with Classiq, we use the Suzuki Trotter method, one of the most efficient ways to simulate Hamiltonians and generate quantum simulation circuits. Creating this circuit is straightforward. We specify the desired function of the circuit, and the platform generates an efficient quantum circuit. Here is the code:

Using Classiq's Python SDK - though an equivalent circuit can be designed using the Classiq extension in Visual Studio Code - we first specify that we are designing a Suzuki Trotter circuit. We import the Pauli string of the lithium hydride molecule and end the code with a few specifications for the Suzuki Trotter function. We specify the evolution coefficient, 1, and the desired order and repetition for our Suzuki Trotter function. We chose a single repetition because choosing to have more repetitions would yield a more precise but larger quantum simulation circuit.

That’s all! The interactive circuit, shown partially below, is available here and was generated using Classiq version 0.14.2. The circuit uses ten qubits, and has a** depth of 1057**.

To see how this compares to the solutions provided by competitors over the month-long competition, see here.

## Beyond Lithium Hydride

Classiq’s customers can employ the same approach to simulate more complex molecules. For instance, below is the code to both generate the Pauli string for and simulate an H_{2}O molecule.

And here** **is the resulting interactive circuit of **depth 2120** using only 9 qubits.

Classiq has packaged the domain expertise of dozens of its scientists and quantum software engineers into the software platform. The result: a system that can automatically generate efficient quantum circuits for complex problems, making it faster and easier than ever to solve real-life problems with quantum computing. When the circuits are of manageable size, Classiq creates solutions that are on par with the best manually-created circuits. When the circuits are larger than those a human can reasonably create, Classiq allows you to progress farther because of its powerful capabilities.

With Classiq, there is no need to work at the gate level. Instead, Classiq customers work at a higher level, specifying the desired functionality of the circuit and the applicable constraints, and allow the Classiq platform to find the right optimized implementation out of billions of options in a vast design space.

Schedule a live demonstration of the Classiq platform to see it in action, or contact us to learn how you can create industry-leading quantum circuits in minutes.

This note demonstrates how to use the Classiq platform to solve the Hamiltonian Simulation problem that was part of our recent coding competition. We then demonstrate a more complex example - simulating an H_{2}O molecule.

## Introduction

Chemical simulation is one of the most exciting applications for quantum computers. When precise simulations of electron-electron interactions are necessary, it is sometimes possible to use a classical computer, but classical computers struggle to simulate more complex molecular interactions. It is best to simulate these particle interactions at the quantum level, and an excellent way to do this is with a quantum computer.

The ability to accurately simulate molecular interactions will have extensive applications. When used for drug discovery, it will allow for the rapid development of vaccines and new cures for diseases. In materials research, we can hope to discover materials with higher strength-to-weight ratios and environmentally-friendly building materials.

## The Lithium Hydride Hamiltonian Simulation Problem

In our recent coding competition, we asked contestants to generate a circuit, using no more than ten qubits, that approximates the unitary e^{−iH}* *where H is the qubit hamiltonian of a LiH (lithium hydride) molecule. The LiH Hamiltonian is composed of 276 Pauli strings and can be found **here**. The approximation error should be less than 0.1, and the circuit should be composed only of the CX and single-qubit gates.

## Coding with Classiq

To solve this problem with Classiq, we use the Suzuki Trotter method, one of the most efficient ways to simulate Hamiltonians and generate quantum simulation circuits. Creating this circuit is straightforward. We specify the desired function of the circuit, and the platform generates an efficient quantum circuit. Here is the code:

Using Classiq's Python SDK - though an equivalent circuit can be designed using the Classiq extension in Visual Studio Code - we first specify that we are designing a Suzuki Trotter circuit. We import the Pauli string of the lithium hydride molecule and end the code with a few specifications for the Suzuki Trotter function. We specify the evolution coefficient, 1, and the desired order and repetition for our Suzuki Trotter function. We chose a single repetition because choosing to have more repetitions would yield a more precise but larger quantum simulation circuit.

That’s all! The interactive circuit, shown partially below, is available here and was generated using Classiq version 0.14.2. The circuit uses ten qubits, and has a** depth of 1057**.

To see how this compares to the solutions provided by competitors over the month-long competition, see here.

## Beyond Lithium Hydride

Classiq’s customers can employ the same approach to simulate more complex molecules. For instance, below is the code to both generate the Pauli string for and simulate an H_{2}O molecule.

And here** **is the resulting interactive circuit of **depth 2120** using only 9 qubits.

Classiq has packaged the domain expertise of dozens of its scientists and quantum software engineers into the software platform. The result: a system that can automatically generate efficient quantum circuits for complex problems, making it faster and easier than ever to solve real-life problems with quantum computing. When the circuits are of manageable size, Classiq creates solutions that are on par with the best manually-created circuits. When the circuits are larger than those a human can reasonably create, Classiq allows you to progress farther because of its powerful capabilities.

With Classiq, there is no need to work at the gate level. Instead, Classiq customers work at a higher level, specifying the desired functionality of the circuit and the applicable constraints, and allow the Classiq platform to find the right optimized implementation out of billions of options in a vast design space.

Schedule a live demonstration of the Classiq platform to see it in action, or contact us to learn how you can create industry-leading quantum circuits in minutes.

## About "The Qubit Guy's Podcast"

Hosted by The Qubit Guy (Yuval Boger, our Chief Marketing Officer), the podcast hosts thought leaders in quantum computing to discuss business and technical questions that impact the quantum computing ecosystem. Our guests provide interesting insights about quantum computer software and algorithm, quantum computer hardware, key applications for quantum computing, market studies of the quantum industry and more.

If you would like to suggest a guest for the podcast, please contact us.