# mkplummer

mkplummer|-n#|
|-s # (seed)|
|-m #|
|-r #|
|-i|
|-o|
|-c "..."|

## NAME

mkplummer - constructs a Plummer model, with a spatial or mass cut-off
## SYNOPSIS

mkplummer -n # [options]
## DESCRIPTION

Mkplummer builds a nbody system according to a Plummer model, in virial
units (M=G=-4E=1, with E the total energy), and finite spatial extent
which can be regulated by specifying mfrac or rfrac or using their default
values.
litt: S.J. Aarseth, M. Henon and R. Wielen (1974),
Astron. and Astrophys. 37, p. 183.

Calculating the coordinates is easiest in STRUCTURAL units;
conversion to VIRIAL units will be performed below.

Recipe for scaling to the proper system of units:

Since G = M = 1, if we switch from a coordinate system with
length unit r_old to a coordinate system with length unit r_new ,
the length units simply scale by a factor C = r_new / r_old .
Consequently, the coordinate values of physical quantities
such as positions should transform inversely to maintain the same
coordinate-invariant meaning. Similarly, the square of the velocities
should transform inversely proportional to the positions,
since GM = 1 (cf. a relation such as v*v = G*M/r ).

To summarize: If
r_unit(new) = C * r_unit(old) ,
then
pos(new) = (1/C) * pos(old)
and
vel(new) = sqrt(C) * vel(old) .

the position coordinates are determined by inverting the cumulative
mass-radius relation, with the cumulative mass drawn randomly from
[0, mfrac]; cf. Aarseth et al. (1974), eq. (A2).

the velocity coordinates are determined using von Neumann's rejection
technique, cf. Aarseth et al. (1974), eq. (A4,5).
First we take initial values for x, the ratio of velocity and escape
velocity (q in Aarseth et al.), and y, as a trick to enter the body of the
while loop.

## PARAMETERS/OPTIONS

### -n#

where # is the number of bodies in the Nbody system.
There is no default, this is a required parameter.
### -s # (seed)

where # stands for an integer either in the range
[1,2147483647], or # = 0 which causes a seed to be
chosen as the value of the UNIX clock in seconds; this
guarantees that no two calls will give the same value for
the seed if they are more than 2.0 seconds apart.
### -m #

mass fraction of the (infinitely extended) Plummer model
### -r #

radius fraction of the (infinitely extended) Plummer model
If the mass fraction and radius fraction are both 1.0 then
particles will be sprinkled in all over space. If mfrac < 1.0 or
rfrac < 1.0 then each particle is constrained to lie within
both the radial and (cumulative) mass bound.
For example, if rfrac( mfrac ) > rfrac then rfrac is the
limiting factor, but if rfrac( mfrac ) < rfrac then mfrac limits
the extent of the Plummer realization.

## SEE ALSO

mkcube
## FILES

mkplummer.C

## NOTE

after sprinkling in particles according to a Plummer
distribution, the whole system is shifted in position
and velocity so as to put the center of mass at rest
at the coordinate center.
## TODO

this should be moved elsewhere, of course. Included here just to
get it to work quickly (Piet, 921210).
## BUGS

None.
## AUTHOR

Piet Hut - 11-feb-95
## HISTORY