# DarkMatter
> Part of the [Celestial](https://celestial4498-prog.github.io/Celestial/) project
[](https://crates.io/crates/darkmatter)
[](https://docs.rs/darkmatter)
[](LICENSE)
A comprehensive Rust library for dark matter physics — covering candidate models, halo profiles, cosmological observables, detection channels, N-body dynamics, and large-scale structure.
---
## Scope
DarkMatter provides 12 modules spanning the full breadth of dark matter research:
| **candidates** | WIMPs, axions, fuzzy DM, warm DM, asymmetric DM, primordial black holes |
| **clusters** | Galaxy cluster dynamics, ICM, mass functions |
| **constants** | Physical and cosmological constants |
| **cosmology** | Boltzmann solver, CMB, relic abundance, reionization, structure formation, 21 cm |
| **detection** | Direct, indirect, collider, gravitational waves, spectra, EFT, dark sector |
| **dynamics** | Barnes-Hut tree, N-body, dynamical friction, tidal stripping, stability |
| **galaxy** | Formation, mergers, rotation curves |
| **halos** | NFW/Einasto/Burkert profiles, contraction, spikes, substructure |
| **large_scale** | Correlation functions, filaments, voids |
| **physics** | Gravity, lensing, SIDM, Sommerfeld enhancement, phase space, thermodynamics |
| **solar_system** | Capture, local density, orbital perturbations |
| **utils** | Unit conversions, ODE solvers, special functions, statistics |
## Quick Start
Add to your `Cargo.toml`:
```toml
[dependencies]
darkmatter = "*"
```
```rust
use darkmatter::halos::profiles;
use darkmatter::constants::physical;
let r = 8.0 * physical::KPC;
let rho = profiles::nfw_density(r, 1e12 * physical::SOLAR_MASS, 10.0);
```
## Stats
- **69** source files across **12** modules
- **781+** public items (functions, structs, enums)
- **~6 900** lines of physics code
- **87** integration tests in **7** test files
- **7** runnable examples
## Examples
Run any example with:
```bash
cargo run --example fuzzy_dm_example
cargo run --example sommerfeld_example
cargo run --example barnes_hut_example
cargo run --example boltzmann_example
cargo run --example gravitational_waves_example
cargo run --example phase_space_example
cargo run --example spectra_example
```
## Dependencies
- [sciforge](https://crates.io/crates/sciforge) — scientific computing foundation
## License
MIT — see [LICENSE](LICENSE)