Getting Started - Bell State

Published by strangeworks (02/09/2021)

Get Strange

Welcome to Strangeworks! You are probably here to start hacking on some quantum computers so let's look at how Strangeworks projects are created and organized. We will do this by creating a simple project and implementing a very basic quantum state, the Bell state, using several of the available frameworks. After you get the basics down we will point you to some other resources and guides, or you can just dive in and start coding!

A Strangeworks project is like any standard coding project in that it is simply collection of files and folders. On Strangeworks these files are your quantum programs -- circuits and algorithms that will make use of a few of the additional dimensions of computing power the universe has made available to us. These arcane codes of quantum lore will be written in the classic tongue (qasm) or the vernacular (regional python dialects). Once loaded into a Strangeworks project these quantum programs will be ready to be run on a simulator or quantum hardware provided by our numerous partners.

Your First Project

To get started we are going to create a project and jump into some code. You can initiate your project a few different ways.

Make a new empty project

This option will create a new project for you to add files and folders to. To start a new empty project simply type the name of the project and click Create Project.

As a clone of a git repository

If you already have some code in a git repository that you would like to import you can do this by pasting the HTTPS URL of your public git repository and clicking Create Project.

As a copy of an existing project

In this example we are going to make a copy from another project. For this walk-through open the Getting Started - Bell State project in a new tab. Once you have opened the project you can click the pink button that says "Clone Project". This will make a new copy of the existing project and put it in your workspace.

Coding a Bell State

The fundamental element of quantum computing is the qubit, and the key to doing interesting things with qubits is entanglement. In this project we are going to see how we can entangle two qubits with a simple circuit. The circuit will put one qubit into a superposition, then entangle it with the other qubit. Finally we will measure each qubit.
On the right of the dashboard you can see you list of files. These are our source files and are treated just like any other code repository. In fact, you can import a git repo into a project. Selecting any of the files will take you to the code editor and if it is a source file such as a .qasm or .py you will have the ability to run your code.
Once you run your code you will be shown the results of your runs. Lets get started running some test code.


QASM stands for Quantum Assembly Language and specifically OpenQASM offers a basic set of quantum instructions we can use to build quantum circuits. We will start our exploration of quantum code here. From the list of files select bell-qasm.qasm. Once the file is loaded into the code editor push the green Run Code button. You will be given the opportunity to run multiple iterations, let's do 100 iterations.

​The results page will load here and you will see a diagram of your circuit as well as the histogram of results from the 100 iterations. At the top is the run request information. This tells us everything we need to know about what backend we are using, the framework employed, number of iterations and any parameters used in the run. This information is saved and it is easy to come back to your results from previous runs by going to the results history on the right and finding the numbered result you are looking for.

While QASM gives us access to a complete set of quantum gates, we probably want some more tools. For this we can turn to frameworks that build on QASM and incorporate the patterns and abstractions we are used to with modern languages.​

Python Quantum Frameworks

​Quantum computing is growing and evolving rapidly. Here you have access to all the hottest frameworks 24/7. Strangeworks offers several different popular python frameworks for building quantum circuits. In this project you can see examples from qiskit, cirq, braket, blueqat, forest, and pennylane.


One of the most widely used quantum computing frameworks is Qiskit. Qiskit is an opensource framework from IBM and a great place to start due to the numerous examples and active community. To get started with Qiskit find the file in the file list.
The first thing to notice about the code is that in addition to importing qiskit we also import strangeworks.qiskit. This imports the Strangeworks library that wraps Qiskit and gives us the ability to run on our own simulators, capture results, and render the output of the simulator in a visually appealing way. A quick look at the code shows us that we can also now set up the job iterations in the code directly instead of specifying it at runtime. Since many quantum algorithms rely on aggregated output to generate a probability distribution this abstraction is especially useful.
Let's do a run and see what the results look like. From the code editor press the green Run Code button in the top right.

Other Frameworks

Qiskit is far from the only game in town, and Strangeworks offers access to many different quantum frameworks. In this project you can see code from several frameworks. All are doing the same thing: put one qubit into an equal superposition, then entangle it with another qubit to create the Bell state, and then measure the results.

Keep Exploring

You are now a quantum developer with some powerful tools for getting started using many of the most developed frameworks around! Of course this is just the beginning. The Strangeworks platform is your portal the to a productive quantum computing experience. Make sure to let us know what you think! There are a few places to go from here: