PySymmetry (Python Symmetry) is a comprehensive Python library for describing symmetries and their applications in physics.
Complete quantum simulation framework with:
- State Representations: Ket, Bra, DensityMatrix, entangled states (Bell, GHZ, W)
- Hamiltonian Operators: Free particle, harmonic oscillator, hydrogen atom, spin systems
- Schrodinger Solvers: Exact diagonalization, sparse solvers, time evolution
- Symmetry Analysis: Parity, translation, selection rules, conserved quantities
- Interactive API: SceneBuilder for arbitrary quantum scenarios
- Group Theory: Abstract groups, finite groups, continuous groups (U(1), SU(2), SO(3), etc.)
- Lie Theory: Lie algebras, representations, root systems
- Linear Algebra: Matrix operations, eigendecomposition
Framework for physical symmetries:
- Symmetry operations (translation, rotation, parity, time reversal)
- Physical representations
- Conservation laws via Noether's theorem
pip install PySymmetryfrom PySymmetry.phys.quantum import SceneBuilder, simulate, QuantumAnalyzer
# Create a harmonic oscillator
scene = (SceneBuilder("Harmonic Oscillator")
.add_electron(position=[0])
.add_harmonic_potential(center=[0], k=1.0)
.set_spatial_range(-10, 10)
.set_grid_points(300)
.build())
# Simulate
result = simulate(scene, num_states=5)
# Analyze
analyzer = QuantumAnalyzer(result.hamiltonian, result)
print(analyzer.generate_report())from PySymmetry.phys.quantum import analyze, quick_report
# Full analysis
result = analyze(hamiltonian, simulation_result)
# Quick report
print(quick_report(hamiltonian, simulation_result))See examples/ directory:
quantum_examples.py- Basic quantum systems (hydrogen, square well, spin)interactive_demo.py- Arbitrary scenario simulationanalysis_demo.py- Symmetry analysis demonstrations
PySymmetry/
├── src/
│ └── PySymmetry/
│ ├── core/ # Core mathematics
│ │ ├── algebraic_structures/
│ │ ├── group_theory/
│ │ ├── lie_theory/
│ │ ├── matrix/
| | └── and more...
│ │
│ ├── abstract_phys/ # Physical abstractions
│ │ ├── physical_objects/
│ │ ├── representation/
│ │ ├── symmetry_operations/
│ │ ├── symmetry_environments/
| | └── and more...
│ │
│ └── phys/ # Physics applications
│ └── quantum/ # Quantum module
│
├── examples/
├── tests/
├── pyproject.toml
└── README.md
Version: 1.0.0
- Core mathematical layer (groups, Lie algebras, representations)
- Abstract physics framework (symmetries, operations)
- Quantum physics module (states, Hamiltonians, solvers, analysis)
- Visualization tools
- Additional physics examples
- Performance optimization
- Python >= 3.10
- numpy >= 1.24
- scipy >= 1.10
- matplotlib (visualization)
- sympy (symbolic computation)
- spglib (crystallography)
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Run tests with
pytest - Submit a pull request
MIT License - see LICENSE
LDK (Cathylinlin)
- Email: bluejam001@163.com
- GitHub: https://github.com/cathylinlin/PySymmetry
Explore the beautiful world of symmetries! 🎉