Pipe Your Quantum Mechanics Naturally
An intuitive, readable, and modern Python library for defining, solving, and visualizing 1D Schrödinger and Salpeter equations. Designed for nuclear physicists, particle physicists, and quantum mechanics students, PipeSchrod implements a clear pipeline syntax (>>) inspired by standard data workflows but applied to rigorous physical systems.
from pipeschrod import PipeSchrod
from pipeschrod.steps import Cornell, Grid, Solve, Plot, Export
# Your quantum pipeline reads like a recipe
result = (PipeSchrod(m1=1.4495, m2=1.4495)
>> Cornell(alpha=0.5317, b=0.1497)
>> Grid(N=200, rmax=20.0)
>> Solve("FGH")
>> Plot("dashboard")
>> Export("csv", path="charmonium.csv")
)💡 How to read
>>: Read the>>operator as "pipe to" or "then". For example, the code above reads as: "Initialize the PipeSchrod system, then apply a Cornell Potential, then attach a Grid, then Solve it utilizing FGH..."
# ❌ Traditional Logic: Nested definitions across dozens of lines
import numpy as np
# ... build matrices ...
# ... implement custom potential ...
# ... build boundary conditions ...
# ... retrieve eigensystems ...
# ✅ PipeSchrod: Clear, reproducible, and intuitive execution
PipeSchrod(m1=4.67, m2=4.67) >> Cornell(0.471, 0.192) >> Grid(N=200, rmax=20) >> Solve('Salpeter')- 🔗 Pipe Operator
>>- Streamline quantum definitions and model solvers intuitively. - 🌌 Broad Potential Support - Ready-to-go
Cornell,Harmonic,Coulomb,WoodsSaxon, andMorselimits. - 🧮 Advanced Precision Solvers - Run Standard Matrix ($O(h^2)$), Matrix Numerov ($O(h^4)$), Fourier Grid Hamiltonian ($O(h^6)$), and Salpeter Relativistic numerical methods.
- 📊 Rich Visualization - Native, automated matplotlib plotting targets inside the pipeline (spectra, wavefunctions, and densities).
- 💾 Data Interoperability - Export natively calculated matrices into datasets via
.jsonor.csv. - ⚡ Highly Cached Properties - Rapid property-fetching after solve pipelines.
# Basic installation via PyPI
pip install pipeschrod
# Install from source
git clone https://github.com/Yasser03/PipeSchrod.git
cd PipeSchrod
pip install -e .from pipeschrod import PipeSchrod
from pipeschrod.steps import Harmonic, Grid, Solve, Plot
# A simple Harmonic Oscillator pipeline
oscillator = (
PipeSchrod(m1=1.0)
>> Harmonic(omega=1.0)
>> Grid(N=200, rmax=10.0)
>> Solve("Matrix", "Numerov") # Run two solvers sequentially
>> Plot("wavefunctions") # Graph the resulting states
)
print(oscillator.result.bound_energies[:3])
# [0.5, 1.5, 2.5]The Pipe allows you to define configurations on the fly without modifying base templates, generating unique executions quickly and repeatedly:
# Define baseline environment
environment = PipeSchrod(m1=1.4495) >> Grid(N=200, rmax=20.0)
# Branch multiple specific scenarios without rewriting initial components
result_harmonic = environment >> Harmonic(1.0) >> Solve("FGH")
result_coulomb = environment >> Coulomb(1.0) >> Solve("FGH")| Verb | Purpose | Example |
|---|---|---|
PipeSchrod() |
Origin Initialization | PipeSchrod(m1=1.44, m2=1.44) |
Cornell() |
Set Potential | >> Cornell(alpha=0.5, b=0.1) |
Grid() |
Configure Grid Map | >> Grid(N=200, rmax=20.0) |
Solve() |
Apply Solvers | >> Solve("FGH", "Salpeter") |
Summary() |
Print Output | >> Summary(n_states=5) |
Plot() |
Visual Dashboard | >> Plot("dashboard", "spectrum") |
Compare() |
Solver Differences | >> Compare() |
Export() |
Save results | >> Export("json", path="data.json") |
For a full overview of verb arguments and potential functions, see the API Reference
PipeSchrod comes with several built-in physical potentials, each implemented as an independent pipe step. Here is how to configure and use them:
Creates a Cornell potential, widely used in quarkonium models:
# Create a charmonium system using the Cornell potential with spin-orbit coupling
PipeSchrod(m1=1.44) >> Cornell(alpha=0.5317, b=0.1497, pot_type=3, S=1, J=1)alpha(float): Strong coupling constant.b(float): String tension parameter.pot_type(int): Defines variants of the potential interactions:1: Standard Coulomb + Linear (default).2: Type 1 + Gaussian-smeared hyperfine interactions.3: Type 2 + Spin-orbit coupling + Tensor force.
sigma(float): Gaussian smearing parameter for hyperfine terms (used inpot_type >= 2).S,J(int): Total spin and total angular momentum quantum numbers (used inpot_type >= 3).
Applies a generic Harmonic Oscillator potential:
PipeSchrod(m1=1.0) >> Harmonic(omega=1.0)omega(float): Angular frequency of the oscillator.
Applies a strictly Coulombic potential target (Hydrogen-like):
# Hydrogen-like system
PipeSchrod(m1=0.511) >> Coulomb(Z=1.0)Z(float): Effective atomic number or generic charge coefficient.
A standard phenomenological model for nucleons:
PipeSchrod(m1=938.0) >> WoodsSaxon(V0=50.0, R=1.2, a=0.65)V0(float): Well depth.R(float): Nuclear radius.a(float): Surface thickness modifier.
An accurate model for diatomic molecular vibrations:
PipeSchrod(m1=1.0) >> Morse(De=1.0, re=1.0, a=1.0)De(float): Well depth (dissociation energy).re(float): Equilibrium bond length.a(float): Potential well width control.
# Solve the same grid across 4 different numerical methods simultaneously
system = (PipeSchrod(m1=1.4495)
>> Cornell(0.5317, 0.1497)
>> Grid(200, 20.0)
>> Solve("Matrix", "Numerov", "FGH", "Salpeter")
>> Compare() # Immediately view console matrix of diffs
)# Launch complex matplotlib graphs seamlessly inline
(system
>> Plot("wavefunctions") # individual plot
>> Plot("spectrum") # individual plot
>> Plot("dashboard") # 4-panel comprehensive view
)# Convert calculation matrices instantly to CSV
system >> Export("csv_compare", path="all_solvers.csv")from pipeschrod import PipeSchrod
from pipeschrod.steps import Cornell, Grid, Solve, Plot
charmonium = (
PipeSchrod(m1=1.4495, m2=1.4495)
>> Cornell(alpha=0.5317, b=0.1497, pot_type=1)
>> Grid(N=200, rmax=20.0)
>> Solve("FGH", "Salpeter")
>> Plot("spectrum", "compare_wf", save="./figures")
)base_environment = PipeSchrod(m1=4.67, m2=4.67) >> Grid(N=200, rmax=20.0)
# Quickly iterate alpha constants
result_1 = base_environment >> Cornell(alpha=0.450, b=0.192) >> Solve("FGH")
result_2 = base_environment >> Cornell(alpha=0.471, b=0.192) >> Solve("FGH")PipeSchrod adds minimal overhead to complex mathematical arrays while dramatically improving code readability:
Benchmarks:
-
Matrix Solver: Fastest build execution, relies precisely on
$O(h^2)$ step increments. -
Numerov Solver: Deep integration
$O(h^4)$ bounds reducing standard node drifts. -
Fourier Grid Hamiltonian (FGH): Superior convergence parameters using a 3-point or 5-point
$O(h^6)$ spectral analysis matrix. - Spinless Salpeter: Relativistic momentum computations calculated through discrete pseudo-spectral array layouts over heavy quark masses.
Why the syntax overhead is worth it:
- 🧠 Reduced cognitive load when comparing results
- 🐛 Fewer bugs from isolated variable scoping
- ⚡ Faster solver switching & prototyping
- 📚 Better script reusability
- Tutorial Notebook - A complete, hands-on walkthrough exposing every verb.
- API Reference - Detailed core documentation for all variables and potential models.
- Theoretical Details - Contains details on the theoretical part of the matrix methods.
- Examples - More advanced usage templates.
Contributions are extremely welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/advanced-potential) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/advanced-potential) - Open a Pull Request
MIT License - see the LICENSE file for details.
PipeSchrod is part of the Pipe ecosystem emphasizing readable, pipeline-centric processing:
- PipeFrame - DataFrame manipulation using python pipes.
- PipePlotly - Grammar-of-graphics charting using python pipes.
- PipeScrape - Structural web scraping using python pipes.
If you use PipeSchrod in your research or educational materials, please cite it as follows:
@software{pipeschrod,
author = {Mustafa, Yasser},
title = {PipeSchrod: Pipe Your Quantum Mechanics Naturally},
url = {https://github.com/Yasser03/PipeSchrod},
year = {2026}
}If PipeSchrod helps your research or calculations, please consider giving it a star! ⭐
- ✅ Standard non-relativistic solvers (Matrix, Numerov, FGH)
- ✅ Spinless Salpeter
- ✅ Matplotlib auto-dashboard capabilities
- ✅ 5 native potential models
- Direct Plotly integration for interactive charts.
- Real-time UI controls and widgets natively attached to output models.
- Distributed batch solving for massive variable sweeps.
Dr. Yasser Mustafa
AI & Data Science Specialist | Theoretical Physics PhD
- 🎓 PhD in Theoretical Nuclear Physics
- 💼 10+ years in production AI/ML systems
- 🔬 48+ research publications
- 🏢 Experience: Government (Abu Dhabi), Media (Track24), Recruitment (Reed), Energy (ADNOC)
- 📍 Based in Newcastle Upon Tyne, UK
- ✉️ yasser.mustafan@gmail.com
- 🔗 LinkedIn | GitHub
PipeSchrod was born from the need for a more intuitive, pipe-based approach to defining and solving quantum mechanical bound-state systems, combining the analytical rigor of numerical solvers with the elegance of modern functional programming interfaces.
- Issues: Report bugs or request features
- Discussions: Ask questions, share use cases
Built with ❤️ for physicists and educators who value readability
Pipeline your quantum states naturally with PipeSchrod ⚛️