diff --git a/qiskit_experiments/library/randomized_benchmarking/clifford_synthesis.py b/qiskit_experiments/library/randomized_benchmarking/clifford_synthesis.py index 29873fb37f..3d9187c158 100644 --- a/qiskit_experiments/library/randomized_benchmarking/clifford_synthesis.py +++ b/qiskit_experiments/library/randomized_benchmarking/clifford_synthesis.py @@ -30,6 +30,11 @@ Optimize1qGatesDecomposition, ) from qiskit.transpiler.passes.synthesis.plugin import HighLevelSynthesisPlugin +try: + # for qiskit>=1.0 + from qiskit.passmanager.flow_controllers import ConditionalController +except ImportError: + pass class RBDefaultCliffordSynthesis(HighLevelSynthesisPlugin): @@ -96,6 +101,12 @@ def _direction_condition(property_set): CheckGateDirection(coupling_map), ] ) - pm.append([GateDirection(coupling_map)], condition=_direction_condition) - pm.append([Optimize1qGatesDecomposition(basis=basis_gates)]) + try: + # for qiskit>=1.0 + pm.append(ConditionalController(GateDirection(coupling_map), condition=_direction_condition)) + pm.append(Optimize1qGatesDecomposition(basis=basis_gates)) + except TypeError: + # for qiskit<1.0 + pm.append([GateDirection(coupling_map)], condition=_direction_condition) + pm.append([Optimize1qGatesDecomposition(basis=basis_gates)]) return pm.run(circ)