I want to later extract the qasm file for the optimized circuit. Hence I tried to use the qiskit aer device so that I can later use the circuit to qasm option. But then the adaptive steps that adaptively select the single and double excitation gates take a very long time to run. I am hence unable to get the qiskit device to be able to get the assembly file.
You can export to openqasm from the “tape” of the qnode, which is the data structure that contains its operations. This is a minimum working example that can show you how to code this.
So my issue is since I have mostly only tried to create fiunctions for vbariational circuits they oiften dont have a return object. Like for Adapt VQE the function is defined as:
def circuit_1(params, wires, excitations):
qml.BasisState(hf_state, wires=wires)
for i, excitation in enumerate(excitations):
if len(excitation) == 4:
qml.DoubleExcitation(params[i], wires=excitation)
else:
qml.SingleExcitation(params[i], wires=excitation)
Since the circuit is defined without retun object (then combined with the device etc in the ExpVal function so how do you isolate the qnoide object for a circuit when it does not have a measurement on it?