the ic module

pNbody.ic.ComputeGridParameters(n, args, rmax, M, pr_fct, mr_fct, Neps_des, rc, ng)

This function computes dR, the appropriate grid used to approximate Mr.

The grid is set in order to have “Neps_des” particles in the first division of the grid. Then, the radius of the grid follows an exponnential distribution up to rmax.

  1. from the density distribution, the total mass and the number of particles, using a newton algorithm, it computes eps, the radius that will contains “Neps_des” particles

  2. once eps is set, we determine rc (the grid scale length) from eps and ng, in order to have a grid with the a first cell equal to eps.

    if the computation of rc fails, we use the default value of rc

The function takes the following arguments

n : number of particles M : total mass rmax : max radius args : list of args for the profile pr_fct : profile function mr_fct : mass-radius function

Neps_des : desired number of point in the first beam rc : default size of the first beam ng : number of grid divisions

it returns :

Rs : grid points eps : radius containing about Neps_des particles Neps : number of particles in eps

pNbody.ic.ComputeGridParameters2(eps, nmax, args, rmax, M, pr_fct, mr_fct, Neps_des, rc, ng)

This function computes dR, the appropriate grid used to approximate Mr.

The number of particle of the model is set in order to have “Neps_des” particles in the first division of the grid. Then, the radius of the grid follows an exponential distribution up to rmax.

  1. n is set from the total mass and Neps_des

  2. once n is set, we determine rc (the grid scale length) from eps and ng, in order to have a grid with the a first cell equal to eps.

    if the computation of rc fails, we use the default value of rc

The function takes the following arguments

eps : the desired grid resolution nmax : max number of particles M : total mass rmax : max radius args : list of args for the profile pr_fct : profile function mr_fct : mass-radius function

Neps_des : desired number of point in the first beam rc : default size of the first beam ng : number of grid divisions

it returns :

n : number of particles Rs : grid points rc : parameter of the scaling fct g : scaling fct gm : inverse of scaling fct

pNbody.ic.box(n, a, b, c, irand=1, name='box.h5py', ftype='swift')

Return an Nbody object that contains n particles distributed in an homogeneous box of dimension a,b,c, centred at the origin radius rmax.

pNbody.ic.burkert(n, rs, Rmax, dR, Rs=None, irand=1, name='burkert.hdf5', ftype='swift', verbose=False)

Return an Nbody object that contains n particles following a burkert profile.

rhob = 1 / ( ( 1 + r/rs ) * ( 1 + (r/rs)**2 ) )

pNbody.ic.deprojsersic(n, re, nindex, Rmax, M, dR, Rs=None, irand=1, name='nfwg.hdf5', ftype='swift', verbose=False)

Return an Nbody object that contains n particles following a 3D deprojected sersic profile.

pNbody.ic.disklrrc(n, a, b, dz, irand=1, name='homodisk.hdf5', ftype='swift')

Return an Nbody object that contains n particles distributed in a disk having a linear rising rotation curve.

pNbody.ic.dl2(n, a, b, c, eps, rmax, irand=1, name='dl2.hdf5', ftype='swift')

Return an Nbody object that contains n particles distributed as

rho = (1.-eps*(r/rmax)**2)

pNbody.ic.dl2_mr(r, args)

Mass in the radius r for the distribution

rho = (1.-eps*(r/rmax)**2)

pNbody.ic.expd(n, Hr, Hz, Rmax, Zmax, irand=1, name='expd.hdf5', ftype='swift')

Exonential disk

rho = 1/(1+(r/rc)**2)

pNbody.ic.gen_2_slopes(n, rs, a, b, Rmax, dR, Rcut=None, power_cut=None, Rs=None, NR=10000.0, irand=1, name='gen_2_slopes.hdf5', ftype='swift', verbose=False)

Return an Nbody object that contains n particles following an generic 2 slope profile.

rho = 1/( (r/rs)**a * (1+r/rs)**(b-a) )

Note : this is a re-implementation of generic2c

pNbody.ic.generic2c(n, rs, a, b, Rmax, dR, Rs=None, irand=1, name='nfwg.hdf5', ftype='swift', verbose=False)

Return an Nbody object that contains n particles following an nfw modifed profile.

rho = 1/( (r/rs)**a * (1+r/rs)**(b-a) )

pNbody.ic.generic_Mr(n, rmax, R=None, Mr=None, irand=1, name='sphere_Mr.hdf5', ftype='swift', verbose=False)

Distribute particles in order to reproduce M(R) given by Mr

pNbody.ic.generic_Mx(n, xmax, x=None, Mx=None, irand=1, name='box_Mx.hdf5', ftype='swift', verbose=False)

Distribute particles in a box. The density in x is defined in order to reproduce M(x) given by Mx

pNbody.ic.generic_alpha(n, a, e, rmax, irand=1, fct=None, name='generic_alpha.hdf5', ftype='swift')

Generic alpha distribution : rho ~ (r+e)^a

pNbody.ic.get_local_n(n)

This function set the global number of particle each node must hand.

pNbody.ic.hernquist(n, rs, Rmax, dR, Rs=None, irand=1, name='hernquist.hdf5', ftype='swift', verbose=False)

Return an Nbody object that contains n particles following a hernquist modifed profile.

rho = 1/( (r/rs) * (1+r/rs)**3 )

pNbody.ic.homodisk(n, a, b, dz, irand=1, name='homodisk.hdf5', ftype='swift')

Return an Nbody object that contains n particles distributed in an homogeneous oval of radius a and b, and of thickness dz.

pNbody.ic.homosphere(n, a, b, c, irand=1, name='homosphere.hdf5', ftype='swift')

Return an Nbody object that contains n particles distributed in an homogeneous triaxial sphere of axis a,b,c.

pNbody.ic.invert(x, rmin, rmax, fct, args, eps=1e-10)

return vector r that corresponds to fct(r,args)=x This routine uses a simple bissector algorithm

pNbody.ic.isothm(n, rc, rmax, irand=1, name='isothm.hdf5', ftype='swift')

Return an Nbody object that contains n particles distributed as

rho = 1/(1+r/rc)**2

pNbody.ic.isothm_mr(r, args)

Mass in the radius r for the distribution

rho = 1/(1+r/rc)**2

pNbody.ic.kuzmin(n, eps, dz, irand=1, name='kuzmin.hdf5', ftype='swift')

Return an Nbody object that contains n particles distributed in a Kuzmin (infinitely thin) disk

rho = eps*M/(2*pi*(R**2+eps**2)**(3/2))

pNbody.ic.mestel(n, rmax=1, dz=0, V0=1, G=1, irand=1, name='mestel.dat', ftype='gadget')

Return an Nbody object that contains n particles distributed such as they reproduce a Mestel disk (1/R surface density).

V0 : rotation curve at infinity

pNbody.ic.miyamoto_nagai(n, a, b, Rmax, Zmax, irand=1, fct=None, fRmax=0, name='miyamoto.hdf5', ftype='swift')

Miyamoto Nagai distribution

pNbody.ic.nfw(n, rs, Rmax, dR, Rs=None, irand=1, name='nfw.hdf5', ftype='swift', verbose=False)

Return an Nbody object that contains n particles following an nfw profile.

rho = 1/[ (r/rs)(1+r/rs)^2 ]

pNbody.ic.nfwg(n, rs, gamma, Rmax, dR, Rs=None, irand=1, name='nfwg.hdf5', ftype='swift', verbose=False)

Return an Nbody object that contains n particles following an nfw modifed profile.

rho = 1/[ ((r/rs))**(gamma)(1+r/rs)^2 ]**(0.5*(3-gamma))

pNbody.ic.pisothm(n, rc, rmax, rmin=0, irand=1, name='pisothm.hdf5', ftype='swift')

Pseudo-isothermal sphere Mass in the radius r for the distribution

rho = 1/(1+(r/rc)**2)

pNbody.ic.pisothm_mr(r, args)

Mass in the radius r for the distribution

rho = 1/(1+(r/rc)**2)

pNbody.ic.plummer(n, a, b, c, eps, rmax, M=1.0, irand=1, vel='no', name='plummer.hdf5', ftype='swift')

Return an Nbody object that contains n particles distributed in a triaxial plummer model of axis a,b,c and core radius eps and max radius of rmax.

rho = (1.+(r/eps)**2)**(-5/2)

pNbody.ic.pseudomestel(n, rmax=1, dz=0, V0=1, a=0.1, G=1, irand=1, name='pseudomestel.dat', ftype='gadget')

Return an Nbody object that contains n particles distributed such as they reproduce a Mestel disk (1/sqrt(a^2 + R^2) surface density).

V0 : rotation curve at infinity

pNbody.ic.ring(n, r, M=1.0, irand=1, name='ring.hdf5', ftype='swift')

Ring of radius r

pNbody.ic.shell(n, r, irand=1, name='shell.hdf5', ftype='swift')

Shell of radius r