https://github.com/sciml/nbodysimulator.jl
A differentiable simulator for scientific machine learning (SciML) with N-body problems, including astrophysical and molecular dynamics
https://github.com/sciml/nbodysimulator.jl
algorithmic-differentiation automatic-differentiation differentiable-programming geometric-algorithms molecular-dynamics molecular-dynamics-simulation scientific-machine-learning sciml symbolic-integration
Last synced: 4 months ago
JSON representation
A differentiable simulator for scientific machine learning (SciML) with N-body problems, including astrophysical and molecular dynamics
- Host: GitHub
- URL: https://github.com/sciml/nbodysimulator.jl
- Owner: SciML
- License: other
- Created: 2018-07-24T14:54:52.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-08-12T05:39:16.000Z (6 months ago)
- Last Synced: 2025-10-21T12:36:03.754Z (4 months ago)
- Topics: algorithmic-differentiation, automatic-differentiation, differentiable-programming, geometric-algorithms, molecular-dynamics, molecular-dynamics-simulation, scientific-machine-learning, sciml, symbolic-integration
- Language: Julia
- Homepage: https://docs.sciml.ai/NBodySimulator/stable/
- Size: 621 KB
- Stars: 137
- Watchers: 7
- Forks: 19
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Citation: CITATION.bib
Awesome Lists containing this project
README
# NBodySimulator
[](https://julialang.zulipchat.com/#narrow/stream/279055-sciml-bridged)
[](https://docs.sciml.ai/NBodySimulator/stable/)
[](https://codecov.io/gh/SciML/NBodySimulator.jl)
[](https://github.com/SciML/NBodySimulator.jl/actions?query=workflow%3ACI)
[](https://github.com/SciML/ColPrac)
[](https://github.com/SciML/SciMLStyle)
Simulating systems of N interacting bodies.
## Tutorials and Documentation
For information on using the package,
[see the stable documentation](https://docs.sciml.ai/NBodySimulator/stable/). Use the
[in-development documentation](https://docs.sciml.ai/NBodySimulator/dev/) for the version of
the documentation, which contains the unreleased features.
## Example
```julia
using NBodySimulator
using StaticArrays
using Plots
body1 = MassBody(SVector(0.0, 1.0, 0.0), SVector(5.775e-6, 0.0, 0.0), 2.0)
body2 = MassBody(SVector(0.0, -1.0, 0.0), SVector(-5.775e-6, 0.0, 0.0), 2.0)
G = 6.673e-11
system = GravitationalSystem([body1, body2], G)
tspan = (0.0, 1111150.0)
simulation = NBodySimulation(system, tspan)
sim_result = run_simulation(simulation)
animate(sim_result, "path_to_animated_particles.gif")
```