Effects on T2 dephasing on IBM quantum computers

Introduction

Interested in learning how to program quantum computers? Then check out our Qiskit textbook Introduction to Quantum Computing with Qiskit.

In this tutorial we will explore the effects of T2 dephasing on IBM quantum computers in Qiskit.

What is T2 dephasing time?

Also known as T2 dephasing time this is where a qubits state dephases from either |+〉or |-〉to a mixture of phases such that the phase cannot be accurately predicted. For example if our initial state is |+〉then the state may decay to a mixture of |+〉and |-〉due to T2 dephasing.

The effects of T2 dephasing can be seen very easily with the following steps:

  1. Put the qubit in to superposition using a Hadamard gate

  2. Add a delay to the circuit

  3. Bring the qubit out of superposition using another Hadamard gate

  4. Measure the qubits state

The longer the delay the more measurements there will be for |1〉 due to dephasing.

Implementation

In Qiskit T2 dephasing can be observed very easily by with the following steps:

Step 1: Initialise the quantum and classical registers

The first step is to initialise the registers. Our circuit will consist of two registers. A quantum register that holds our qubit and a classical register that holds the bit used to hold the qubits state.

In Qiskit the registers can be initialized using the following code:

q = QuantumRegister(1,'q')
c = ClassicalRegister(1,'c')

Step 2: Create the circuit

The next step is to create the circuit. This consists of a Hadamard gate that is applied to the circuit followed by a delay of 283 microseconds. This is the average T2 dephasing time for the IBMQ Armonk device that is used in this tutorial. After this a second Hadamard gate is applied to bring the qubit out of superposition. Then finally the qubits state is measured.

circuit = QuantumCircuit(q,c)
circuit.h(q[0])
circuit.delay(283, unit="us") # Delay of 283 microseconds   
circuit.h(q[0])

circuit.measure(q[0],c[0]) #Measuring the qubit

Step 3: Transpile the circuit

The next step is to transpile the circuit. This is done so that the scheduling method can be set so that the delay will be implemented.

transpiled_circ = transpile(circuit, backend, scheduling_method='alap')  

Step 4: Execute the circuit on the backend device

Where nshots is the amount of times the circuit is ran and the backend is the ibmq_armonk device.

nShots = 8192
    
job = execute(transpiled_circ, backend, shots=nShots)
job_monitor(job)

Step 5: Get the results

The final step is to get the results back and print them!

counts = job.result().get_counts()

print("With delay: ",counts)

How to run the program

Copy and paste the code below in to a python file

  1. Enter your API token in the IBMQ.enable_account('Insert API token here') part

  2. Save and run

Note: To get an API key sign up to IBM Q Experience and get your token here: https://quantum-computing.ibm.com/account

Code

from qiskit import QuantumRegister, ClassicalRegister
from qiskit import QuantumCircuit, execute,IBMQ
from qiskit.tools.monitor import job_monitor
from qiskit import transpile
import numpy

pi = numpy.pi

IBMQ.enable_account('ENTER API KEY HERE')
provider = IBMQ.get_provider(hub='ibm-q')

backend = provider.get_backend('ibmq_armonk')

q = QuantumRegister(1,'q')
c = ClassicalRegister(1,'c')

def withoutDelay():
    circuit = QuantumCircuit(q,c)

    circuit.h(q[0])
    circuit.h(q[0])
    circuit.measure(q[0],c[0]) #Measuring the qubit

    nShots = 8192

    job = execute(circuit, backend, shots=nShots)
    job_monitor(job)

    counts = job.result().get_counts()

    print("No delay: ",counts)

def withDelay():  
    circuit = QuantumCircuit(q,c)
    circuit.h(q[0])
    circuit.delay(283, unit="us") # Delay of 200.79 microseconds   
    circuit.h(q[0])

    circuit.measure(q[0],c[0]) #Measuring the qubit

    transpiled_circ = transpile(circuit, backend, scheduling_method='alap')  

    nShots = 8192
    
    job = execute(transpiled_circ, backend, shots=nShots)
    job_monitor(job)

    counts = job.result().get_counts()

    print("With delay: ",counts)

withoutDelay()
withDelay()

Output

Output showing a significant number of counts for ‘1’ due to dephasing when there is a delay compared to with no delay.