Quantum Glasses, a Qiskit Ecosystem package for Bloch sphere simulations

Qiskit
Qiskit
Published in
3 min readNov 15, 2023

By Jay Shah

The Bloch sphere is one of the most popular and recognizable tools for helping new learners understand quantum computing fundamentals. Now, there’s a Qiskit Ecosystem project that helps users visualize Bloch spheres with just a few clicks on a convenient GUI-based tool.

The Quantum-Glasses package is a Tkinter GUI app designed to help users visualize the effects of single-qubit quantum gates via interactive Bloch Sphere simulations. Built using Qiskit, the package is a recent addition to the Qiskit Ecosystem Community Tier. It’s designed to be easy to use, and its GUI-based software allows users to build their visualizations while simultaneously studying or working — no need to worry about code.

Read on to learn more about this handy tool and how you can use it!

What users see through Quantum Glasses

Individual qubits and single-qubit gates are some of the most fundamental building blocks of quantum computation, and the Bloch sphere provides a convenient way of visualizing them. The challenge is that Bloch spheres are not very easy to draw by hand, and there aren’t many simulators that make it easy to generate them.

Quantum Glasses accomplishes this by providing a GUI app that makes it easy to produce and manipulate Bloch sphere visualizations. This, in turn, helps users visualize important quantum computing concepts to enhance their understanding of the subject.

The Quantum Glasses package supports a total of 11 single-qubit gates. These 11 gates include both parameterized as well as non-parameterized gates, listed below:

  1. Hadamard Gate
  2. X Gate
  3. Y Gate
  4. Z Gate
  5. S Gate
  6. S Dagger Gate
  7. T Gate
  8. T Dagger gate
  9. RX Gate
  10. RY Gate
  11. RZ Gate

The parameter values for the parameterized gates (RX, RY, RZ) are discretized into the following set: 2𝝥, 𝝥, 𝝥/2, 𝝥/4, -𝝥/4, -𝝥/2, -𝝥, -2𝝥.

With Quantum Glasses, users can apply a series of single qubit gates and see how they affect a qubit, either starting in a default initial state of |0> or in any other state that can be prepared using the available gates. Users can see the direct impact of these gates as the state vector rotates around the Bloch Sphere. These visualizations can help users:

  1. Better understand the effect of a particular gate when we apply it to a qubit in a given state.
  2. Example: Effect of RX gate when applied to a qubit in the state |+>
  3. Gain a different perspective on important quantum computing identities
  4. Example: H2 = Identity (Applying a Hadamard Gate twice has no effect)

Getting started

Quantum Glasses is a GUI app built using the tkinter python library. Users can follow these steps to get the app on their local machines.

  1. Clone this repository using git clone https://github.com/Jayshah25/Quantum-Glasses
  2. Activate the venv
  3. Run python quantum_glasses.py

Once you have successfully followed these steps, you should see Quantum Glasses appear on your screen.

How to use Quantum Glasses

  1. Apply the desired Gates. The Display Screen keeps track of the gates applied.
  2. Click the Visualize Button. A new window with should pop up with the animated Bloch sphere.
  3. Close the animation window once the animation is complete.
  4. Click the Clear Button to reset the Quantum Glasses app.
  5. Apply a new series of Gates for visualization ,or click the Quit Button to close the app.

Hopefully Qiskit users will find the above to be pretty straightforward. For extra clarity, let’s take a look at two examples taken from the preceding section of this article.

Effect of RX Gate on a qubit in the state |+>

H2 = Identity

Wish to see more examples with Quantum Glasses? You’ll find several more on our YouTube playlist.

Future Work

Quantum Glasses is a fun and potentially useful tool, but it does currently have some significant limitations.

  1. The visualizations are limited to a single qubit. Quantum Glasses cannot visualize important concepts like quantum entanglement, which involve more than one qubit.
  2. The parameterized gates can only take one of the 8 values (2𝝥, 𝝥, 𝝥/2, 𝝥/4, -𝝥/4, -𝝥/2, -𝝥, -2𝝥).
  3. The number of gates that you can apply at once is limited to 10. Once 10 gates are applied, all the buttons automatically deactivate.

Future work will focus on addressing these limitations and making the Quantum Glasses app even more functional and versatile. If you’d like to contribute to these efforts, please contact us via the project GitHub, here.

--

--

Qiskit
Qiskit

An open source quantum computing framework for writing quantum experiments and applications