{ "cells": [ { "cell_type": "markdown", "id": "083f9cb1-82a6-4147-8594-b32ff4dc9666", "metadata": {}, "source": [ "Fe4N2 - 3 - calculations on Quantinuum hardware \n", "===============================================" ] }, { "cell_type": "markdown", "id": "60c1176b-3c18-414b-a031-420dd2526699", "metadata": {}, "source": [ "This part marks the conclusion of the three-part series tutorial, and the user will learn how to conduct both emulator and hardware calculations using Quantinuum resources on a system more complex than [H2](InQ_htut_qsys_H2.ipynb). It is important to note that one should run the [first part](InQ_tut_fe4n2_1.ipynb) and [second part](InQ_tut_fe4n2_2.ipynb) before proceeding to this tutorial. Additional details regarding the chemical systems, methodologies, and outcomes presented in this tutorial series are available in the associated [research paper](https://doi.org/10.1039/D3CP05167F). \n", "\n", "Let us move beyond a simple single-point energy calculation that is neither optimized nor variationally solved. Instead, we build upon the results obtained in the second part of this tutorial series, where the Adaptive Variational Quantum Eigensolver (ADAPT-VQE) algorithm was used to compute the total energy of the Fe$_3$N$_2$ molecule. This tutorial is also an extension of the initial part of the series, which provides detailed insights into the classical workflow necessary for defining the system.\n", "\n", "To carry out these calculations, access to the Quantinuum Systems is essential, which can be obtained by contacting Quantinuum support. Additionally, the user will require Hardware Quantum Credits (HQCs) to run jobs on Quantinuum Systems. Users with credentails and HQCs can access hardware and emulators through [pytket-quantinuum](https://docs.quantinuum.com/tket/extensions/pytket-quantinuum/) or via [Quantinuum Nexus](https://docs.quantinuum.com/nexus/trainings/notebooks/basics/getting_started.html).\n", "\n", "\n", "Here are the steps outlined:\n", "\n", "* Import the parameters characterizing the ground-state wavefunction.\n", "\n", "* Conduct calculations on the Quantinuum emulator utilizing the PMSV error mitigation method.\n", "\n", "* Execute calculations on the Quantinuum hardware using the PMSV error mitigation method." ] }, { "cell_type": "markdown", "id": "814ffcc8-65e2-4cc8-8714-290aac3c6431", "metadata": {}, "source": [ "To begin with, let us start by importing the qubit Hamiltonian, the fermionic state and space from the first part, along with the ground state parameters and the list of fermionic pool operators from the [second part](InQ_tut_fe4n2_2.ipynb) of this tutorial." ] }, { "cell_type": "code", "execution_count": null, "id": "c903f62b-6088-4747-ad06-ec1634f1b593", "metadata": {}, "outputs": [], "source": [ "import pickle\n", "\n", "with open('InQ_tut_fe4n2_qubit_hamiltonian.pickle', 'rb') as handle:\n", " qubit_hamiltonian = pickle.load(handle)\n", "\n", "with open('InQ_tut_fe4n2_state.pickle', 'rb') as handle:\n", " state = pickle.load(handle) \n", "\n", "with open('InQ_tut_fe4n2_space.pickle', 'rb') as handle:\n", " space = pickle.load(handle) \n", "\n", "with open('InQ_tut_fe4n2_gs_parameters.pickle', 'rb') as handle:\n", " gs_parameters = pickle.load(handle) \n", " \n", "with open('InQ_tut_fe4n2_exponents_with_symbols.pickle', 'rb') as handle:\n", " exponents_with_symbols = pickle.load(handle)\n", "\n", "import warnings\n", "warnings.filterwarnings('ignore')" ] }, { "cell_type": "markdown", "id": "96d66b6d-93ed-4fb5-b413-1ad51fa8a6f2", "metadata": {}, "source": [ "InQuanto employs an efficient ansatz circuit compilation approach, provided by the `FermionSpaceStateExpChemicallyAware` class. This method is designed to minimize the computational resources required.\n", "\n", "Parameters used:\n", "\n", "- `fermion_operator_exponents` – Contains exponents and symbols. Assuming input exponents are ordered as single exponents first, followed by double exponents.\n", "- `fermion_state` – Initial fermionic reference state." ] }, { "cell_type": "code", "execution_count": null, "id": "98608a33-1007-4a6f-a8ed-f9273b5be7e5", "metadata": {}, "outputs": [], "source": [ "from inquanto.ansatzes import FermionSpaceStateExpChemicallyAware\n", "\n", "ansatz=FermionSpaceStateExpChemicallyAware(fermion_operator_exponents=exponents_with_symbols, fermion_state=state)" ] }, { "cell_type": "markdown", "id": "e7dc5130-db75-40ad-bf5a-3bcab2ba21fe", "metadata": {}, "source": [ "The `state_circuit` attribute within InQuanto represents the symbolic state circuit, complete with a default compilation. In a Jupyter environment, one can visualize this symbolic state circuit by making use of the `render_circuit_jupyter` function provided by the pytket library." ] }, { "cell_type": "code", "execution_count": null, "id": "782eeefe-314d-45c9-a174-0164b9e21971", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "