This HTML automatically generated with rman for NEMO
Table of Contents

Name

hackcode1, hackcode1_qp - hierarchical N-body code

Synopsis

hackcode1 [parameter=value] ...

Description

hackcode1 is an equal-timestep implementation of a hierarchical N-body code (J. Barnes and P. Hut, Nature 324, 446). It uses an adaptave Eulerian tree to reduce the number of interactions per time-step to O(NlogN). hackcode1_qp is similar, but includes quadrupole corrections to body-cell interactions (L. Hernquist, App. J. Suppl., 64, 715, 1987).

Particles with zero mass will not be included in building the tree structure, and hence in effect produce a restricted N-body code.

A special program, snapdiagplot(1NEMO) can be used to monitor conservation of energy and momentum.

Parameters

The following parameters are recognized in order; they may be given in any order if the keyword is also given. Use --help to confirm this man page is up to date.
in=in-file
If given, initial conditions will be read from in-file in snapshot format. At most one of in, restart, or continue may be specified.
out=out-file
If given, results are written to out-file in snapshot format.
restart=state-file
If given, the system state will be read from state-file. New values are accepted for the following parameters: out, save, eps, tol, options, fcells, tstop, freqout, minor_freqout, and debug. At most one of in, restart, or continue may be specified.
continue=state-file
If given, the system state will be read from state-file. New values are accepted for the following parameters: out, save, and debug. At most one of in, restart, or continue may be specified.
save=state-file
If given, the system state will be saved in state-file after each timestep.
nbody=nbody-value
Number of bodies for test data, generated only if none of in, restart, or continue are specified. Default is 128.
seed=random-seed
Random number seed used in generating initial conditions. Default is 123.
cencon=cencon-flag
If true, generate centrally concentrated test system. Default is false.
freq=integ-freq
Inverse time-step, to be used with a leap-frog integrator. Default is 32.0 (32 steps per unit time).
eps=soft-length
Force softening parameter. Default is 0.05.
tol=theta-value
Opening-angle tolerence parameter. Default is 1.0.
fcells=fcells-value
Ratio of cells to bodies, used when allocating cells. Default is 0.75.
options=option-string
Miscellaneous control options, specified as a comma-separated list of keywords. Currently recognized keywords are: reset_time: when reading initial data, set tnow to zero; new_tout: when restarting, set new output times; mass, phi, acc: output mass, potential, acceleration data with major data outputs. The phase space coordinates are always output. It also seems that the reset_time and new_tout options have not been implemented yet. Default: mass,phase.
tstop=stop-time
Time to stop integration in N-body model units. Default is 2.0.
freqout=out-freq
Frequency of major N-body data outputs. Default is 4.0 (4 frames per unit time).
minor_freqout=out-freq
Frequency of minor diagnostic outputs. If this frequency is not a simple fraction of freq (see above), the program can waiste significant amounts of time. Default is 32.0 (32 diagnostic measurements per unit time).
log=logfile
Output filename for log. Default is standard output (-). Can also use log=. to make it disappear in case your out=- needs to be part of a pipe.

See Also

treecode(1NEMO) , newton0(1NEMO) , directcode(1NEMO) , gyrfalcON(1NEMO) , snapdiagplot(1NEMO)
Barnes & Hut paper: https://ui.adsabs.harvard.edu/abs/1986Natur.324..446B
Appel, A. SIAM J. Sei. statist. Comput. 6, 85-103 (1985)  https://doi.org/10.1137/0906008

Ads

@ads 1986Natur.324..446B

Bugs

This code is the very original 1986 (NEMO) version of the Barnes & Hut treecode and only kept in NEMO for that reason. It is not the most efficient treecode (see e.g. treecode(1NEMO) and gyrfalcON(1NEMO) for improved versions), and also suffers from the Warren & Salmon imploding galaxy bug.

When a restart is specified, values must be given for ALL legal parameters which do not take default values.

continue= does not seem to work. Use restart=

Benchmark

Running hackcode1 with all default parameters will integrate a 128 body plummer sphere for 64 timesteps to time 2 with softening 0.05 and critical opening angle 1 and a seed of 123. Assuming the standard portable ’ran3’ from NumRec is being used in xrandom(3NEMO) , we get the following initial and final printout:
  tnow       T+U       T/U     nttot     nbavg     ncavg   cputime
 0.000   -0.2675   -0.5434      3864         9        20      0.00
          cm pos   -0.0000    0.0000    0.0000
          cm vel   -0.0000    0.0000   -0.0000
  tnow       T+U       T/U     nttot     nbavg     ncavg   cputime
 2.000   -0.2647   -0.4857      4899        17        20      0.00
          cm pos    0.0002   -0.0018    0.0007
          cm vel    0.0003   -0.0019    0.0009

Caveats

Particles cannot occupy the same position, since building the treestructure is done in integerized coordinates.

This code is part of NEMOBENCH5 (see bench(5NEMO) ) and sometimes after a recompilation hackcode1 shows a severe underperformance. This is some kind of compilation bug, which can be resolved by recompiling and running the test again, e.g.

mknemo -t -T hackcode1

Author

Joshua E. Barnes.

Files


src/nbody/evolve/hackcode/hackcode1/    original NEMOized 1986 code
usr/josh/treecode            updated 1990s version

History


1-jul-87    V1.0  man written    JEB
11-jul-89    V1.2  using getparam()’s debug keyword + doc impr.     PJT
8-jun-90    V1.2  corrected error in man page    PJT
13-may-91    added undocumented feature of restricted Nbody      PJT
6-mar-94    added link to export version    PJT
29-mar-04    V1.4 major code cleanup for MacOS and prototypes    PJT
27-jul-11    V1.5 removed debug=, added log=      PJT


Table of Contents