This HTML automatically generated with rman for NEMO
Table of Contents

Name

bhtree, BHTC - Barnes-Hut treecode with an optional GRAPE-4 interface

Synopsis


bhtree [-options]
BHTC [-options]

Description

bhtree (formerly called nbody) is a C++ version of the Barnes-Hut treecode and its optional GRAPE-4 variant. This program was intended as the replacement for the old FORTRAN version of treecode developed by the author (v_code). The algorithm used in nbody and v_code are essentially the same. The main goal in the design of nbody is to minimize the memory usage. It requires about 8+200(N/106 ) MB of memory, where N is the number of particles.

During a build of the commmunity/bhtree code in AMUSE, a (worker) executable BHTC is created, which should be close to the current version of bhtree. It would need to be copied into $NEMOBIN if needed for benchmarking.

Parameters

bhtree does not have the usual NEMO getparam(3NEMO) interface, instead uses a private version of the pgetopt. snapshot files are in the "205" format.
-a
flag to control if output accelaration to snapshot output file as well. By default only mass, position, velocity and potentials are output. Note that BHTC does not have this option.
-i file
name of snapshot input file, in stoa(1NEMO) format (no default)
-o file
name of snapshot output file (default: no output)
-D float
time interval for snapshot output (default: 1)
-l float
interval for log output (default: 1: all step)
-T float
time to stop integration (default: 10)
-d float
timestep (default: 0.015625)
-e float
softening parameter (default: 0.025)
-t float
opening angle theta (default: 0.75)
-n int
ncrit for Barnes’ vectorization = maximum number of particles sharing an interaction list (default: 1024) (ONLY used with GRAPE/HARP implementation) - AMUSE::ncrit_for_tree
-N int
cell division criterion (default: 8 or 8 * # of pseudo particle) divide cell until it contains >N particles smaller memory requirement for larger N
-w float
window size for PGPLOT snapshot plot (default: 10)
-c
flag for collision run
-x xyz
relative position vector for collision run (no default)
-v uvw
relative velocity vector for collision run (no default)
-s float
scale factor for position scaling (default: 1)
-S float
scale factor for velocity scaling (default: 1)
-p int
order of multipole expansion (default: 1) (ONLY used with P2M2 implementation)
-r float
sphere radius on which pseudo particles are distributed (default: 0.2) (ONLY used with P2M2 implementation)
-F
never use full degree of freedom of pseudo particle even when p < 3 (ONLY used with P2M2 implementation)
-X string
command to be executed each time snapshot are output (default: no output) snapshot file name and its ID (counting from 0) is passed to the command.
-h print this help

Caveats

Files are silently appended to.

BHTC

is only available

Examples

An example of integrating a 1024 body Plummer sphere to time 10, and plotting the Lagrangian radii 0.1..0.9 as function of time:

mkplummer - 1024 | stoa - p1024
rm -f p1024.out p1024.snap
bhtree -i p1024 -o p1024.out -D 0.1 -T 10 > p1024.log 2>&1
atos p1024.out p1024.snap mass,phase,phi
snapmradii p1024.snap | tabplot - 1 2:10 line=1,1

Benchmark

To compare the original hackcode1 with bhtree, the following example is part of the Benchfile, integrating a 1024 body Plummer model for 1280 steps.

rm -f p1k.1 p1k.2
mkplummer p1k.1 1024 seed=123
stoa p1k.1 p1k.2
time=/usr/bin/time
$time hackcode1 p1k.1 . tstop=20 tol=0.75 freq=64 eps=0.025 > p1.log 2>&1
$time bhtree -i p1k.2 -T 20 -t 0.75 -d 0.015625 -e 0.025 > p2.log 2>&1

here are some results:


CPU    hackcode1    bhtree    BHTC
Ultra 7 155H    2.44    2.69    5.51
i7-1260P    2.75    2.85    5.43
i5-10210U          5.79    6.99    ?

Amuse

Since bhcode is also absorbed in amuse, we can compare a typical integration in both NEMO and AMUSE.

See Also

hackcode1(1NEMO) , atos(1NEMO) , stoa(1NEMO)
Barnes, J. & Hut, P. 1986. Nature 324, 446.
http://jun.artcompsci.org//softwares/C++tree/index.html (now deprecated)

Ads

@ads 1986Natur.324..446B

Files


$NEMO/usr/kawai/nbody
$AMUSE_DIR/src/amuse/community/bhtree/src
Note if amuse is installed with mknemo(1NEMO) , AMUSE_DIR=$NEMO/local/amuse

Author

Jun Makino

Update History


21-dec-1998    V1 written    Jun Makino
22-may-2025    man page written while renaming nbody to bhtree (MODEST25-SPZ)    PJT


Table of Contents