Dear Community,
I’m currently working on mapping a Qiskit program to PennyLane, but I’m facing some challenges when it comes to selecting the active space.
First, I found a sample PennyLane program on ADAPT-VQE that I’d like to use as a reference:
import pennylane as qml
from pennylane import qchem
from pennylane import numpy as np
symbols = ["Li", "H"]
geometry = np.array([[0., 0., 0], [0., 0., 2.8]])
H, qubits = qchem.molecular_hamiltonian(
symbols,
geometry,
charge=0,
mult=1,
basis='sto-3g',
method='pyscf',
active_electrons=2,
active_orbitals=5
)
active_electrons = 2
singles, doubles = qchem.excitations(active_electrons, qubits)
print(f"Total number of excitations = {len(singles) + len(doubles)}")
electrons = 4
orbitals = 6
core, active = qchem.active_space(electrons, orbitals, active_electrons=a_electrons, active_orbitals=a_orbitals)
print("List of core orbitals: {:}".format(core))
print("List of active orbitals: {:}".format(active))
print("Number of qubits: {:}".format(2 * len(active)))
Result:
List of core orbitals: [0]
List of active orbitals: [1, 2, 3, 4, 5]
Number of qubits: 10
In this PennyLane program, they set active_orbitals=5. When I change it to active_orbitals=3, the result is:
List of core orbitals: [0]
List of active orbitals: [1, 2, 3]
Number of qubits: 6
Now, here’s my Qiskit program. Please note that the generate_hamiltonian
function doesn’t directly relate to my issue, but I’ve included it for context:
molecule = 'LiH'
d = 2.8
spin = 0
charge = 0
use_cas = False
if molecule == "LiH":
atoms = f'H .0, .0, .0; Li .0, .0, {d}'
occupied_indices = [0]
active_indices = [1, 2, 5]
n_elec = 2
molecular_hamiltonian, qubit_hamiltonian = generate_hamiltonian(molecule, atoms, occupied_indices, active_indices, n_elec, spin, charge, use_cas)
We have found that using [1, 2, 5] is better than [1, 2, 3] for approaching the ground state energy.
Now, my question is how can I translate the occupied_indices=[0]
and active_indices=[1,2,5]
from Qiskit to PennyLane?
Also, I’m interested in using the ADAPT-VQE method as described ADAPT. How can I input the quantum circuits I obtain using this method into Qiskit, as I want to apply Qiskit’s noise model?
I understand that it is possible to increase the noise model by qiskit_aer the backend, but it is simply too slow. And I have a significant part of my subsequent processing is written in Qiskit.
Thank you for your help!