HNBody
Version 1.2.1

Particles can be divided into three basic groups:
This logical division of particles is useful whenever M_H >> M_L >> M_Z, where M_k is the total mass of particles in group k. If used to follow close encounters between bodies, the package is able to shift particles between the LWP and ZWP classes to maintain a balance between accuracy and efficiency (note: this feature is currently disabled).
For background information on the symplectic algorithms employed, see:
RungeKutta and BulirshStoer ODE integrators are also available; they have been included mainly for the purposes of testing and generating comparison runs.
The HWP/LWP system integration coordinates can be either Jacobi (barycentric) or canonical bodycentric (a.k.a. heliocentric, in the Solar System case). ZWPs are integrated as perturbed twobody orbits, and perturb nothing themselves; their integration coordinates can be either barycentric (specifically, the barycenter of the HWP/LWP subsystem) or canonical bodycentric, and their coordinates (as well as the timestep used) need not agree with those used for the other two groups. HWPs and LWPs always share the same coordinate choice and timestep.
Bodycentric, barycentric, and (time) regularized barycentric coordinates are available for ZWPs; bodycentric and Jacobi coordinates are available for the HWP/LWPs. An optional Modified bodycentric coordinate choice (see IntegCoord) implements Touma & Wisdom's form of the Hamiltonian splitting, which is exact for the twobody problem (unlike canonical bodycentric coordinates).
The default ordering of Jacobi indices i in terms of particle array indices j is (nH=# HWPs, nL=# LWPs):
i: 0 1 ... nL, 1+nL ... nH1+nL j: 0, nL+nH1 ... nH, 1 ... nH1
Thus, array indices of LWPs need not correspond to semimajor axes in any way since all LWPs will be integrated using nearbodycentric coordinates; HWPs should normally appear in order of increasing semimajor axis (this maximizes accuracy). The ordering of Jacobi indices can be changed by specifying a JacIndex field in InputOrder.
To the base coordinates a number of predefined modifiers can be added specifying things such as a 4th order integration or use of a symplectic corrector. Current options:
Example: coord=Corrected+Order4+Jacobi
Let K = `kick', S = `shift', and D = `drift'. By default integrations proceed as K/2  S/2  D  S/2  K/2 (Kick_Drift); option Drift_Kick implies D/2  S/2  K  S/2  D/2 and option Shift_Drift implies S/2  K/2  D  K/2  S/2. In practice hnb_step() proceeds as S/2  K  S/2  D, S/2  K  S/2  D, or K/2  S  K/2  D, respectively; hnb_halfstep() performs the realignment to "halfstep" output phase. Note that the shift term is absent unless either bodycentric coordinates or postNewtonian corrections are used.
Currently, resolving close encounters between particles requires use of one of the ODE integration schemes (see Integrator). Support for close encounters in symplectic integrations will be available in a future release (see Problems and Limitations).