Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,79 +1,104 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
-
|
| 17 |
-
-
|
| 18 |
-
-
|
| 19 |
-
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
3.
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
```
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
-
|
| 71 |
-
-
|
| 72 |
-
|
| 73 |
-
-
|
| 74 |
-
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
-
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Quantum Physics Simulation
|
| 3 |
+
emoji: ⚛️
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: blue
|
| 6 |
+
sdk: streamlit
|
| 7 |
+
sdk_version: "1.32.0"
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# ⚛ Quantum Physics Simulation
|
| 13 |
+
|
| 14 |
+
This interactive app visualizes:
|
| 15 |
+
|
| 16 |
+
- Probability density of Hydrogen atom wavefunctions
|
| 17 |
+
- Orbital shapes for quantum numbers n, l, m
|
| 18 |
+
- Node structure
|
| 19 |
+
- Phase visualization
|
| 20 |
+
- Particle-in-a-box wavefunctions
|
| 21 |
+
- 2D & 3D views
|
| 22 |
+
- Animations
|
| 23 |
+
|
| 24 |
+
Built using **Streamlit**, **NumPy**, and **Plotly 3D**.
|
| 25 |
+
|
| 26 |
+
# Quantum Simulation Suite
|
| 27 |
+
|
| 28 |
+
## Overview
|
| 29 |
+
- Particle in a Box (PIB) time-dependent Schrödinger simulation (Crank–Nicolson, Split-Step Fourier)
|
| 30 |
+
- Hydrogen spectrum (Rydberg formula, energy levels, stick spectrum)
|
| 31 |
+
- TDSE wavepacket evolution with spacetime heatmap
|
| 32 |
+
- Modular UIs: Streamlit (dark theme, sidebar navigation) and PySide6 (legacy)
|
| 33 |
+
- Physics engine: real constants, potentials, eigenfunctions, TDSE solver with normalization and stability checks
|
| 34 |
+
|
| 35 |
+
## Project Structure
|
| 36 |
+
- `streamlit_main.py` — Streamlit entrypoint with sidebar pages
|
| 37 |
+
- `run_app.bat` — Installs deps and launches Streamlit UI
|
| 38 |
+
- `run_streamlit_main.bat` — Same as above (alternative launcher)
|
| 39 |
+
- `app/core/physics_engine/` — constants, potentials, PIB equations, TDSE solver, hydrogen spectrum
|
| 40 |
+
- `app/core/animations/` — Matplotlib animations (PIB, Hydrogen)
|
| 41 |
+
- `app/ui_streamlit/` — Streamlit UIs (PIB, Hydrogen, TDSE, TISE placeholder, Custom Potential placeholder)
|
| 42 |
+
- `app/ui/` — PySide6 legacy UI (PIB, Hydrogen, main window)
|
| 43 |
+
- `app/tests/` — pytest suites for equations, potentials, solver
|
| 44 |
+
- `data/`, `docs/` — optional data/docs folders (ignored by git)
|
| 45 |
+
|
| 46 |
+
## Requirements
|
| 47 |
+
- Python 3.10+
|
| 48 |
+
- numpy, scipy, matplotlib, streamlit, PySide6, numba, pandas (batch files auto-install)
|
| 49 |
+
|
| 50 |
+
## How to Run (Streamlit UI)
|
| 51 |
+
1) Open a terminal:
|
| 52 |
+
```bash
|
| 53 |
+
cd "D:\Physics Simulation Project\Physics Simulation Project Code"
|
| 54 |
+
run_app.bat
|
| 55 |
+
```
|
| 56 |
+
(or `run_streamlit_main.bat` or `streamlit run streamlit_main.py`)
|
| 57 |
+
2) In the browser sidebar, choose:
|
| 58 |
+
- **Particle in a Box (PIB)**: set L, n, solver, dt, grid; enable superposition; click Start. Tabs show ψ, |ψ|², energies, live animation. Export PNG/CSV available.
|
| 59 |
+
- **Hydrogen Spectrum**: pick series and n₂>n₁; view wavelengths, photon energies, stick spectrum, energy levels.
|
| 60 |
+
- **TDSE Simulation**: set wavepacket params, domain, dt/steps; compute frames; view animation and |ψ|² heatmap.
|
| 61 |
+
- **TISE / Custom Potential**: placeholders for future extensions.
|
| 62 |
+
3) Animations update frame-by-frame (no jumps); energy and norm displayed live.
|
| 63 |
+
|
| 64 |
+
## How to Use the Simulation
|
| 65 |
+
1. Launch UI
|
| 66 |
+
- Double-click `run_app.bat` (or run `streamlit run streamlit_main.py`).
|
| 67 |
+
2. Pick a module in the sidebar:
|
| 68 |
+
- **Particle in a Box (PIB):** set L, n, dt, grid, solver (CN/SSFM); optionally enable superposition; click **Start**. View tabs for ψ, |ψ|², energies, animation; export PNG/CSV.
|
| 69 |
+
- **Hydrogen Spectrum:** choose series (Lyman/Balmer/...), set n₂>n₁; see wavelength, photon energy, stick spectrum, energy levels.
|
| 70 |
+
- **TDSE Simulation:** set wavepacket (x₀, σ, k₀), domain, dt, steps; click **Start TDSE**; scrub frames or auto-play; heatmap in second tab.
|
| 71 |
+
- **TISE / Custom Potential:** placeholders ready for extension.
|
| 72 |
+
3. Tips
|
| 73 |
+
- Sliders update instantly; animations are frame-by-frame (no jumps).
|
| 74 |
+
- If norm drifts, reduce dt or increase grid size.
|
| 75 |
+
- Export buttons provide PNG/CSV snapshots.
|
| 76 |
+
- Dark theme and auto-scaling are enabled by default.
|
| 77 |
+
4. PySide6 (optional)
|
| 78 |
+
- Run `python main.py` (if wired to PIBWindow); use Start/Pause/Reset.
|
| 79 |
+
|
| 80 |
+
## How to Run (PySide6 UI, optional)
|
| 81 |
+
```bash
|
| 82 |
+
cd "D:\Physics Simulation Project\Physics Simulation Project Code"
|
| 83 |
+
python main.py
|
| 84 |
+
```
|
| 85 |
+
(If main.py loads PIBWindow directly.) Use Start/Pause/Reset; plots update via QTimer.
|
| 86 |
+
|
| 87 |
+
## Testing
|
| 88 |
+
```bash
|
| 89 |
+
cd "D:\Physics Simulation Project\Physics Simulation Project Code"
|
| 90 |
+
python -m pip install pytest
|
| 91 |
+
pytest -q
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
## Key Features
|
| 95 |
+
- True TDSE solver (CN/SSFM) with normalization each step and stability checks
|
| 96 |
+
- Probability current and energy expectation utilities
|
| 97 |
+
- Infinite well, finite well, harmonic oscillator potentials
|
| 98 |
+
- Hydrogen spectrum calculations (wavelengths, series detection)
|
| 99 |
+
- Dark-themed, responsive Streamlit UI with export options and smooth set_ydata updates
|
| 100 |
+
|
| 101 |
+
## Notes
|
| 102 |
+
- If you see missing dependency errors, rerun `run_app.bat`.
|
| 103 |
+
- For large grids or small dt, computation may take longer; Streamlit shows progress where applicable.
|
| 104 |
+
- Custom potential editor and TISE pages are stubs ready for extension.
|