HTML automatically generated with rman
Table of Contents


hackdens - local density estimator using tree algorithm


hackdens in=snapshot out=image [parameter=value]


hackdens calculates the local density in the configuration space using the hierarchical N-body algorithm (J. Barnes and P. Hut, Nature 324, 446). For small N or systems with complex geometry snapdens(1NEMO) may be preferred. For even more performance, density(1falcON) can be used.

The density can be writtin in the slot normally used for Potentials (the default), or if write_at_phi=f be written to a tag named Density.


The following parameters are recognized; they may be given in any order.
Input data will be read from in-file in snapshot format.
Output data are written to out-file in snapshot format.
Number of neighbors used to determine the local density [default: 6].

Initial radius to search the neighbors. Hackdens adaptively change this search radius during the calculation. Therefore it is definitely required that particles in the snapshot are arranged so that the neighboring particles have similar local density. (See NOTES) [default: 0.1].
Logical if the density data is written in the "Potential" slot of the snapshot file. If false, the density will be written with tag "Density". [default: f]
Intial size of the root box. Box will automatically expanded to keep all particles in it [defaults:4.0]
If given, the coordinates of the lower left corner of the initial box. If not given, the center of the root box will lie at the origin. [defaults:none]
Output control options, specified as a comma-separated list of keywords. Currently recognized keywords are: mass, phase: output mass, phase space data with major data outputs [defaults:mass,phase].
Ratio of cells to bodies, used when allocating cells [defaults:0.9].

Logical if print out the number of particles processed during the calculation [defaults:f].


Since the search radius is adaptively changed during the calculation, the local density of particles which are close in the position in the snapshot file should be similar.

Ideally, it is best if particles are sorted by the local density itself. Since the local density is not available, the second choice is to sort particles with some quantity that has strong correlation with the local density. For example, if the potential is available, sort particles by potential.

In many cases the system is roughly spherically symmetric. That means the density has strong correlation with the distance from the center of the cluster. Then sorting particles by the distance from the center will improve the speed significantly.


The following example takes an N-body snapshot, sort the particles in the order of the distance from the C.M., and calculate local density.
   snapcenter nbody.dat nbody.centered
   snapsort nbody.centered nbody.sorted rank="x*x+y*y+z*z"
   hackdens nbody.sorted nbody.density

See Also

hackforce(1NEMO) , snapdens(1NEMO) , density(1falcON)


The local density is calculated using (neib-1)th neighbor. Calculation can become very slow if the input snap shot is not well-formed. There should exist an option that forces the density will be written in the "Aux" slot of the snapshot file. Current version does not use standard get_snap/put_snap macros. KEY and AUX will be lost from the output snapshot.


N=4096, merger remnant

Presorted snapshot: 5 minutes on Sun-3/60, particles are presorted by the distance from the center of mass of the system.

Random snapshot: 60 minutes Sun-3/60


Jun Makino

Update History

2-Dec-88      V1.0:Created      Jun
6-jul-89    doc updated?    Jun
23-oct-90    doc updated    Peter
18-jul-92    printf -> dprintf to make it pipable    Peter
24-may-02    fixed running out of bits for large-N systems    PJT

Table of Contents