Python Editor related
How to use QC Toolkit/Workbench?
Interested in exploring QSim? All you need to do is, send a mail to qcworkbench[at]cdac[dot]in. That’s it! You will be receiving a mail once the account is created with the details to access the service. Just login and experience the Quantum Simulation right in the browser.
After login, you will land on the “Build Circuits” page, which will allow you to write your own Qiskit program and hit enter at the end of each line to see the instant circuit generation. The Python code editor comes with features such as Autocompletion, search and replace, jump to line, keyboard shortcuts and syntax highlighting to enable users to write programs faster.
One of the key benefit of QC Workbench is the ability to induce noise parameters and that can be easily done by clicking the “Noise Parameters” tab in the right sidebar. The user friendly text fields allows to customize the parameter values and see those updates in real-time in the code editor. The parameter value ‘1’ means “Zero Noise” and ‘0’ being “Very Noisy”.
Choose to plot your program, enable partition or carry out some Initializations using the options located under “Simulation Options” tab in the right sidebar.
Submit for Simulation
Done with your coding, just click on “Run Circuit” button located at the top to submit your program for simulation. Lookout for the Job Id/Simulation Id, returned via the green notification at the bottom right corner of the page, which is then used for monitoring the progress of the job. The red notification means the program has some errors/the application has an issue in accepting your request.
Checking Simulations status
Click on “Simulations” tab or link on the left sidebar to view the list of Simulations submited, and its status. Drill down by clicking on the Job row to view Outputs, errors and circuits submitted.
Click on the “Examples” link to view all the available programs and algorithms. Select any program to load it into the editor and start customizing it to your need.
How to enable Autocompletion?
Autocompletion is enabled by default. Just type in the editor and see suggestions dropping down. Use the arrow keys to select and hit tab to complete the statement.
What is Options variable and why you should avoid changing it
By default, the editor loads the sample program with options variable defined. Though this variable can be named anything, we suggest to retain the variable name as it is. This variable is used for defining various simulator options and noise parameters; which intern is populated by the GUI upon user input. Changing options variable name to something else will result in GUI issues.
How does the Instant Circuit generator work?
Upon hitting Shift + Enter in the code editor will trigger the instant circuit generator module. For example, to add a ‘h’ gate, you need to type the following line:
After typing the line, hit Shift + Enter to trigger the circuit generator.
Why Shift + Enter? In the earlier version, hitting Enter was triggering the instant circuit generation module which is now replaced with Shift + Enter for a good reason. Enter key will trigger the linting module and hitting Shift + Enter will trigger circuit generation module.
Why Instant circuit generation fails for some code?
That’s a limitation in version 1.0 for a reason.
Calling execute() function within anoter function will make the circuit generation to fail. Yes, this could be termed as a major limitation, but we are in the work to fix the issue. Well, the limitation is for a reason – executing the entire Python code could be one of the way to generate the circuit, but it comes at a cost of time (because we supposed to generate Instant circuit isn’t?). So executing the entire Python code is not a viable solution for generating the instant circuit. In order to reduce the time taken for circuit generation, our Python parser does some heavy lifting job to identify and trim the execution part of the code (which usually takes long time to execute); which intern is executed to print the Quantum Circuit instantly (wait! at least few seconds to be precise).
Finally, not the right justification to defend the bug, but yes the fix will be made available soon.
How do I add measurements to the Qubit?
Look out for the measure() line with blue background in the editor. This red square The blue background represents the line that contains measure() functions. In order to add measurement to the statement, you need to simply right-click on the line and select the desired measurements.
Unable to find Bell basis measurement in the right click context menu
The version 1.0 supports Single Qubit, Ensemble and Expectation measurements. So you will not find Bell basis measurement option in the Context menu (when right clicked on the line that contains measure() function). However, this does not prevent you from writing your code in the editor with Bell basis measurement. The dm_simulator supports Bell basis and the simulation will just run fine, only that the GUI does not support in this version.
Which are the measurements support Plotting?
At present, only the Bell basis measurement and Ensemble measurement supports Plotting.
Why does the job submit, in-spite of circuit generation failure?
Instant circuit generator and job submission modules are independant. Hence the failure of one module does not affect the other module. Also there could be plenty of reasons why Instant circuit generation failed. Read the FAQ “Why Instant Circuit generation fails for some code?” for better understanding of the issue.
How to verify Python code for errors?
Python linting is enabled by default and all you need to do is to write your code and hit enter to trigger the syntax validation module. If any errors are found, they should instantly pop up in the respective line numbers.
How to debug Python Program?
Sorry! Version 1.0 does not have debugging feature. However, once the job is submitted, the detailed job report will display the error message to help debug the program.
- Tab – Type a letter and hit Tab to trigger autocompletion/list suggestion box.
- Ctrl-F / Cmd-F – Launch Search dialog within the editor.
- Ctrl-G / Cmd-G – Find next item
- Shift-Ctrl-G / Shift-Cmd-G – Find previous item
- Shift-Ctrl-F / Cmd-Option-F – Launch Replace dialog within the editor
- Shift-Ctrl-R / Shift-Cmd-Option-F – Replace all
- Alt-G – Launch Jump to line dialog and type the line number to jump
What is dm_simulator?
Learn more about the dm_simulator from the official GitHub page.
Is there a limit in Qubits?
Yes. Current version supports Qubits upto 12.
QSim version history
QSim v1.0 – Released on August 2020
- Dec 2021 – QSim : Correction of quantum noises added to the example codes. The rotation and thermal errors should be [1.0,0.0] for noiseless instead of [1.0,1.0]
- Feb 2022 – dm_simulator : Fixed Redundant loop resulting in amplitude decay, thermalization and decoherence applied at end of every clock cycle to all the qubits. Track the issue here.
- Feb 2022 – QSim: We have version 1.1 with Python linting enabled.
How to launch the Layout help?
Simple. Upon logging-in, click on the drop down next to your name (located on the top right). Select “Start Tour” to understand the Workbench layout.
Note: You need to be in “Build Circuits” page before clicking “Start Tour”.
Why don't I see my Profile pic?
QC Workbench uses Gravatar for pulling the profile picture of the user. If you don’t see your profile picture, then Gravatar does not have it and you may add one by signing up to the service.
I was logged out after being Idle for 30mins
Sorry about that. But that was intentional and for a security reason. If you are Idle for about 30mins, then the session will expire automatically and you will be asked to login again.
How to change my account password?
You can reset your password by clicking the “Reset Password” link in the login page.
How can I contribute my programs to the Examples repository?
Great! Send us a mail to qcworkbench at cdac dot in.