TI
TimGoTheCreator/NEXT
NEXT - Newtonian EXact Trajectories is a simulation tool written in C++.
NEXT - Newtonian EXact Trajectories
NEXT is a Multi-Threaded Simulation tool written in C/C++, solving the N-Body Problem
Using the Barnes-Hut With Higher Order Multipoles Algorithm at a time of O(N log N) licensed under the GNU GPLv3+
Initial Conditions
NEXT includes a modular python script to generate
initial conditions, it outputs simple
.txt files that NEXT can load directly.
The generator script is located in tools/icbuilder.py
NEXT supports two operating modes:
FP32, FP64
NEXT Multi-threading
NEXT Uses OpenMP and MPI to achieve multi-threaded workloads across cores (openmp) and computers (mpi)
NEXT uses a 3D Newtonian gravity formulation with:
- reduced division count (3-6x faster on avg.)
- Symmetric-force application
NEXT particle representation and I/O
Particles store:
position (x, y, z);
velocity (vx, vy, vz);
mass (m);Building NEXT
mkdir build
cd build
cmake ..
cmake --build . --config Release
cd ..Running a Demo
cd examples/TwoBodies
python two_body.py
../../next two_body.txt 8 0.01 0.1 vtuNEXT Mathematics
NEXT uses Division-avoiding algebra optimizations to make the simulation run faster.
NEXT also uses the Kick-Drift-Kick Leapfrog method which is implemented like this:
- Compute velocities with 0.5 dt
- Compute positions with full dt
- Compute velocities with 0.5 dt
NEXT Data Output
NEXT uses the .VTK format to output data.
More formats like HDF5 are planned.
Notes
NEXT outputs the final binary next to CMakeLists.txt file and not the /build directory.
Media examples of NEXT
On this page
Languages
C++66.3%Python24.8%CMake8.1%C0.8%
GNU General Public License v3.0
Created January 31, 2026
Updated March 4, 2026