# Circuit of the month Jan 22: a hardware-efficient variational circuit

Given a molecule, the Hamiltonian describes the interactions between all electrons and nuclei.

Calculating the energies of a molecular Hamiltonian, and especially its ground state, allows us to understand the chemical properties of a molecule. Since the molecular Hamiltonian is inherently quantum, quantum computing can be used to calculate such properties efficiently by leveraging the same quantum effects in appropriate quantum algorithms. This is done in 3 steps:

- Calculating the molecular Hamiltonian for the desired molecule.
- Generating an appropriate variational quantum circuit to calculate the Hamiltonian's ground state.
**Today, we will focus on this step, demonstrate how to create a variational circuit.** - Executing the desired quantum circuit as part of a hybrid quantum-classical algorithm.

The ground state of a Hamiltonian is found by using an appropriate variational quantum circuit (usually called an Ansatz), and then combining it with a classical optimizer to find the minimal expectation value for the Hamiltonian. In NISQ-era devices, short and hardware-fitting quantum circuits are preferred, to reduce the noise and get better results.

In the following example, we demonstrate how to generate a hardware-efficient Ansatz, i.e. an Ansatz that is generated to fit a specific hardware.

In this example we will use a 4-qubit hardware, with full connectivity.

Using Classiq's textual model, the code looks like this:

Alternatively, one can synthesize the same circuit using Classiq's Python SDK:

Here is the resulting output circuit:

Given a molecule, the Hamiltonian describes the interactions between all electrons and nuclei.

Calculating the energies of a molecular Hamiltonian, and especially its ground state, allows us to understand the chemical properties of a molecule. Since the molecular Hamiltonian is inherently quantum, quantum computing can be used to calculate such properties efficiently by leveraging the same quantum effects in appropriate quantum algorithms. This is done in 3 steps:

- Calculating the molecular Hamiltonian for the desired molecule.
- Generating an appropriate variational quantum circuit to calculate the Hamiltonian's ground state.
**Today, we will focus on this step, demonstrate how to create a variational circuit.** - Executing the desired quantum circuit as part of a hybrid quantum-classical algorithm.

The ground state of a Hamiltonian is found by using an appropriate variational quantum circuit (usually called an Ansatz), and then combining it with a classical optimizer to find the minimal expectation value for the Hamiltonian. In NISQ-era devices, short and hardware-fitting quantum circuits are preferred, to reduce the noise and get better results.

In the following example, we demonstrate how to generate a hardware-efficient Ansatz, i.e. an Ansatz that is generated to fit a specific hardware.

In this example we will use a 4-qubit hardware, with full connectivity.

Using Classiq's textual model, the code looks like this:

Alternatively, one can synthesize the same circuit using Classiq's Python SDK:

Here is the resulting output circuit:

## 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.