Suppose I have the following 2-qubit quantum circuit:

qrz = QuantumRegister(2,'q')
crz = ClassicalRegister(3,'c')
qc = QuantumCircuit(qrz,crz)

I want to run this circuit on a real quantum computer, depending on the real-time error rate, I might want to use different qubits on the hardware. For example, suppose here's the calibration data of my backend:

enter image description here

Is there a way I can specify that I want to use qubit 4 and 5 on this quantum computer? I tried to generate a quantum circuit with 6 qubits and append my quantum circuit to qubit 4 and 5, then run the entire circuit on that quantum computer. Is there a simpler way I can do that without generating another large circuit? Thanks!

  • 1
    $\begingroup$ Same questions here, every time using ibmq I have to create a circuit with number of qubits equal number of qubits in the ibmq machine. $\endgroup$ May 31, 2021 at 2:00

2 Answers 2


Why not just use initial_layout method?

For instance,

from qiskit import IBMQ, QuantumCircuit
from qiskit.aqua import QuantumInstance
circuit = QuantumCircuit(2,2)
quantum_instance = QuantumInstance(backend= provider.get_backend('ibmq_santiago'),
                                   shots = 8192,
                                   initial_layout = [3,4],
                                   optimization_level = 3)
results = quantum_instance.execute(circuit)

If you go and look at the circuit that being executed, you will see that it uses qubit 3 and 4 of the device:

enter image description here

If you don't to use quantum_instance but instead you want to use execute class directly, then you can just specify the initial_layout method in execute. For example:

result = execute(circuit, backend=provider.get_backend('ibmq_santiago'),
 initial_layout = [3,4], shots= 1000)

This will also make sure qubit 3 and 4 of the hardware are use when you execute your circuit.


... depending on the real-time error rate, I might want to use different qubits on the hardware.

Qiskit provides a transpiler pass that chooses a noise-adaptive layout based on current calibration data for the backend; NoiseAdaptiveLayout.

To use it, first transpile your circuit with the parameter layout_method equals "noise_adaptive"

transpiled_circuit = transpile(qc, backend = chosen_backend, layout_method = "noise_adaptive")

Then execute the transpiled circuit:

qobj = assemble(transpiled_circuit)
  • $\begingroup$ Thanks for the answer! That's really helpful. I just tried that method on ibmq_casablanca. However, the calibration data shows that qubit 4 and 5 as well as their connection has the lowest error rate, but the system picked qubit 5 and 6 for me. Is that more noise adaptive? $\endgroup$
    – ZR-
    May 31, 2021 at 14:50
  • $\begingroup$ I'm just providing a general answer to the question I quoted at the beginning. For simple circuits, like the one in your question, may be the best option you have is to follow @KAJ226 suggestion. $\endgroup$ May 31, 2021 at 18:15
  • $\begingroup$ Got it. Thanks! $\endgroup$
    – ZR-
    May 31, 2021 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.