Extended IDL Help

This page was created by the IDL library routine make_html_help. For more information on this routine, refer to the IDL Online Help Navigator or type:

     ? make_html_help

at the IDL command line prompt.

Last modified: Wed May 20 22:19:22 1998.


List of Routines


Routine Descriptions

[Next Routine] [List of Routines]
 NAME:
       
 PURPOSE:
       
 CATEGORY:
       
 CALLING SEQUENCE:
       
 INPUTS:
       
 KEYWORD PARAMETERS:
       
 OUTPUTS:
       
 COMMON BLOCKS:
       
 SIDE EFFECTS:
       
 NOTES:
       
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/general/lambda.pro)


ANG_MOM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       ANG_MOM
 PURPOSE:
       Calculate angular momentum of a particle distribution
 CATEGORY:
       Nbody/general
 CALLING SEQUENCE:
       L = ang_mom( Pos, Vel )
 INPUTS:
       Pos    -- A 3 X NPart array of positions, where NPart is the
                 number of particles.
       Vel    -- A 3 X NPart array of velocities, where NPart is the
                 number of particles.
 KEYWORD PARAMETERS:
 OUTPUTS:
       L     -- A 3 X NPart array of angular momentum, evaluated at
                the position of each particle.
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       Angular momentum is calculated as R X V. 
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id: ang_mom.pro,v 1.1 1997/03/06 22:39:05 mcraig Exp $
       $Log: ang_mom.pro,v $
       Revision 1.1  1997/03/06 22:39:05  mcraig
       Initial revision

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/ang_mom.pro)


BIN_HALO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       BIN_HALO
 PURPOSE:
       Bin a set of particles into radial bins, with the same number
       of particles in each radial bin.
 CATEGORY:
       N-Body.
 CALLING SEQUENCE:
       bin_halo, Pos, Cen, BinBdry
 INPUTS:
       Pos -- A two dimensional array fltarr(3,*)                 in
              containing the particle positions.  
       Cen -- A vector [Cx, Cy, Cz] containing the                in
              x,y,z coordinates of the halo center.
 KEYWORD PARAMETERS:
       BIN_SIZE  -- Number of particles in each bin.              in
                    Default is 50.  Ignored if USE_RAD is set.
       USE_RAD   -- Rather than requiring a certain number of     in
                    particles per bin, set this to the radii at
                    which the profile should be calculated.
                    Overrides BIN_SIZE.
       PERIOD    -- Set to length of box if particles are drawn   in
                    from a periodic box.
       BIN_INDEX -- Set to a named variable to receive an array   out
                    indicating which particles contributed to
                    each bin.  The array is set up like the 
                    reverse histogram array in HISTOGRAM, so that
                    BinIndex(BinIndex(i):BinIndex(i+1)-1) contains 
                    the indices of the particles in bin i.
       NUMBINS   -- Set to a named variable to receive number of  out
                    bins created.
       NUMPERBIN -- Set to named variable to reveive vector       out
                    containg the number of particles in each bin.
                    Vector is longword, of length NUMBINS.
       /HELP     -- Print useful message and exit.                 
 OUTPUTS:
       BinBdry   -- The boundaries of the radial bins created.    out
                    This is a real vector with NUMBINS+1
                    elements, since  NUMBINS bins have one more
                    boundary than bins.
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       The profiles are are tabulated either:
      
        i) at radii such that each radial bin contains the same number
           of particles, if USE_RAD is NOT set, or
       ii) at the radii specified by the keyword USE_RAD.

       Distances are returned in the same units as were input in
       Pos.  Velocities are in units with distances measured as
       in Pos, and G=1, and mass per particle = 1.  Masses are
       tabulated in terms of particle number.
 EXAMPLE:
       profile_halo,/DENSITY, pos, cen, rad, den, BIN=250
       Construct a density profile for the set of particles contained
       in pos (nonperiodic), with center cen.  There are 250
       particles per radial bin, with the bin radii in rad, and the
       density at those radii in den.
 LIBRARY FUNCTIONS CALLED:
 MODIFICATION HISTORY:
       $Id$
       $Log$

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/bin_halo.pro)


CALC_KE_FOR_SUBSET

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       calc_ke_for_subset
 PURPOSE:
       Calculate kinetic energy per particle for a subset of
       particles. 
 CATEGORY:
       Nbody/gen
 CALLING SEQUENCE:
       Ke = calc_ke_for_subset( Files, Particles )
 INPUTS:
       Files --- An array containing the names of the files which
                 contain particle position/velocity information.
       Particles -- An index array with the indices of the particles
                    which are to be used in calculating the KE.  If
                    omitted, all particles will be used. OPTIONAL.
 KEYWORD PARAMETERS:
       /PHYSICAL -- If this keyword is nonzero, the kinetic energy
                    will be calculated in physical units.
 OUTPUTS:
       Ke   -- Array of kinetic energies, one per input file.
 COMMON BLOCKS:
 SIDE EFFECTS:
       Makes temporary use of a file unit.
 NOTES:
       If physical is not specified, kinetic energy is provided in
       code units.
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/general/calc_ke_for_subset.pro)


CALC_PHASE[1]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CALC_PHASE
 PURPOSE:
       Calculate phase space density in an N-body simulation.
 CATEGORY:
       N-body
 CALLING SEQUENCE:
       phase_density = calc_phase( pos, vel )
 INPUTS:
       pos      -- Positions of the particles, as a              in
                   3xNPart array.
       vel      -- Velocities of particles, as a                 in
                   3xNPart array.
 KEYWORD PARAMETERS:
       CENTER   -- Point at which to calculate the course        in
                   grained phase space density. Pass 
                   [x,y,z] position. Default is
                   center of mass of particles. 
       RADIUS   -- Include all particles within RADIUS of        in
                   CENTER in the average, regardless of number
                   of particles within RADIUS.  See Notes below.
       NPAVG    -- Include NPAVG particles in the calculation    in
                   of the phase space density, regardless of     
                   the radius of the sphere enclosing the 
                   particles.  If you use NPAVG, you should
                   also specify GUESS_RADIUS. See Notes below.
       GUESS_RADIUS -- If using NPAVG, a guess as to the radius
                       in which NPAVG particles are included.
       VOLUME   -- Volume of the region occupied by particles.   in/out
                   If input, will use all particles in 
                   calculating phase space density.  If set to
                   named variable, will have volume used in 
                   calculating density on output.
       /HELP    -- Print useful message and exit.
 OUTPUTS:
       phase_space -- Phase space density.  Units are particles  out
                      per unit volume, per unit of velocity 
                      cubed.
 COMMON BLOCKS:
 SIDE EFFECTS:
       
 NOTES:
       The set of rules used to determine which particles to include
       in the average is a bit complex.  You can specify the the code
       either:
           1) Use all particles passed in pos to find the density.
              To use this option, pass a volume using the
              VOLUME keyword.  If NPAVG is set to a named variable,
              it will contain the number of particles in pos on
              output.
           2) Use all particles within a certain radius of CENTER.
              To use this option, pass a radius with the RADIUS
              keyword.  It is important that you do NOT also specify
              the number of particles to use with NPAVG.  If you do,
              you will move to case 3.  However, if you pass a named
              variable whose value is zero (or which is undefined)
              in  the keyword NPAVG, then the number of particles
              used in the estimated density will be returned in
              that variable.
           3) Use a specified number of particles to compute the
              average by passing the number in NPAVG.  You should
              ALSO pass a guess as to the radius these particles are
              contained in the keyword RADIUS.  If RADIUS has been
              set to a named variable, the radius which was used in
              calcualting the average will be returned.  
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       center_mass     -- N-body (mcraig)
       select_sphere   -- N-body (mcraig)
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/general/OLD_calc_phase.pro)


CALC_PHASE[2]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CALC_PHASE
 PURPOSE:
       Calculate phase space density in an N-body simulation.
 CATEGORY:
       N-body
 CALLING SEQUENCE:
       phase_density = calc_phase( pos, vel, Avg )
 INPUTS:
       pos      -- Positions of the particles, as a              in
                   3xNPart array.
       vel      -- Velocities of particles, as a                 in
                   3xNPart array.
       Avg      -- Specification of region to use for phase      in
                   space estimation.  Either volume all 
                   particles occupy, radius over which to 
                   average, or number of particles to include
                   in average.  See /USE_* keywords below.
 KEYWORD PARAMETERS:
       CENTER   -- Point at which to calculate the course        in
                   grained phase space density. Pass 
                   [x,y,z] position. Default is
                   center of mass of particles. 
       PERIOD   -- Period of box, if periodic.  Default is       in
                   0.0 (non-periodic).  See Notes below.
       /USE_ALL -- Use all particles passed for the phase space
                   average.  The positional argument Avg is 
                   taken to be the volume the particles occupy.
                   This is the default action.
       /USE_RAD -- Use all particles within specified distance
                   of CENTER in calculating pahse space density. 
                   Parameter Avg is radius over which to average.
                   Default is /USE_ALL.
       /USE_NP  -- Use number of particles specified in Avg 
                   in the phase density estimate.  You should
                   also pass the radius which will enclose 
                   roughly this many particles in GUESS_RADIUS.
                   Default is /USE_ALL.
       GUESS_RADIUS -- If you specify /USE_NP, set to the        [in]
                       radius of the sphere about CENTER which 
                       includes roughly Avg number of particles.
       VOLUME   -- Volume of the region occupied by particles.   out
                   Set to named variable to receive on output.
       RADIUS   -- Radius over which average was taken,          out
                   In case of /USE_ALL, this is just 
                   the cube root of 3*Volume/3/!PI.
       NPAVG    -- Number of particles included in the average.  out
       /HELP    -- Print useful message and exit.
 OUTPUTS:
       phase_space -- Phase space density.  Units are particles  out
                      per unit volume, per unit of velocity 
                      cubed.
 COMMON BLOCKS:
 SIDE EFFECTS:
       
 NOTES:
       If your box is periodic but the region used in calculating the
       phase space density does NOT wrap around the box, it will be
       faster if you treat the box as non-periodic.
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       center_mass     -- N-body (mcraig)
       select_sphere   -- N-body (mcraig)
       select_np       -- N-body (mcraig)
 MODIFICATION HISTORY:
       $Id: calc_phase.pro,v 1.1 1997/03/06 22:39:42 mcraig Exp $
       $Log: calc_phase.pro,v $
       Revision 1.1  1997/03/06 22:39:42  mcraig
       Initial revision

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/calc_phase.pro)


CHAIN_CELL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CHAIN_CELL
 PURPOSE:
       Place particles in an N-body simulation onto a chaining cell
       to allow for fast selection of particles.
 CATEGORY:
       N-body
 CALLING SEQUENCE:
       CellNum = chain_cell( Pos, NCells )
 INPUTS:
       Pos      -- A 3 X NPart array of particle positions.    in
       NCells   -- The (integer) number of cells on each       in
                   side.
 KEYWORD PARAMETERS:
       CELLSIZE  -- The size of the cell, in the same units    in
                    as Pos.  Default is 
                    (max(Pos) - min(Pos))/NCells.
 OUTPUTS:
       CellNum   -- Array of cell number for each particle.    out
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       Cell numbers are encoded as a single number by the following
       algorithm: 
           
             CellNum = long(Pos(0,j)/CellSize) 
                       + NCells*long(Pos(1,j)/CellSize) 
                       + NCells^2*long(Pos(2,j)/CellSize) 
     
       The number of the X cell is stored in the lowest NCell bits,
       then the Y cell number in the next NCell numbers, then the Z
       cell number.
       To get from the single integer CellNum to the cell number for
       each direction, use the following formula:

             CellX = CellNum mod NCells    
             CellZ = long(CellNum/NCells^2)
             CellY = long((CellNum mod NCells^2)/NCells)

       Note that cell numbers run from 0 to NCells-1.
 EXAMPLE:
       Cells = chain_cell( pos, 20, CELLSIZE=1.0/20. )
       Return cell number for positions (note Cells is a one
       dimensional array with the same number of elements as the
       number of particles).  CELL is set to 1.0/20 because the
       computational box has size 1.0, even though pos may not
       completely fill it.
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id: chain_cell.pro,v 1.1 1997/03/06 22:57:15 mcraig Exp $
       $Log: chain_cell.pro,v $
       Revision 1.1  1997/03/06 22:57:15  mcraig
       Initial revision

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/chain_cell.pro)


CHAIN_NEIGHBOR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CHAIN_NEIGHBOR
 PURPOSE:
       Calculate the chaining cell numbers of the neighbors of a
       given cell.
 CATEGORY:
       Nbody/gen
 CALLING SEQUENCE:
       nbrs = chain_neighbor( Home, NCells )
 INPUTS:
       Home   -- The chaining cell number of the cell whose     in
                 neighbors are desired.
       NCells -- The number of chaining cells in each           in
                 direction.  If input as a single number, 
                 number of cells is taken to be same in all 
                 directions.  Set to a three element vector
                 if number of cells is different in each 
                 direction.
 KEYWORD PARAMETERS:
       /PERIODIC  -- Set this keyword if the box is periodic. 
                     Period is taken to be NCells.
       /HELP      -- Set this keyword to receive a useful help
                     message and exit.
 OUTPUTS:
       nbrs  -- An array containing the cell numbers of the     out
                neighbors.  The home cell is NOT included in
                this array.
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       
 EXAMPLE:
       Home = 1234L & NCells=15
       nbrs = chain_neighbor( Home, NCells, /PERIODIC )
       nbrs returns the neighbor cells of cell 1234, assuming 15
       cells on a side in a periodic box.
   
       nbrs = [15, 19, 3]
       nbrs = chain_neighbor( Home, NCells )
       Find neighbors of cell 1234 in a box with 15 x 19 x 3 cells,
       not periodic.
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id: chain_neighbor.pro,v 1.1 1997/03/06 22:56:37 mcraig Exp $
       $Log: chain_neighbor.pro,v $
       Revision 1.1  1997/03/06 22:56:37  mcraig
       Initial revision

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/chain_neighbor.pro)


GRAPE_POT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       GRAPE_POT
 PURPOSE:
       Calculate gravitational potential energy of a set of particles
       using the GRAPE.
 CATEGORY:
       Nbody/gen
 CALLING SEQUENCE:
       pot = grape_pot(Pos, Mass, Softening)
 INPUTS:
       Pos -- Positions of the particles, may be either 3 X NPart or
              NPart X 3 (but see NPART keyword below).
       Mass -- Particle mass (all particles must have same
               mass). Optional: default is 1.0.
 KEYWORD PARAMETERS:
       MINX -- Sets value of GRAPE position scaling parameter.  If   [in]  
               not set by user, value is .5*max(pos).
       MINM -- Sets mass scaling parameter for GRAPE.  Is set to     [in]
               Mass if no value is specified.
       ACC  -- Set to a named variable to receive an array of        [out]
               accelerations for each particle. MUST ALSO SET 
               KEYWORD WANT_ACC (sorry that's so way lame).
       /WANT_ACC -- Set if the output acceleration is desired.
       NPART - Number of particles.  This parameter MUST be 
               specified if the number of dimensions is not three,   [in]
               or if there are three particles in three dimensions.
       SOFTENING -- Gravitational softening (see note                [in]
                    below). Optional: default is 0.0.
 OUTPUTS:
       Pot  -- Gravitaionpotential evaluated at the position of each
               particle. 
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       The potential due to a particle a distance r away is:
      
              pot =  1/(r + \epsilon)

       where \epsilon is the gravitational softening.
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/general/grape_pot.pro)


HIST_BY_NUM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       HIST_BY_NUM
 PURPOSE:
       Create a histogram with a set number of points per bin.
 CATEGORY:
       N-Body.
 CALLING SEQUENCE:
       HIST_BY_NUM, Pos, Cen, BinBdry
 INPUTS:
       Pos -- A two dimensional array fltarr(3,*)                 in
              containing the particle positions.  
       Cen -- A vector [Cx, Cy, Cz] containing the                in
              x,y,z coordinates of the halo center.
 KEYWORD PARAMETERS:
       BIN_SIZE  -- Number of particles in each bin.              in
                    Default is 50.  Ignored if USE_RAD is set.
       USE_RAD   -- Rather than requiring a certain number of     in
                    particles per bin, set this to the radii at
                    which the profile should be calculated.
                    Overrides BIN_SIZE.
       PERIOD    -- Set to length of box if particles are drawn   in
                    from a periodic box.
       BIN_INDEX -- Set to a named variable to receive an array   out
                    indicating which particles contributed to
                    each bin.  The array is set up like the 
                    reverse histogram array in HISTOGRAM, so that
                    BinIndex(BinIndex(i):BinIndex(i+1)-1) contains 
                    the indices of the particles in bin i.
       /HELP     -- Print useful message and exit.                 
 OUTPUTS:
       Rad       -- Set to a named variable to receive the        out
                    positions at which the halo profile
                    is tabulated.
       Profile   -- The desired profile.  See description under   out
                    keyword parameters for each profile type
                    for units.
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       The profiles are are tabulated either:
      
        i) at radii such that each radial bin contains the same number
           of particles, if USE_RAD is NOT set, or
       ii) at the radii specified by the keyword USE_RAD.

       Distances are returned in the same units as were input in
       Pos.  Velocities are in units with distances measured as
       in Pos, and G=1, and mass per particle = 1.  Masses are
       tabulated in terms of particle number.
 EXAMPLE:
       profile_halo,/DENSITY, pos, cen, rad, den, BIN=250
       Construct a density profile for the set of particles contained
       in pos (nonperiodic), with center cen.  There are 250
       particles per radial bin, with the bin radii in rad, and the
       density at those radii in den.
 LIBRARY FUNCTIONS CALLED:
 MODIFICATION HISTORY:
       $Id: hist_by_num.pro,v 1.2 1997/03/04 18:40:57 mcraig Exp mcraig $
       $Log: hist_by_num.pro,v $
       Revision 1.2  1997/03/04 18:40:57  mcraig
       Removed debugging print statements.

       Revision 1.1  1997/02/18 18:20:59  mcraig
       Initial revision

       Revision 1.1  1996/06/28 22:41:39  mcraig
       Initial revision

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/hist_by_num.pro)


ID_VIRIAL_GROUPS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       ID_VIRIAL_GROUPS
 PURPOSE:
       Find groups based on mean overdensity given group centers from
       another group finding method.
 CATEGORY:
       N-body
 CALLING SEQUENCE:
       id_virial_groups, Pos, Cen, Mass, GrpID
 INPUTS:
       Pos     -- A 3XNPart array of particle positions.     in
       Cen     -- A 3XNCenters array of group centers.       in
 KEYWORD PARAMETERS:
       PERIOD  -- Period of the box if the particles are     in
                  drawn from a periodic simulation.
                  Default is 0 (nonperiodic).
       BACKGROUND_DENSITY -- Critical background density     in
                  of the universe, in units of particles     in
                  per units volumes (distance units are set      
                  by Pos).  Default is number of particles 
                  in Pos.
 OUTPUTS:
       
 COMMON BLOCKS:
       
 SIDE EFFECTS:
       
 NOTES:
       
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id: id_virial_groups.pro,v 1.1 1997/02/18 18:20:59 mcraig Exp $
       $Log: id_virial_groups.pro,v $
       Revision 1.1  1997/02/18 18:20:59  mcraig
       Initial revision

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/id_virial_groups.pro)


LOADPOS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       LOADPOS
 PURPOSE:
       Load positions from a Schlegel-Fisher format N-body file into
       an array.
 CATEGORY:
       N-body
 CALLING SEQUENCE:
       array = loadpos( filename )
 INPUTS:
       filename  -- Name of file containing positions            in
                    in Schlegel-Fisher format.
 KEYWORD PARAMETERS:
       BOXSIZE   -- Scaling for distances read in.  Distances    in
                    are _divided_ by BOXSIZE. Default is 1.
       NPART     -- Set to a named variable to receive the       out
                    number of particles in the file.
       /HELP     -- Print useful message and exit. 
 OUTPUTS:
       array     -- A 3xNPart float array of positions.          out
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
 MODIFICATION HISTORY:
       $Id: loadpos.pro,v 1.2 1996/04/22 16:25:04 mcraig Exp $
       $Log: loadpos.pro,v $
       Revision 1.2  1996/04/22 16:25:04  mcraig
       Changed construction of Pos array to increase speed and decrease
       memory usage.  Also fixed bug in NPART keyword which led to number
       of particles not being returned unless NPART was set to a defined variable.

       Revision 1.1  1996/04/10 18:13:53  mcraig
       Initial revision

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/loadpos.pro)


PLOT_SLICE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       PLOT_SLICE
 PURPOSE:
       Plot a slice from an N-body computational box.
 CATEGORY:
       
 CALLING SEQUENCE:
       plot_slice, pos
 INPUTS:
       pos -- Input positions, fltarr(3,nparticles)              in
 KEYWORD PARAMETERS:
       CEN_SLICE   -- (x,y,z) position of center of slice.       in
                    Default is (.5, .5, .5)
       WIDTH_SLICE -- (dx, dy, dz) width of slice.               in
                      Default is (1, 1, 1).
       VIEW_AXIS   -- Axis along which to view the slice.        in
                      Should be 'x', 'y', or 'z'. 
                      Default is 'z'.
       FRACTION    -- Fraction of particles to plot.             in
                      Default is 1.
       UNITS       -- A string containing the name of the        in
                      units in which position will be plotted.
                      Used only for labelling axes. 
                      Default is ''.
       TITLE       -- Title for the plot.                        in
                      Default is ''.
 OUTPUTS:
 COMMON BLOCKS:
 SIDE EFFECTS:
       Makes a plot on the current graphics device.
 NOTES:
       VIEW_AXIS should really be arbitrary, not restricted to x, y,
       or z.
 EXAMPLE:
       cen = [.3, .4, .1] & width = [.1, .1, 1]
       plot_slice, pos, CEN_SLICE = cen, WIDTH_SLICE = width
       Plots 10% of the box in the X and Y directions, and all of it
       along the Z direction.
 LIBRARY FUNCTIONS CALLED:
 MODIFICATION HISTORY:
       $Id: plot_slice.pro,v 1.1 1996/03/10 17:38:20 mcraig Exp $
       $Log: plot_slice.pro,v $
       Revision 1.1  1996/03/10 17:38:20  mcraig
       Initial revision

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/plot_slice.pro)


PROFILE_HALO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       PROFILE_HALO
 PURPOSE:
       Calculate radial profile (mass, density or rotation curve) for
       a set of particles.
 CATEGORY:
       N-Body.
 CALLING SEQUENCE:
       PROFILE_HALO, Pos, Center, Rad, Profile
 INPUTS:
       Pos -- A two dimensional array fltarr(3,*)                 in
              containing the particle positions.  
       Cen -- A vector [Cx, Cy, Cz] containing the                in
              x,y,z coordinates of the halo center.
 KEYWORD PARAMETERS:
       /DENSITY  -- Construct density profile.  Units are number
                    of particles per units volume (input Pos units
                    cubed).
       /MASS     -- Construct mass profile.  Units are number of
                    particles.
       /ROTATION -- Construct rotation curve (default). Units
                    are G=1, with mass in particle number and
                    distance in same units as Pos.
       BIN_SIZE  -- Number of particles in each bin.              in
                    Default is 50.  Ignored if USE_RAD is set.
       USE_RAD   -- Rather than requiring a certain number of     in
                    particles per bin, set this to the radii at
                    which the profile should be calculated.
                    Overrides BIN_SIZE.
       N_RAD_BINS - Rather than setting number of particles in    in
                    bin or the radii at which to create the
                    profile, set the number of bins desired.
                    Bins will be of equal size from the
                    smallest to the largest radius in the input.
       PERIOD    -- Set to length of box if particles are drawn   in
                    from a periodic box.
       BIN_INDEX -- Set to a named variable to receive an array   out
                    indicating which particles contributed to
                    each bin.  The array is set up like the 
                    reverse histogram array in HISTOGRAM, so that
                    BinIndex(BinIndex(i):BinIndex(i+1)-1) contains 
                    the indices of the particles in bin i.
       /HELP     -- Print useful message and exit.                 
 OUTPUTS:
       Rad       -- Set to a named variable to receive the        out
                    positions at which the halo profile
                    is tabulated.
       Profile   -- The desired profile.  See description under   out
                    keyword parameters for each profile type
                    for units.
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       The profiles are are tabulated either:
      
        i) at radii such that each radial bin contains the same number
           of particles, if USE_RAD is NOT set, or
       ii) at the radii specified by the keyword USE_RAD.

       Distances are returned in the same units as were input in
       Pos.  Velocities are in units with distances measured as
       in Pos, and G=1, and mass per particle = 1.  Masses are
       tabulated in terms of particle number.
 EXAMPLE:
       profile_halo,/DENSITY, pos, cen, rad, den, BIN=250
       Construct a density profile for the set of particles contained
       in pos (nonperiodic), with center cen.  There are 250
       particles per radial bin, with the bin radii in rad, and the
       density at those radii in den.
 LIBRARY FUNCTIONS CALLED:
 MODIFICATION HISTORY:
       $Id: profile_halo.pro,v 1.3 1997/03/27 22:27:57 mcraig Exp mcraig $
       $Log: profile_halo.pro,v $
       Revision 1.3  1997/03/27 22:27:57  mcraig
       Sped up calculation of profile when binning is by setting fixed number
       of particles per bin.  Now calls another routine to do the dirty work.

       Revision 1.2  1997/03/04 18:38:56  mcraig
       Added ability to bin either by number or to use user input bin boundaries.
       Also added optional output of bin indices, so that the user can find out
       which particles were in which bins.

       Revision 1.1  1996/06/28 22:41:39  mcraig
       Initial revision

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/profile_halo.pro)


RECENTER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       RECENTER
 PURPOSE:
       Move origin for a set of particle positions to a particular center.
 CATEGORY:
       N-body
 CALLING SEQUENCE:
       NewPos = recenter( pos, center )
 INPUTS:
       Pos     -- Positions to be recentered.                 in
                  Must be 3 X NPart array.
       Center  -- [x,y,z] position of new origin.             in
 KEYWORD PARAMETERS:
       PERIOD  -- Period of box if periodic.                  in
                  Default is zero (nonperiodic).
       /HELP   -- If set, print a useful message and exit.
 OUTPUTS:
       NewPos  -- Positions shifted to new origin.            out
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       If the positions are drawn from a periodic simulation, but the
       positions passed to this routine are ont near the edge of the
       box, it will be faster to treat the particles as nonperiodic.
 EXAMPLE:
       NewPos = recenter( pos, [.5,.5,.5], PERIOD=1.0 )
       Will move the origin of particles in a box with period 1.0 to
       the center of the box.
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id: recenter.pro,v 1.1 1997/03/06 22:59:38 mcraig Exp $
       $Log: recenter.pro,v $
       Revision 1.1  1997/03/06 22:59:38  mcraig
       Initial revision

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/recenter.pro)


SELECT_BOX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       SELECT_BOX
 PURPOSE:
       Select particles in a specified rectangular box.
 CATEGORY:
       N-body
 CALLING SEQUENCE:
       indices = select_box( pos )
 INPUTS:
       pos      -- Positions of particles.  Two            in
                    dimensional array 3xNPart
 KEYWORD PARAMETERS:
       CENTER   -- Center of the region to be extracted,   in
                   as a vector with three elements.
                   Default is [.5, .5, .5].
       WIDTH    -- Specify the width of that box in all    in
                   three directions.
                   Default is [1., 1., 1.].
       PERIOD   -- Period of box.  Set to zero if box is   in
                   not periodic.  Default is 0.
       /HELP    -- Print a useful help message and exit.
 OUTPUTS:
       indices  -- The index array of those particles      out
                   within the selected region.
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       -- The PERIOD keyword will slow down execution.  Only use it when
          the particles are periodic AND the box you want to extract
          wraps around the box.
       -- Execution time falls by 1/3 when pos, center, and width are
          all integers.
 EXAMPLE:
       index = select_box( pos, cen=[.2,.2,.2], width=[.1,.1,.1] )
       plot, pos(0,index), pos(1,index), psym=3
       will plot all those particles within a box of size .1
       of the point .2,.2,.2, in z-projection.
 LIBRARY FUNCTIONS CALLED:
 MODIFICATION HISTORY:
       $Id: select_box.pro,v 1.1 1996/04/15 19:33:57 mcraig Exp $
       $Log: select_box.pro,v $
       Revision 1.1  1996/04/15 19:33:57  mcraig
       Initial revision

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/select_box.pro)


SELECT_NP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       SELECT_NP
 PURPOSE:
       Select specified number of particles closest to specified
       center. 
 CATEGORY:
       N-body
 CALLING SEQUENCE:
       indices = select_np( pos )
 INPUTS:
       pos      -- Positions of particles.  Two            in
                    dimensional array 3xNPart
 KEYWORD PARAMETERS:
       CENTER   -- Center of the sphere to be extracted,   in
                   as a vector with three elements.
                   Default is center of mass.
       NPSELECT -- Number of particles to select.          in
                   Default is 100.
       PERIOD   -- Period of box.  Set to zero if box is   in
                   not periodic.  Default is 0.
       GUESS_RADIUS -- Best guess as to the radius of the  in
                       sphere about center which will 
                       contain NPSELECT particles.  
                       Default is half the maximum 
                       separation in any coordinate of 
                       any particle from center.
       RADIUS   -- Distance of most distant particle from  out
                   center.
       /HELP    -- Print a useful help message and exit.
 OUTPUTS:
       indices  -- The index array of those particles      out
                   within the selected region.
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       If the box is periodic, but the sphere conataining 
       NPSELCT does NOT wrap around 
       the box, it will be faster to NOT use the PERIOD keyword.
 EXAMPLE:
       index = select_np( pos, cen=[.2,.2,.2], radius=.1)
       plot, pos(0,index), pos(1,index), psym=3
       will plot all those particles within a distance of size .1
       of the point .2,.2,.2, in z-projection.
 LIBRARY FUNCTIONS CALLED:
       select_sphere  -- N-body (mcraig)
 MODIFICATION HISTORY:
       $Id: select_np.pro,v 1.1 1997/03/06 23:01:13 mcraig Exp $
       $Log: select_np.pro,v $
       Revision 1.1  1997/03/06 23:01:13  mcraig
       Initial revision

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/select_np.pro)


SELECT_REGION

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       SELECT_REGION
 PURPOSE:
       Select particles in a specified region.
 CATEGORY:
       N-body
 CALLING SEQUENCE:
       indices = select_region( pos )
 INPUTS:
       pos      -- Positions of particles.  Two            in
                    dimensional array 3xNPart
 KEYWORD PARAMETERS:
       CENTER   -- Center of the region to be extracted,   in
                   as a vector with three elements.
                   Default is [.5, .5, .5].
       WIDTH    -- If selecting using rectangular box,     in
                   specify the width of that box in all
                   three directions.
                   Default is [1., 1., 1.].
       RADIUS   -- If selecting a spherical region,        in
                   the radius of the sphere. Default is 
                   to use rectangular region.
       PERIOD   -- Period of box.  Set to zero if box is   in
                   not periodic.  Default is 0.
       /HELP    -- Print a useful help message and exit.
 OUTPUTS:
       indices  -- The index array of those particles      out
                   within the selected region.
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       The WIDTH and RADIUS keywords are mutually exclusive.
 EXAMPLE:
       index = select_region( pos, cen=[.2,.2,.2], radius=.1 )
       plot, pos(0,index), pos(1,index), psym=3
       will plot all those particles within a distance of .1
       of the point .2,.2,.2, in z-projection.
 LIBRARY FUNCTIONS CALLED:
       select_box
       select_sphere
 MODIFICATION HISTORY:
       $Id: select_region.pro,v 1.1 1997/03/06 23:01:44 mcraig Exp $
       $Log: select_region.pro,v $
       Revision 1.1  1997/03/06 23:01:44  mcraig
       Initial revision

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/select_region.pro)


SELECT_SPHERE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       SELECT_SPHERE
 PURPOSE:
       Select particles in a specified sphere.
 CATEGORY:
       N-body
 CALLING SEQUENCE:
       indices = select_sphere( pos )
 INPUTS:
       pos      -- Positions of particles.  Two            in
                    dimensional array 3xNPart
 KEYWORD PARAMETERS:
       CENTER   -- Center of the sphere to be extracted,   in
                   as a vector with three elements.
                   Default is [.5, .5, .5].
       RADIUS   -- Radius of the sphere to be extracted.   in
                   Default is .5.
       PERIOD   -- Period of box.  Set to zero if box is   in
                   not periodic.  Default is 0.
       /HELP    -- Print a useful help message and exit.
 OUTPUTS:
       indices  -- The index array of those particles      out
                   within the selected region.
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       -- If the box is periodic, but the sphere does NOT wrap around
          the box, it will be faster to NOT use the PERIOD keyword.
       -- If the positions, center, and radius are integers,
          selection of the sphere will take 2/3 the time it does for
          reals.
 EXAMPLE:
       index = select_sphere( pos, cen=[.2,.2,.2], radius=.1 )
       plot, pos(0,index), pos(1,index), psym=3
       will plot all those particles within a distance of .1
       of the point .2,.2,.2, in z-projection.
 LIBRARY FUNCTIONS CALLED:
       select_box
 MODIFICATION HISTORY:
       $Id: select_sphere.pro,v 1.2 1997/03/06 23:03:11 mcraig Exp $
       $Log: select_sphere.pro,v $
       Revision 1.2  1997/03/06 23:03:11  mcraig
       Corrected erroneous use of keyword_set.  Added informational message abot
       the radius, period and center.

       Revision 1.1  1996/04/15 21:25:06  mcraig
       Initial revision

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/select_sphere.pro)


VEL_DISP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       VEL_DISP
 PURPOSE:
       Calculate three dimensional velocity dispersion for a set of
       particles. 
 CATEGORY:
       N-body
 CALLING SEQUENCE:
       dispersion = vel_disp( velocities )
 INPUTS:
       velocities  -- array of velocities (nDim, nPart) to be       in
                      analyzed.
 KEYWORD PARAMETERS:
       /ZERO_MEAN  -- Set mean velocity to zero before calculating
                      dispersion.
       /HELP       -- Print a useful help message.
 OUTPUTS:
       dispersion  -- A vector with nDim elements containing the    out
                      dispersion in each direction.
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id: vel_disp.pro,v 1.1 1997/03/07 01:37:27 mcraig Exp $
       $Log: vel_disp.pro,v $
       Revision 1.1  1997/03/07 01:37:27  mcraig
       Initial revision

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/vel_disp.pro)


VEL_STATS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       VEL_STATS
 PURPOSE:
       Calculate velocity information in radial bins.
 CATEGORY:
       N-body/gen
 CALLING SEQUENCE:
       vel_stats, Pos, Vel, Radii
 INPUTS:
       Pos   -- A 3 X NPart array of positions.
       Vel   -- A 3 X NPart array of velocities.
 KEYWORD PARAMETERS:
       CENTER   -- Set to a 3 element vector to use as     in
                   the center of the distribution.
                   Default is the center of mass.
       HUBBLE   -- Set to Hubble constant if the hubble    in
                   flow should be added to velocities.
                   Default is 0 (no hubble flowed added).
       NUM_PER_BIN - Set to number of particle per bin.    in
                   Default is 50.
       PERIOD   -- If the box is periodic, set to the      in
                   period.  Default is 0 (no period).
       AVG_RAD  -- Set to named variable to receive the   out
                   average radius of the particles in 
                   each bin.
       VDOTR    -- Set to a named variable to receive     out  
                   the binned avergare of V dot R.
       VROT     -- Set to a named variable to receive     out  
                   the binned circular velocity.
       VSIGMA   -- Set to a named variable to receive     out
                   the binned average of the velocity 
                   dispersion.
       /NO_MEAN -- Normally the mean velocity of all the
                   particles is subtracted off to remove
                   center of mass motion.  Set this keyword
                   to prevent that subtraction.
 OUTPUTS:
       Radii -- Set to variable to receive the bin boundaries.
       Most output is through keywords.
 COMMON BLOCKS:
       
 SIDE EFFECTS:
       
 NOTES:
       
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id: vel_stats.pro,v 1.1 1997/03/07 01:38:00 mcraig Exp mcraig $
       $Log: vel_stats.pro,v $
       Revision 1.1  1997/03/07 01:38:00  mcraig
       Initial revision

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/vel_stats.pro)


VIRIAL_RADIUS

[Previous Routine] [List of Routines]
 NAME:
       VIRIAL_RADIUS
 PURPOSE:
       Calculate virial radius for a set of particles.
 CATEGORY:
       N-body
 CALLING SEQUENCE:
       Rvir = virial_radius( pos )
 INPUTS:
       pos     -- A 3xNPart array of particle positions.      in
 KEYWORD PARAMETERS:
       CENTER  -- Center to be used for calculating virial   [in]
                  radius. Default is center of mass of
                  particles.
       OVERDEN -- Mean overdensity at the virial radius.     [in]
                  Default is 200.
       BACKGROUND_DENSITY -- Background density in units     [in]
                  of number of particles per unit volume.
                  Default is 262144.
       PERIOD  -- Period of the box if the simulation was     in
                  periodic.  Default is 0 (no period).
       GUESS  -- An initial guess for the virial radius.     [in]
                  Default is .04.  This is a dumb default.
       INDICES -- Set to named variable to recieve vector of [out]
                  indices of those particles in Pos within 
                  virial radius.
 OUTPUTS:
       Rvir    -- Virial radius, in same units as particle    out
                  positions.
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       The method here is to calculate the overdensity within a
       sphere of radius GUESS, and declare the virial radius to be
       the radius at which the mean overdensity falls to OVERDEN.
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       center_mass   -- N-body (mcraig)
       profile_halo  -- N-body (mcraig)
       select_sphere -- N-body (mcraig)
 MODIFICATION HISTORY:
       $Id: virial_radius.pro,v 1.3 1997/03/07 01:38:42 mcraig Exp $
       $Log: virial_radius.pro,v $
       Revision 1.3  1997/03/07 01:38:42  mcraig
       Removed print statements used for debugging.

       Revision 1.2  1997/02/18 18:10:29  mcraig
       Now uses faster method for binning particles for findign virial radius.

       Revision 1.1  1997/02/18 18:09:00  mcraig
       Initial revision

 RELEASE:
       $Name:  $

(See /deep0/marc/idlshare/Nbody/general/virial_radius.pro)