This project allows users to select the number of qubits (max is 5) and apply Gate operations on them mimicking a quantum circuit.
For example, users can select qubit 0 and the Hadamard gate, add them to the circuit, and run a simulation to get the state vector of the selected qubit. If users wish to use the CNOT gate, they have to specify which qubits are the control and the target qubits, respectively, in a 2-qubit system.
Aside from the Hadamard and the CNOT gates, there are Pauli-X, Y, and Z gates for the users to play with.
This project was built using React.js for the frontend and FastAPI for the backend. As a beginner in building full-stack applications, this project was built for me to learn and get experience in building full-stack applications while implementing concepts in physics wherever possible.
- Select the number of qubits.
- Choose from various quantum gates (Hadamard, CNOT, Pauli-X, Y, Z).
- Add gates to the quantum circuit.
- Display quantum states after simulation.
- Python 3.6 or higher must be installed
- Node.js and npm must be installed
Please refer to the references section for the installation guide.
- Clone the repository:
git clone https://github.com/Sharen-Rajenthiran/quantum-simulator.git - Change the directory to the repository directory:
cd quantum-simulator - Navigate to the backend folder if you haven't in step 2:
cd quantum-simulator - Create a virtual environment (optional but recommended):
python -m venv your_environment_name - Activate your virtual environment if you have completed step 4:
your_environment_name\Scripts\activate - Install the required packages:
pip install -r requirements.txt - Run the FastAPI server:
uvicorn smain:app --reload
- Navigate to the frontend folder:
cd quantum-frontend - Install the dependencies using npm:
npm install - Run the frontend server (in a new terminal) while the backend server is running:
npm start
Alternatively for step 1 in backend setup, you can download the repository. To terminate the backend and frontend servers, use ctrl + c on your keyboard for windows.
- The simulation results may not reflect the expected output, especially for multi-qubit operations. The circuit construction logic may need further refinement to ensure correct gate application and state retrieval.
- The original idea was to use
Qiskitbackend services to get the state vectors and also simulate the quantum circuit but the approach was not complete due to time constraints. - In the main directory, there are
main.pyandsmain.pypython files. Themain.pyfile was intended to implement the original idea usingQiskitbackend services. Thesmain.pyfile is a simpler version ofmain.py. When running the backend server, please make sure in theuvicorn smain:app --reloadcommand,smainis used. - The backend currently returns state vectors, but proper handling and response formatting for different gates and qubits need to be implemented.
- The user interface may not be fully intuitive for beginners. Improvements in the design and interactivity (such as drag-and-drop functionality) are desired.
- The UI design is lacking.
- Implement a clearer user interface with drag-and-drop functionality for gate selection.
- Enhance error handling in the backend to provide more informative messages to the user.
- Add unit tests for both the frontend and backend components.
- Allow users to save and load circuits.
- Make proper use of backend services.
- Implement deployment and maintenance phases.
- For python installation: https://www.python.org/downloads/
- For node.js installation: https://nodejs.org/en
- For qiskit documentation: https://docs.quantum.ibm.com/
- For qiskit simulation documentation: https://qiskit.github.io/qiskit-aer/
