A Starter Code for N-body Simulations

from:   Moving Stars Around (Piet Hut and Jun Makino, 2003).

We present here a simple N-body code that allows you to integrate the orbits of an arbitrary number of stars, modeled as mass points and moving under the influence of their mutual gravitational forces. At any given time, all stars share the same integration time step length, but the length itself varies from step to step. For example, if a strong and close interaction occurs anywhere in the system, the common time step size will shrink in order to avoid unacceptably large errors. The integration scheme is based on the fourth-order Hermite algorithm. The code is written in C++ and used is a completely stand-alone fashion.

You can pick up the code, together with a `readme' file and an explanatory chapter 8 of the book were it will be published, as a single gzipped tar file:

Alternatively, you can have a look at the

and read

here. In addition, the

gives some hints regarding the setting up of initial conditions.

For more information about this code, see our on-line volume Moving Stars Around which is part of our web site Art of Computational Science