Spaces:
Sleeping
Sleeping
|
Download README.md from j25aiml013/physics-simulation: direct link, hf CLI and curl.
- Browser
- Download file 4.6 kB
-
https://huggingface.co/spaces/j25aiml013/physics-simulation/resolve/main/README.md
- Command line
-
hf download hf://spaces/j25aiml013/physics-simulation/README.md
-
curl -L -o README.md https://huggingface.co/spaces/j25aiml013/physics-simulation/resolve/main/README.md
4.6 kB
| title: Quantum Physics Simulation | |
| emoji: ⚛️ | |
| colorFrom: indigo | |
| colorTo: blue | |
| sdk: streamlit | |
| sdk_version: "1.32.0" | |
| app_file: app.py | |
| pinned: false | |
| # ⚛ Quantum Physics Simulation | |
| This interactive app visualizes: | |
| - Probability density of Hydrogen atom wavefunctions | |
| - Orbital shapes for quantum numbers n, l, m | |
| - Node structure | |
| - Phase visualization | |
| - Particle-in-a-box wavefunctions | |
| - 2D & 3D views | |
| - Animations | |
| Built using **Streamlit**, **NumPy**, and **Plotly 3D**. | |
| # Quantum Simulation Suite | |
| ## Overview | |
| - Particle in a Box (PIB) time-dependent Schrödinger simulation (Crank–Nicolson, Split-Step Fourier) | |
| - Hydrogen spectrum (Rydberg formula, energy levels, stick spectrum) | |
| - TDSE wavepacket evolution with spacetime heatmap | |
| - Modular UIs: Streamlit (dark theme, sidebar navigation) and PySide6 (legacy) | |
| - Physics engine: real constants, potentials, eigenfunctions, TDSE solver with normalization and stability checks | |
| ## Project Structure | |
| - `streamlit_main.py` — Streamlit entrypoint with sidebar pages | |
| - `run_app.bat` — Installs deps and launches Streamlit UI | |
| - `run_streamlit_main.bat` — Same as above (alternative launcher) | |
| - `app/core/physics_engine/` — constants, potentials, PIB equations, TDSE solver, hydrogen spectrum | |
| - `app/core/animations/` — Matplotlib animations (PIB, Hydrogen) | |
| - `app/ui_streamlit/` — Streamlit UIs (PIB, Hydrogen, TDSE, TISE placeholder, Custom Potential placeholder) | |
| - `app/ui/` — PySide6 legacy UI (PIB, Hydrogen, main window) | |
| - `app/tests/` — pytest suites for equations, potentials, solver | |
| - `data/`, `docs/` — optional data/docs folders (ignored by git) | |
| ## Requirements | |
| - Python 3.10+ | |
| - numpy, scipy, matplotlib, streamlit, PySide6, numba, pandas (batch files auto-install) | |
| ## How to Run (Streamlit UI) | |
| 1) Open a terminal: | |
| ```bash | |
| cd "D:\Physics Simulation Project\Physics Simulation Project Code" | |
| run_app.bat | |
| ``` | |
| (or `run_streamlit_main.bat` or `streamlit run streamlit_main.py`) | |
| 2) In the browser sidebar, choose: | |
| - **Particle in a Box (PIB)**: set L, n, solver, dt, grid; enable superposition; click Start. Tabs show ψ, |ψ|², energies, live animation. Export PNG/CSV available. | |
| - **Hydrogen Spectrum**: pick series and n₂>n₁; view wavelengths, photon energies, stick spectrum, energy levels. | |
| - **TDSE Simulation**: set wavepacket params, domain, dt/steps; compute frames; view animation and |ψ|² heatmap. | |
| - **TISE / Custom Potential**: placeholders for future extensions. | |
| 3) Animations update frame-by-frame (no jumps); energy and norm displayed live. | |
| ## How to Use the Simulation | |
| 1. Launch UI | |
| - Double-click `run_app.bat` (or run `streamlit run streamlit_main.py`). | |
| 2. Pick a module in the sidebar: | |
| - **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. | |
| - **Hydrogen Spectrum:** choose series (Lyman/Balmer/...), set n₂>n₁; see wavelength, photon energy, stick spectrum, energy levels. | |
| - **TDSE Simulation:** set wavepacket (x₀, σ, k₀), domain, dt, steps; click **Start TDSE**; scrub frames or auto-play; heatmap in second tab. | |
| - **TISE / Custom Potential:** placeholders ready for extension. | |
| 3. Tips | |
| - Sliders update instantly; animations are frame-by-frame (no jumps). | |
| - If norm drifts, reduce dt or increase grid size. | |
| - Export buttons provide PNG/CSV snapshots. | |
| - Dark theme and auto-scaling are enabled by default. | |
| 4. PySide6 (optional) | |
| - Run `python main.py` (if wired to PIBWindow); use Start/Pause/Reset. | |
| ## How to Run (PySide6 UI, optional) | |
| ```bash | |
| cd "D:\Physics Simulation Project\Physics Simulation Project Code" | |
| python main.py | |
| ``` | |
| (If main.py loads PIBWindow directly.) Use Start/Pause/Reset; plots update via QTimer. | |
| ## Testing | |
| ```bash | |
| cd "D:\Physics Simulation Project\Physics Simulation Project Code" | |
| python -m pip install pytest | |
| pytest -q | |
| ``` | |
| ## Key Features | |
| - True TDSE solver (CN/SSFM) with normalization each step and stability checks | |
| - Probability current and energy expectation utilities | |
| - Infinite well, finite well, harmonic oscillator potentials | |
| - Hydrogen spectrum calculations (wavelengths, series detection) | |
| - Dark-themed, responsive Streamlit UI with export options and smooth set_ydata updates | |
| ## Notes | |
| - If you see missing dependency errors, rerun `run_app.bat`. | |
| - For large grids or small dt, computation may take longer; Streamlit shows progress where applicable. | |
| - Custom potential editor and TISE pages are stubs ready for extension. | |