1
$\begingroup$

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)
    qc.h(q[0])
    for s in range(ghz_size-1):
        qc.cx(q[s], q[s+1])
    qc.barrier()
    qc.measure(q, c)
    circuits.append(qc)

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,
                                  optimization_level=0,
                                  noise_model=noise_models[nm],
                                  #basis_gates=noise_models[nm].basis_gates
                                 )

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
NoiseModel:
  Basis gates: ['cx', 'id', 'rz', 'sx']
  Instructions with noise: ['cx', 'measure']
  All-qubits errors: ['cx', 'measure']
$\endgroup$

1 Answer 1

3
$\begingroup$

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.

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

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.