### Quantum Circuit Simulation Example Source: https://docs.quantinuum.com/inquanto/_downloads/b5addb5c35580c0fce44e6c478dda65a/InQ_htut_Aer_H2.ipynb This snippet demonstrates the basic setup and execution of a quantum circuit simulation. ```python import numpy as np from inquanto.simulators import AerSimulator from inquanto.circuits import Circuit # Define a simple circuit circuit = Circuit().h(0).cx(0, 1) # Initialize the simulator simulator = AerSimulator() # Run the simulation result = simulator.run(circuit) print(result) ``` -------------------------------- ### Phayes output example Source: https://docs.quantinuum.com/inquanto/extensions/inquanto-phayes.html Example output showing the energy estimation results after 50 updates. ```text i_update = 50 Energy(mu) = -1.137409 hartree Energy(sigma) = 0.001065 hartree Representation = von Mises ``` -------------------------------- ### Initialize VQE with InQuanto Source: https://docs.quantinuum.com/inquanto/_downloads/bf905acceac178acdbe7862a0b7db03e/InQ_tut_vqe_2.ipynb Basic setup for configuring a VQE algorithm instance. ```python from inquanto.algorithms import VQE from inquanto.ansatz import AnsatzUCCSD from inquanto.core import QuantumState # Example configuration ansatz = AnsatzUCCSD(qubit_operator=hamiltonian) vqe = VQE(ansatz=ansatz, expectation_estimator=estimator) ``` -------------------------------- ### Initialize VQE with InQuanto Source: https://docs.quantinuum.com/inquanto/_downloads/bf905acceac178acdbe7862a0b7db03e/InQ_tut_vqe_2.ipynb Basic setup for a VQE instance using the InQuanto library. ```python from inquanto.algorithms import VQE from inquanto.ansatz import Ansatz from inquanto.operators import QubitOperator # Example setup ansatz = Ansatz(...) operator = QubitOperator(...) vqe = VQE(ansatz=ansatz, operator=operator) ``` -------------------------------- ### Protocol output examples Source: https://docs.quantinuum.com/inquanto/tutorials/InQ_tut_helios.html Example output for circuit count and energy evaluation. ```text Number of circuits: 2 ``` ```text -1.1357335665698658 ``` -------------------------------- ### Bayesian QPE Output Examples Source: https://docs.quantinuum.com/inquanto/extensions/inquanto-phayes.html Example console outputs showing the update iteration and representation mode. ```text i_update = 1 representation = Fourier ``` ```text i_update = 11 representation = Fourier ``` ```text i_update = 21 representation = Fourier ``` ```text i_update = 31 representation = von Mises ``` ```text i_update = 41 representation = von Mises ``` -------------------------------- ### Configure simulator and optimizer Source: https://docs.quantinuum.com/inquanto/tutorials/InQ_tut_vqe_1.html Setup the AerStateBackend for simulation and the Scipy minimizer for parameter optimization. ```python # install pytket-qiskit using e.g. pip install pytket-qiskit if necessary from pytket.extensions.qiskit import AerStateBackend from inquanto.minimizers import MinimizerScipy backend = AerStateBackend() minimizer = MinimizerScipy(method="L-BFGS-B") ``` -------------------------------- ### Example Output Source: https://docs.quantinuum.com/inquanto/manual/algorithms/qpe_iterative.html Sample output showing energy and precision results. ```text Energy = -1.906250 hartree precision = 0.015625 hartree ``` -------------------------------- ### Example Output Source: https://docs.quantinuum.com/inquanto/manual/algorithms/algorithms_sceom.html Sample output showing timing information and calculated eigenvalues. ```text # TIMER Measure and calculate M matrix elements: BEGINS AT 2026-07-22 12:01:04.062064 # TIMER Measure and calculate M matrix elements: ENDS - DURATION (s): 0.0759027 [0:00:00.075903] # TIMER Find eigenvalues of M matrix: BEGINS AT 2026-07-22 12:01:04.138061 # TIMER Find eigenvalues of M matrix: ENDS - DURATION (s): 0.0005775 [0:00:00.000578] QSCEOM eigenvalues: [ 0.552 -0.136 -0.495] Exact eigvals : [-1.137 -0.495 -0.495 -0.495 -0.136 0.552] ``` -------------------------------- ### Install keyrings.alt backend Source: https://docs.quantinuum.com/inquanto/introduction/troubleshooting.html Install the keyrings.alt package to provide alternative backends for the keyring module on Unix systems. ```bash pip install keyrings.alt ``` -------------------------------- ### Initialize VQE with InQuanto Source: https://docs.quantinuum.com/inquanto/_downloads/bf905acceac178acdbe7862a0b7db03e/InQ_tut_vqe_2.ipynb Setup the VQE algorithm using a specified ansatz and optimizer. ```python from inquanto.algorithms import VQE from inquanto.ansatz import AnsatzCircuit from inquanto.optimizers import Optimizer # Example setup for VQE ansatz = AnsatzCircuit(circuit=my_circuit) optimizer = Optimizer(method="COBYLA") vqe = VQE(ansatz=ansatz, optimizer=optimizer) ``` -------------------------------- ### Calculate derivative overlap with UCCSD ansatz Source: https://docs.quantinuum.com/inquanto/manual/protocols/derivative.html Example demonstrating the setup and execution of the HadamardTestDerivativeOverlap protocol for a UCCSD ansatz. ```python from inquanto.express import get_system from inquanto.ansatzes import FermionSpaceAnsatzUCCSD from inquanto.protocols import HadamardTestDerivativeOverlap _, fermion_space, hf_state = get_system("h2_sto3g.h5") ansatz = FermionSpaceAnsatzUCCSD( fermion_space, hf_state ) params = ansatz.state_symbols.construct_random() symbols = ansatz.state_symbols.symbols print(params) protocol = HadamardTestDerivativeOverlap(AerBackend(), shots_per_circuit=5000) protocol.build( parameters=params, state=ansatz, diff_symbols=(symbols[1], symbols[1]) ) protocol.compile_circuits() protocol.run() protocol.evaluate_derivative_overlap() ``` -------------------------------- ### Initialize Selene Backend Source: https://docs.quantinuum.com/inquanto/_downloads/9e888857feb4adf83cbe1e2da5e2c4b8/InQ_tut_helios.ipynb Sets up the Selene backend using the QuEST simulator via the hugr module. ```python from inquanto.hugr.hugr_utils import SELENE backend = SELENE.QUEST ``` -------------------------------- ### Timer block start Source: https://docs.quantinuum.com/inquanto/manual/ansatze/hva.html Internal timer block start marker. ```text # TIMER BLOCK-0 BEGINS AT 2026-07-22 12:04:00.572631 ``` -------------------------------- ### Initialize VQE and Run Source: https://docs.quantinuum.com/inquanto/_downloads/bf905acceac178acdbe7862a0b7db03e/InQ_tut_vqe_2.ipynb This snippet demonstrates the initialization of the VQE algorithm and its execution within the InQuanto framework. ```python from inquanto.algorithms import VQE from inquanto.ansatz import AnsatzProduct from inquanto.computational_framework import ComputationalFramework from inquanto.operators import QubitOperator from inquanto.optimizer import OptimizerSciPy # Define the Hamiltonian hamiltonian = QubitOperator("X0 X1") + QubitOperator("Z0") # Define the Ansatz ansatz = AnsatzProduct([QubitOperator("Y0"), QubitOperator("X1")]) # Initialize VQE vqe = VQE(ansatz=ansatz, hamiltonian=hamiltonian, optimizer=OptimizerSciPy(method="COBYLA")) # Run VQE result = vqe.run() ``` -------------------------------- ### VQE Output Examples Source: https://docs.quantinuum.com/inquanto/manual/minimizers.html Example outputs for energy and gradient calculations. ```text VQE energy with parameters at [0, 0, 0]: -1.117505884204331 Gradients of parameters at [0, 0, 0]: [0.359 0. 0. ] ``` -------------------------------- ### Initialize and Print QubitState Objects Source: https://docs.quantinuum.com/inquanto/api/inquanto/states.html Demonstrates creating QubitState instances using list-based configurations, QubitStateString objects, and dictionary mappings of state strings to coefficients. ```python >>> qs0 = QubitState([1, 1, 0, 0], 1) >>> print(qs0) (1, {q[0]: 1, q[1]: 1, q[2]: 0, q[3]: 0}) >>> qss = QubitStateString({Qubit(0):1,Qubit(1):1,Qubit(2):0,Qubit(5):0}) >>> qs1 = QubitState(qss, 1) >>> print(qs1) (1, {q[0]: 1, q[1]: 1, q[2]: 0, q[5]: 0}) >>> qss0 = QubitStateString({Qubit(0):1,Qubit(1):1,Qubit(2):0,Qubit(5):0}) >>> qss1 = QubitStateString({Qubit(0):1,Qubit(1):0,Qubit(2):1,Qubit(5):0}) >>> qs2 = QubitState(((0.9, qss0), (0.1, qss1))) >>> print(qs2) (0.9, {q[0]: 1, q[1]: 1, q[2]: 0, q[5]: 0}), (0.1, {q[0]: 1, q[1]: 0, q[2]: 1, q[5]: 0}) >>> qss0 = QubitStateString({Qubit(0):1,Qubit(1):1,Qubit(2):0,Qubit(5):0}) >>> qss1 = QubitStateString({Qubit(0):1,Qubit(1):0,Qubit(2):1,Qubit(5):0}) >>> qs3 = QubitState({qss0: 0.9, qss1: 0.1}) >>> print(qs3) (0.9, {q[0]: 1, q[1]: 1, q[2]: 0, q[5]: 0}), (0.1, {q[0]: 1, q[1]: 0, q[2]: 1, q[5]: 0}) ``` -------------------------------- ### Timer block start Source: https://docs.quantinuum.com/inquanto/manual/algorithms/algorithms_vqe.html Log output indicating the start of a timer block. ```text # TIMER BLOCK-0 BEGINS AT 2026-07-22 12:01:58.398104 ``` -------------------------------- ### Output of Psi4 FCIDUMP Example Source: https://docs.quantinuum.com/inquanto/manual/spaces.html Expected output from the Psi4 integration example. ```text 0.5291772106699999 0.5291772106699999 ``` -------------------------------- ### Configure and run MinimizerBasinHopping Source: https://docs.quantinuum.com/inquanto/manual/minimizers.html Demonstrates initializing MinimizerBasinHopping and using it within an AlgorithmVQE workflow. ```python from inquanto.minimizers import MinimizerBasinHopping minimizer=MinimizerBasinHopping(disp=True, niter=5, T=1e-3) vqe = AlgorithmVQE( objective_expression=ev, minimizer=minimizer, initial_parameters=ansatz.state_symbols.construct_zeros() ) vqe.build(protocol_objective=SparseStatevectorProtocol(AerStateBackend())) vqe.run() print("VQE Energy:", vqe.generate_report()["final_value"]) ``` -------------------------------- ### Configure and Run VQE Source: https://docs.quantinuum.com/inquanto/_downloads/bf905acceac178acdbe7862a0b7db03e/InQ_tut_vqe_2.ipynb This snippet demonstrates the core setup for a VQE calculation, including the definition of the ansatz and the optimizer. ```python from inquanto.algorithms import VQE from inquanto.ansatz import FermionAnsatz from inquanto.minimizers import ScipyMinimizer # Define the ansatz ansatz = FermionAnsatz(n_qubits=4, n_electrons=2) # Define the optimizer optimizer = ScipyMinimizer(method="COBYLA") # Initialize VQE vqe = VQE(ansatz=ansatz, minimizer=optimizer) # Run the VQE result = vqe.run(hamiltonian=hamiltonian) ``` -------------------------------- ### HadamardTest output examples Source: https://docs.quantinuum.com/inquanto/manual/protocols/expval.html Example outputs for the number of circuits and the evaluated energy. ```text Number of circuits: 14 ``` ```text np.float64(-1.141235691507334) ``` -------------------------------- ### Example Code Snippet Source: https://docs.quantinuum.com/inquanto/_downloads/7194654a526c8b6b757928e1198420cd/InQ_htut_qsys_H2.ipynb This is an example code snippet extracted from the provided source. ```text U7vm+dK//2nRMA23tQNLT+fr162eaFGhZnGtP2B8w2JsB6MOl8oal0wcPqrCwsML9BOA+2tAD8AqtlqfZDr2B1//Ey2uz+Le//c1kK0aMGCEffvihy5BJuowOhaM3EpVVL62M3kRqVkKrm+pLewx2Dhh022PGjDHt+Mq7+dfqnVXRdeh2tM2uc3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k2aZKp+l35ddNFFtVaGRx99VPr06ePWfOWVtUuXLtJQ0cs9AAAAADRgGry//vrrLtPCwsKkLurevbt8/fXXLtOCg30b1ubn50toaKjURWToAQAAAKAB0+C9RYsWLq/GjRubz7755hsTzH7//feO+WfPnm2GWjt06JB5//nnn8uQIUMkLi7ODNt36aWXyvbt2122kZqaKtdee600adJEoqKipH///rJs2TJ544035LHHHpN169Y5Mu46rSIavJcua0JCguPztm3byp///Ge58cYbJTo6Wlq3bi2vvPKKyzr27t0r48ePN+XV8lxxxRWya9cul1oLo0ePlpkzZ0pSUpJ07tzZTP/xxx9NTYLw8HBT/gULFpjyrl271owt37FjR3nqqadctqWf6Tzbtm0TXyCgBwAAAAAfyc7OrvCVm5vr9rwnT550a15vGzZsmNxzzz1yww03SEZGhqxZs0Yefvhhee2116R58+aOskydOlVWrlwpCxculMDAQLnyyiuluLjYfJ6VlSXnnnuu7Nu3Tz766CMTvN9///3m86uvvlqmTZtmMu8HDhwwL51WE08//bQJuLWsd9xxh9x+++2yefNmxxBxI0eONMG+PqRYsmSJNGrUyNRS0Ey8ne6HLvPVV1/JJ598IpmZmXLZZZdJz549ZfXq1fL444/L//3f/znm16BdHyKUrumg78855xwT7PuEDZXKyMiw6WHSnwAAAABQ2smTJ22//PKL+VmaxhIVvUaNGuUyb2RkZIXznnvuuS7zJiQklDufpyZOnGgLCgqyRUVFubxmzpzpmCcvL8/Wp08f2/jx423dunWzTZkypdJ1Hj582JTl559/Nu9ffvllW3R0tO3o0aPlzj9jxgxb7969qyyrzhcYGFimrLfeeqtjnjZt2tiuv/56x/vi4mJbs2bNbC+++KJ5//bbb9s6d+5spjvvX0REhO2LL75wHJPmzZub6Xa6fHx8vMt3/Oqrr5r9XLNmjXm/b98+cyyXLVtm3ufn55vv6Y033vD4vHE3DqUNPQAAAAA0YOedf568+OKLLtO0KrqdVrmfM2eO9OrVS9q0aSPPPPOMy7xbt26VRx55xFShP3LkiCMzv2fPHunRo4epdp6SkuKyzurS6u+a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------- ### SCEOM Analysis Dataframe Output Example Source: https://docs.quantinuum.com/inquanto/manual/algorithms/algorithms_sceom.html Example output of the SCEOM analysis dataframe. ```text 0 -0.0 0.0 -0.0 1 -0.0 0.0 -0.0 2 -0.0 2.0 -0.0 ``` -------------------------------- ### Configure Simulator and Optimizer Source: https://docs.quantinuum.com/inquanto/_downloads/fd812ffb8a2255aa46fcc33ef071bfee/InQ_tut_vqe_1.ipynb Initializes the Qiskit AerStateBackend for state vector simulation and sets up a Scipy L-BFGS-B minimizer for parameter optimization. ```python # ############################### # # SIMULATOR AND OPTIMIZER DETAILS # # ############################### # # install pytket-qiskit using e.g. pip install pytket-qiskit if necessary from pytket.extensions.qiskit import AerStateBackend from inquanto.minimizers import MinimizerScipy backend = AerStateBackend() minimizer = MinimizerScipy(method="L-BFGS-B") ``` -------------------------------- ### Initialize AlgorithmQSE Source: https://docs.quantinuum.com/inquanto/manual/algorithms/algorithms_qse.html Configure the QSE algorithm with the computable matrices and VQE parameters. ```python from inquanto.computables.composite import QSEMatricesComputable from inquanto.algorithms import AlgorithmQSE vqe_parameters = ansatz.state_symbols.construct_from_array( [0.0, 0.0, -0.107233493519281] ) computable = QSEMatricesComputable( state=ansatz, hermitian_operator=qubit_hamiltonian, expansion_operators=expansion_operators, ) algorithm = AlgorithmQSE( computable_qse_matrices=computable, parameters=vqe_parameters, ) ``` -------------------------------- ### PauliAveraging output example Source: https://docs.quantinuum.com/inquanto/manual/protocols/expval.html Example output showing the number of Hamiltonian terms and circuits generated by the protocol. ```text Number of terms in hamiltonian: 15 Number of circuits: 2 ``` -------------------------------- ### Configure SCEOMMatrixComputable and AlgorithmSCEOM Source: https://docs.quantinuum.com/inquanto/manual/algorithms/algorithms_sceom.html Set up the computable matrix and initialize the SCEOM algorithm with optimized VQE parameters. ```python from inquanto.computables.composite import SCEOMMatrixComputable from inquanto.algorithms import AlgorithmSCEOM vqe_parameters = ansatz.state_symbols.construct_from_array([-0.10723347230091537]) vqe_state = ansatz.to_CircuitAnsatz(vqe_parameters) computable = SCEOMMatrixComputable( space=fermion_space, fermion_state=fermion_state, ground_state=vqe_state, mapping=jw, hermitian_operator=qubit_hamiltonian, expansion_operators=expansion_operators, ) algorithm = AlgorithmSCEOM( computable_sceom_matrix=computable, parameters = vqe_parameters ) ``` -------------------------------- ### ProjectiveMeasurements output example Source: https://docs.quantinuum.com/inquanto/manual/protocols/other.html Example output showing the basis states, probabilities, uncertainties, and counts obtained from the protocol. ```text Basis state Probability Uncertainty Count 0 0110 0.600 0.015492 600 1 0011 0.224 0.013184 224 2 1100 0.164 0.011709 164 3 1001 0.012 0.003443 12 ``` -------------------------------- ### Configure and run MinimizerSPSA Source: https://docs.quantinuum.com/inquanto/manual/minimizers.html Demonstrates initializing MinimizerSPSA and using it within an AlgorithmVQE workflow. ```python from inquanto.minimizers import MinimizerSPSA minimizer=MinimizerSPSA(max_iterations=5, disp=True) vqe = AlgorithmVQE( objective_expression=ev, minimizer=minimizer, initial_parameters=ansatz.state_symbols.construct_zeros() ) vqe.build(protocol_objective=SparseStatevectorProtocol(AerStateBackend())) vqe.run() print("VQE Energy:", vqe.generate_report()["final_value"]) ``` -------------------------------- ### Initialize Quantinuum backend Source: https://docs.quantinuum.com/inquanto/manual/protocols/resource_estimation.html Sets up the Quantinuum backend using an offline API handler for local emulation. ```python # Prepare the Quantinuum backend from pytket.extensions.quantinuum import QuantinuumBackend, QuantinuumAPIOffline backend = QuantinuumBackend(device_name="H2-1LE", api_handler=QuantinuumAPIOffline()) ``` -------------------------------- ### Constructing and running an IterativePhaseDiffEstimation protocol Source: https://docs.quantinuum.com/inquanto/manual/protocols/phase_est.html This example demonstrates setting up a QPDE protocol with a controlled excitation circuit and a simple Hamiltonian to estimate a phase difference. ```python from inquanto.protocols import IterativePhaseDiffEstimation, UStrat # Reference-state preparation on the single system qubit (|0>). state = CircuitAnsatz(Circuit(1)) # Build the controlled excitation circuit ctrl_excit_circ = Circuit(2) ctrl_excit_circ.CX(0, 1) ctrl_excit = CircuitAnsatz(ctrl_excit_circ) # System Hamiltonian H = (1/2) Z; the |0>-|1> phase difference is one half-turn. qopl = QubitOperator("Z0", 0.5).trotterize() # Construct and build the QPDE protocol. protocol = IterativePhaseDiffEstimation( backend=backend, n_shots=n_shots, ).build( state=state, ctrl_excit=ctrl_excit, evolution_operator_exponents=qopl, u_strat=UStrat.PAULI_EXP_BOX, ) # Choose beta to cancel the known phase difference (k = 1, phi = 1 half-turn). protocol.update_k_and_beta(k=1, beta=1.0) protocol.run() # With beta tuned to the phase difference, every shot returns 0. protocol.get_measurement_outcome() ``` -------------------------------- ### SCEOM State Output Example Source: https://docs.quantinuum.com/inquanto/manual/algorithms/algorithms_sceom.html Example output showing coefficients, basis states, indices, and probabilities for excited states. ```text 0th excited state: Coefficient Basis state State index Probability 0 0.994256+0.000000j 0011 3 0.988545 1 0.107028+0.000000j 1100 12 0.011455 ``` ```text 1th excited state: Coefficient Basis state State index Probability 0 0.707107+0.000000j 0110 6 0.5 1 -0.707107+0.000000j 1001 9 0.5 ``` ```text 2th excited state: Coefficient Basis state State index Probability 0 -0.707107+0.000000j 0110 6 0.5 1 -0.707107+0.000000j 1001 9 0.5 None ``` -------------------------------- ### AlgorithmFermionicAdaptVQE Output Source: https://docs.quantinuum.com/inquanto/manual/algorithms/algorithms_adapt.html Example output generated by the AlgorithmFermionicAdaptVQE execution. ```text # TIMER BLOCK-1 ENDS - DURATION (s): 0.0925028 [0:00:00.092503] Minimum Energy: -1.1368465754720531 d0 : -0.10723347230091586 ``` -------------------------------- ### HugrAdapter.process_programs Source: https://docs.quantinuum.com/inquanto/api/extensions/inquanto-nexus_api.html Starts an execution job of HUGR programs on the Nexus backend. ```APIDOC ## HugrAdapter.process_programs ### Description Starts an execution job of HUGR programs on Nexus. ### Parameters - **hugr_programs** (Sequence[Hugr]) - Required - Programs to process on the backend. - **n_shots** (Union[list[int], list[None], None]) - Optional - Number of shots for each program. - **valid_check** (bool) - Optional - Whether to perform validation checks. - **execute_job_annotations** (Optional[ProtocolAnnotations]) - Optional - Annotations of the execution job. - **program_annotations** (Optional[ProtocolAnnotations]) - Optional - Annotations of the HUGR program. ### Returns - **ExecuteJobRef** - Reference to the submitted execution job. ``` -------------------------------- ### Initialize InQuanto and Define Molecule Source: https://docs.quantinuum.com/inquanto/_downloads/2633a4610029448fb62611b6fa6eb3da/InQ_tut_fe4n2_3.ipynb Setup the InQuanto environment and define the Fe4N2 molecular structure. ```python import inquanto as iq from inquanto.core import Molecule # Define the Fe4N2 molecule molecule = Molecule.from_xyz("Fe4N2.xyz") print(molecule) ``` -------------------------------- ### Deprecation warning output Source: https://docs.quantinuum.com/inquanto/tutorials/InQ_tut_fe4n2_3.html Example of a deprecation warning encountered during execution. ```text /Users/ciaran.ward/repos/inquanto-docs/.venv/lib/python3.12/site-packages/qnexus/client/utils.py:170: DeprecationWarning: The `circuits` argument is deprecated and will be removed in a future version. Please use `programs`. warnings.warn( ``` -------------------------------- ### Load Hamiltonian and Setup Space Source: https://docs.quantinuum.com/inquanto/manual/minimizers.html Initializes the Hamiltonian and qubit mapping required for VQE calculations. ```python from inquanto.express import load_h5 from inquanto.spaces import FermionSpace from inquanto.mappings import QubitMappingJordanWigner h2_sto3g = load_h5("h2_sto3g.h5") hamiltonian = h2_sto3g["hamiltonian_operator"] space = FermionSpace(4) state = space.generate_occupation_state_from_list([1, 1, 0, 0]) qubit_hamiltonian = QubitMappingJordanWigner().operator_map(hamiltonian) ``` -------------------------------- ### Ansatz report output Source: https://docs.quantinuum.com/inquanto/tutorials/InQ_tut_vqe_1.html Example output from the ansatz generation report. ```text ANSATZ REPORT: {'n_parameters': 3, 'n_qubits': 4} 2-qubit GATES: 64 ANSATZ GENERATION CIRCUIT: ``` -------------------------------- ### Example Output Distribution Source: https://docs.quantinuum.com/inquanto/manual/protocols/phase_est.html The expected output format from the get_distribution method. ```text {(0,): np.float64(1.0), (1,): np.float64(0.0)} ``` -------------------------------- ### Initialize and inspect MultiConfigurationStateBox Source: https://docs.quantinuum.com/inquanto/manual/ansatze/multi_configurational.html Demonstrates creating a MultiConfigurationStateBox from a QubitState object and retrieving circuit resource metrics. ```python from inquanto.ansatzes import MultiConfigurationStateBox from inquanto.states import QubitState, QubitStateString from pytket.extensions.qiskit import AerStateBackend from math import sqrt config1, c_1 = QubitStateString([1, 1, 0, 0]), 1/sqrt(2) config2, c_2 = QubitStateString([0, 0, 1, 1]), 1/sqrt(2) qubit_states = QubitState({config1: c_1, config2: c_2}) multi_state = MultiConfigurationStateBox(qubit_states) print(multi_state.circuit_resources()) ``` ```text {'depth': 26, 'gates': 29, 'qubits': 4, 'gates_2q': 14, 'gates_1q': 15} ``` -------------------------------- ### AlgorithmAdaptVQE Execution Output Source: https://docs.quantinuum.com/inquanto/manual/algorithms/algorithms_adapt.html Example output showing the minimum energy and final parameters after running the AdaptVQE algorithm. ```text # TIMER BLOCK-0 BEGINS AT 2026-07-22 12:00:49.992101 # TIMER BLOCK-0 ENDS - DURATION (s): 0.0837740 [0:00:00.083774] Minimum Energy: -1.1368465754720531 d0 : -0.10723347230091586 ``` -------------------------------- ### Output Results Source: https://docs.quantinuum.com/inquanto/tutorials/InQ_tut_helios.html Example output for circuit count and energy evaluation. ```text Number of circuits: 2 ``` ```text -1.1284691520823564 ``` -------------------------------- ### PauliAveraging energy evaluation result Source: https://docs.quantinuum.com/inquanto/manual/protocols/expval.html Example output of the evaluated energy. ```text -1.1369585430190199 ``` -------------------------------- ### Iteration 2 log output Source: https://docs.quantinuum.com/inquanto/manual/minimizers.html Example output for the second iteration. ```text Iteration 2 ``` -------------------------------- ### Initialize a Nexus Project Source: https://docs.quantinuum.com/inquanto/_downloads/11b736c3ae23729fbf8320852d45c888/InQ_tut_Nexus_1.ipynb Create or retrieve a Nexus project to manage chemistry jobs. ```python from qnexus.client import projects project_name = f"InQuanto Documentation" project_ref = projects.get_or_create( name=project_name, description="", properties={} ) ``` -------------------------------- ### Run initial VQE for ground state Source: https://docs.quantinuum.com/inquanto/manual/algorithms/algorithms_vqd.html Sets up the system, ansatz, and minimizer to perform an initial VQE experiment, which is a prerequisite for VQD. ```python from inquanto.express import get_system from inquanto.ansatzes import FermionSpaceAnsatzkUpCCGSD from inquanto.computables import ExpectationValue from inquanto.mappings import QubitMappingJordanWigner from inquanto.minimizers import MinimizerScipy from inquanto.algorithms import AlgorithmVQE from pytket.extensions.qiskit import AerStateBackend from inquanto.protocols import SparseStatevectorProtocol fermion_hamiltonian, fermion_fock_space, fermion_state = get_system("h2_sto3g.h5") mapping = QubitMappingJordanWigner() qubit_hamiltonian = mapping.operator_map(fermion_hamiltonian) ansatz = FermionSpaceAnsatzkUpCCGSD(fermion_fock_space, fermion_state, k_input=2) expectation_value = ExpectationValue(ansatz, qubit_hamiltonian) minimizer = MinimizerScipy(method="L-BFGS-B") vqe = ( AlgorithmVQE( minimizer, expectation_value, initial_parameters=ansatz.state_symbols.construct_zeros(), ) .build( protocol_objective=SparseStatevectorProtocol(AerStateBackend()) ) .run() ) ``` -------------------------------- ### VQE report output Source: https://docs.quantinuum.com/inquanto/manual/algorithms/algorithms_vqe.html Example dictionary output from the generate_report method. ```text {'minimizer': {'n_iterations': 3, 'function_evaluations': 20, 'final_value': -1.136846575472054, 'final_parameters': array([-0.107, 0. , 0. ])}, 'final_value': -1.136846575472054, 'initial_parameters': [{'Ordering': 0, 'Symbol': 'd0', 'Value': 0.0}, {'Ordering': 1, 'Symbol': 's0', 'Value': 0.0}, {'Ordering': 2, 'Symbol': 's1', 'Value': 0.0}], 'final_parameters': [{'Ordering': 0, 'Symbol': 'd0', 'Value': np.float64(-0.10723348543796114)}, {'Ordering': 1, 'Symbol': 's0', 'Value': np.float64(0.0)}, {'Ordering': 2, 'Symbol': 's1', 'Value': np.float64(0.0)}]} ``` -------------------------------- ### Prepare a multiconfiguration state with two configurations Source: https://docs.quantinuum.com/inquanto/manual/ansatze/multi_configurational.html Demonstrates initializing a MultiConfigurationStateSparse object from a QubitState defined by two specific configurations and their coefficients. ```python from inquanto.ansatzes import MultiConfigurationStateSparse from inquanto.states import QubitState, QubitStateString from pytket.extensions.qiskit import AerStateBackend from math import sqrt config1, c_1 = QubitStateString([1, 1, 0, 0]), 1/sqrt(2) config2, c_2 = QubitStateString([0, 0, 1, 1]), 1/sqrt(2) qubit_states = QubitState({config1: c_1, config2: c_2}) multi_state = MultiConfigurationStateSparse(qubit_states) print(multi_state.circuit_resources()) ``` -------------------------------- ### Configure Quantinuum Emulator Backend Source: https://docs.quantinuum.com/inquanto/_downloads/a2b0d2d0587ce927f9532bc1675e02b4/InQ_htut_qsys_qse.ipynb Sets up a remote Quantinuum emulator backend via qnexus for noise profile simulation. ```python from qnexus.client import auth, projects, devices from qnexus import QuantinuumConfig # auth.login() # qnexus requires the specification of a project for all submitted jobs project_ref = projects.get_or_create(name="InQuanto Documentation", description="", properties={}) # Change the machine name if necessary. machine = "H2-1E" backend = QuantinuumConfig(device_name=machine) ``` -------------------------------- ### quantum_number_orb(i) Source: https://docs.quantinuum.com/inquanto/api/inquanto/spaces.html Get spatial orbital index from a spin orbital index. ```APIDOC ### quantum_number_orb(i) **Parameters:** - **i** (int) - Spin orbital index. **Returns:** - (int) - The spatial orbital index. ``` -------------------------------- ### Output of Pauli Symmetries Source: https://docs.quantinuum.com/inquanto/tutorials/InQ_tut_Nexus_1.html Example output showing the Pauli symmetry operators. ```text (1.0, Z2 Z3) (1.0, Z0 Z1 Z2 Z3 Z4 Z5) (-1.0, Z0 Z2 Z4) ``` -------------------------------- ### Initialize UCCGSD and k-UpCCGSD Ansatzes Source: https://docs.quantinuum.com/inquanto/manual/ansatze/ucc_family.html Demonstrates the initialization of UCCGSD and k-UpCCGSD ansatzes using FermionSpace and a qubit mapping. ```python from inquanto.states import FermionState from inquanto.spaces import FermionSpace from inquanto.mappings import QubitMappingJordanWigner from inquanto.ansatzes import FermionSpaceAnsatzkUpCCGSD, FermionSpaceAnsatzUCCGSD space = FermionSpace(4) state = FermionState([1, 1, 0, 0]) jw_map = QubitMappingJordanWigner() ansatz_uccgsd = FermionSpaceAnsatzUCCGSD( fermion_space=space, fermion_state=state, qubit_mapping=jw_map ) ansatz_kupccsd = FermionSpaceAnsatzkUpCCGSD( fermion_space=space, fermion_state=state, k_input=2, qubit_mapping=jw_map ) print("\nNumber of parameters: {} (UCCGSD), {} (k-UpCCGSD)".format( ansatz_uccgsd.generate_report()['n_parameters'], ansatz_kupccsd.generate_report()['n_parameters']) ) ``` -------------------------------- ### Example Tapered Hamiltonian Output Source: https://docs.quantinuum.com/inquanto/manual/symmetry.html Representation of the output format for a tapered Hamiltonian. ```text (-0.2926446722772267, I0), (0.824861211927104, Z0), (0.17966867956301552, X0) ```