I was trying to simulate some circuits using the QASM simulator via IBM Quantum Computing Lab online.

q = QuantumRegister(qubit_count)
c = ClassicalRegister(qubit_count)
circuits = []
for ghz_size in range(2,qubit_count+1):
    qc = QuantumCircuit(q, c)
    for s in range(ghz_size-1):
        qc.cx(q[s], q[s+1])
    qc.measure(q, c)

I have specified the basis gates to be as

pm = PassManager()
pm.append(Unroller(['u1', 'u2', 'u3', 'cx', 'id']))
sim_data_sets = {} #set up data structure
for l in labels:
    sim_data_sets[l] = []

Now, when I loop through a list of noise models to produce simulated results, I realised that it is not using these specified basis gates. Here's a small section of the code (not sufficient to reproduce the results)

for s in range(num_sims_per_model):
                job_sim = execute(circuits[c], backend, shots=shots,
                                  pass_manager = pm,

And here's a small part of the output

---Simulating noise case 2-qubit Average Model ---
2022-01-12 03:00:54.334238
Starting circuit 0
2022-01-12 03:00:54.334685
  Basis gates: ['cx', 'id', 'rz', 'sx']
  Instructions with noise: ['cx', 'measure']
  All-qubits errors: ['cx', 'measure']

This behavior is already documented for example here:

The command AerSimulator(noise_model=noise_model) returns a simulator configured to the given noise model. In addition to setting the simulator’s noise model, it also overrides the simulator’s basis gates, according to the gates of the noise model.

  • $\begingroup$ Thanks ! Didn't notice that $\endgroup$
    – Edward
    Jan 13 at 4:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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