<spanid="the-ic-module"></span><h1>the ic module<aclass="headerlink"href="#module-pNbody.ic"title="Permalink to this headline">¶</a></h1>
<dlclass="function">
<dtid="pNbody.ic.ComputeGridParameters">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">ComputeGridParameters</tt><big>(</big><em>n</em>, <em>args</em>, <em>rmax</em>, <em>M</em>, <em>pr_fct</em>, <em>mr_fct</em>, <em>Neps_des</em>, <em>rc</em>, <em>ng</em><big>)</big><aclass="headerlink"href="#pNbody.ic.ComputeGridParameters"title="Permalink to this definition">¶</a></dt>
<dd><p>This function computes dR, the appropriate grid used to approximate Mr.</p>
<p>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.</p>
<olclass="arabic">
<li><pclass="first">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</p>
</li>
<li><pclass="first">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.</p>
<p>if the computation of rc fails, we use the default value of rc</p>
</li>
</ol>
<p>The function takes the following arguments</p>
<p>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</p>
<p>Neps_des : desired number of point in the first beam
rc : default size of the first beam
ng : number of grid divisions</p>
<p>it returns :</p>
<p>Rs : grid points
eps : radius containing about Neps_des particles
Neps : number of particles in eps</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.ComputeGridParameters2">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">ComputeGridParameters2</tt><big>(</big><em>eps</em>, <em>nmax</em>, <em>args</em>, <em>rmax</em>, <em>M</em>, <em>pr_fct</em>, <em>mr_fct</em>, <em>Neps_des</em>, <em>rc</em>, <em>ng</em><big>)</big><aclass="headerlink"href="#pNbody.ic.ComputeGridParameters2"title="Permalink to this definition">¶</a></dt>
<dd><p>This function computes dR, the appropriate grid used to approximate Mr.</p>
<p>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 exponnential distribution up to rmax.</p>
<olclass="arabic">
<li><pclass="first">n is set from the total mass and Neps_des</p>
</li>
<li><pclass="first">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.</p>
<p>if the computation of rc fails, we use the default value of rc</p>
</li>
</ol>
<p>The function takes the following arguments</p>
<p>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</p>
<p>Neps_des : desired number of point in the first beam
rc : default size of the first beam
ng : number of grid divisions</p>
<p>it returns :</p>
<p>n : number of particles
Rs : grid points
rc : parameter of the scaling fct
g : scaling fct
gm : inverse of scaling fct</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.box">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">box</tt><big>(</big><em>n</em>, <em>a</em>, <em>b</em>, <em>c</em>, <em>name='box.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.box"title="Permalink to this definition">¶</a></dt>
<dd><p>Return an Nbody object that contains n particules distributed
in an homogeneous box of dimension a,b,c, centred at the origin
radius rmax.</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.burkert">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">burkert</tt><big>(</big><em>n</em>, <em>rs</em>, <em>Rmax</em>, <em>dR</em>, <em>Rs=None</em>, <em>name='burkert.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.burkert"title="Permalink to this definition">¶</a></dt>
<dd><p>Return an Nbody object that contains n particules following
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">dl2</tt><big>(</big><em>n</em>, <em>a</em>, <em>b</em>, <em>c</em>, <em>eps</em>, <em>rmax</em>, <em>name='dl2.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.dl2"title="Permalink to this definition">¶</a></dt>
<dd><p>Return an Nbody object that contains n particules distributed as</p>
<p>rho = (1.-eps*(r/rmax)**2)</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.dl2_mr">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">dl2_mr</tt><big>(</big><em>r</em>, <em>args</em><big>)</big><aclass="headerlink"href="#pNbody.ic.dl2_mr"title="Permalink to this definition">¶</a></dt>
<dd><p>Mass in the radius r for the distribution</p>
<p>rho = (1.-eps*(r/rmax)**2)</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.expd">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">expd</tt><big>(</big><em>n</em>, <em>Hr</em>, <em>Hz</em>, <em>Rmax</em>, <em>Zmax</em>, <em>irand=1</em>, <em>name='expd.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.expd"title="Permalink to this definition">¶</a></dt>
<dd><p>Exonential disk</p>
<p>rho = 1/(1+(r/rc)**2)</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.expd_mr">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">expd_mr</tt><big>(</big><em>r</em>, <em>args</em><big>)</big><aclass="headerlink"href="#pNbody.ic.expd_mr"title="Permalink to this definition">¶</a></dt>
<dd><p>Mass in the radius r for the distribution</p>
<p>Sigma = epx(-r)</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.generic2c">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">generic2c</tt><big>(</big><em>n</em>, <em>rs</em>, <em>a</em>, <em>b</em>, <em>Rmax</em>, <em>dR</em>, <em>Rs=None</em>, <em>name='nfwg.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.generic2c"title="Permalink to this definition">¶</a></dt>
<dd><p>Return an Nbody object that contains n particules following
an nfw modifed profile.</p>
<p>rho = 1/( (r/rs)**a * (1+r/rs)**(b-a) )</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.generic_Mr">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">generic_Mr</tt><big>(</big><em>n</em>, <em>rmax</em>, <em>R=None</em>, <em>Mr=None</em>, <em>name='sphere_Mr.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.generic_Mr"title="Permalink to this definition">¶</a></dt>
<dd><p>Distribute particles in order to reproduce M(R) given by Mr</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.generic_Mx">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">generic_Mx</tt><big>(</big><em>n</em>, <em>xmax</em>, <em>x=None</em>, <em>Mx=None</em>, <em>name='box_Mx.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.generic_Mx"title="Permalink to this definition">¶</a></dt>
<dd><p>Distribute particles in a box. The density in x is defined in order to reproduce M(x) given by Mx</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.generic_alpha">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">generic_alpha</tt><big>(</big><em>n</em>, <em>a</em>, <em>e</em>, <em>rmax</em>, <em>irand=1</em>, <em>fct=None</em>, <em>name='generic_alpha.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.generic_alpha"title="Permalink to this definition">¶</a></dt>
<dd><p>Generic alpha distribution : rho ~ (r+e)^a</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.hernquist">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">hernquist</tt><big>(</big><em>n</em>, <em>rs</em>, <em>Rmax</em>, <em>dR</em>, <em>Rs=None</em>, <em>name='hernquist.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.hernquist"title="Permalink to this definition">¶</a></dt>
<dd><p>Return an Nbody object that contains n particules following
a hernquist modifed profile.</p>
<p>rho = 1/( (r/rs) * (1+r/rs)**3 )</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.homodisk">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">homodisk</tt><big>(</big><em>n</em>, <em>a</em>, <em>b</em>, <em>dz</em>, <em>name='homodisk.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.homodisk"title="Permalink to this definition">¶</a></dt>
<dd><p>Return an Nbody object that contains n particules distributed
in an homogeneous oval of radius a and b, and of thickness dz.</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.homosphere">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">homosphere</tt><big>(</big><em>n</em>, <em>a</em>, <em>b</em>, <em>c</em>, <em>name='homosphere.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.homosphere"title="Permalink to this definition">¶</a></dt>
<dd><p>Return an Nbody object that contains n particules distributed
in an homogeneous triaxial sphere of axis a,b,c.</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.invert">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">invert</tt><big>(</big><em>x</em>, <em>rmin</em>, <em>rmax</em>, <em>fct</em>, <em>args</em>, <em>eps=1e-10</em><big>)</big><aclass="headerlink"href="#pNbody.ic.invert"title="Permalink to this definition">¶</a></dt>
<dd><p>return vector r that corresponds to
fct(r,args)=x
This routine uses a simple bissector algorithm</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.isothm">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">isothm</tt><big>(</big><em>n</em>, <em>rc</em>, <em>rmax</em>, <em>name='isothm.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.isothm"title="Permalink to this definition">¶</a></dt>
<dd><p>Return an Nbody object that contains n particules distributed as</p>
<p>rho = 1/(1+r/rc)**2</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.isothm_mr">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">isothm_mr</tt><big>(</big><em>r</em>, <em>args</em><big>)</big><aclass="headerlink"href="#pNbody.ic.isothm_mr"title="Permalink to this definition">¶</a></dt>
<dd><p>Mass in the radius r for the distribution</p>
<p>rho = 1/(1+r/rc)**2</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.kuzmin">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">kuzmin</tt><big>(</big><em>n</em>, <em>eps</em>, <em>dz</em>, <em>name='kuzmin.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.kuzmin"title="Permalink to this definition">¶</a></dt>
<dd><p>Return an Nbody object that contains n particules distributed
in a kuzmin (infinitely thin) disk</p>
<p>rho = eps*M/(2*pi*(R**2+eps**2)**(3/2))</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.miyamoto_nagai">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">miyamoto_nagai</tt><big>(</big><em>n</em>, <em>a</em>, <em>b</em>, <em>Rmax</em>, <em>Zmax</em>, <em>irand=1</em>, <em>fct=None</em>, <em>fRmax=0</em>, <em>name='miyamoto.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.miyamoto_nagai"title="Permalink to this definition">¶</a></dt>
<dd><p>Miyamoto Nagai distribution</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.nfw">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">nfw</tt><big>(</big><em>n</em>, <em>rs</em>, <em>Rmax</em>, <em>dR</em>, <em>Rs=None</em>, <em>name='nfw.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.nfw"title="Permalink to this definition">¶</a></dt>
<dd><p>Return an Nbody object that contains n particules following
an nfw profile.</p>
<p>rho = 1/[ (r/rs)(1+r/rs)^2 ]</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.nfw_mr">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">nfw_mr</tt><big>(</big><em>r</em>, <em>args</em><big>)</big><aclass="headerlink"href="#pNbody.ic.nfw_mr"title="Permalink to this definition">¶</a></dt>
<dd><p>Mass in the radius r for the nfw distribution</p>
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">pisothm</tt><big>(</big><em>n</em>, <em>rc</em>, <em>rmax</em>, <em>rmin=0</em>, <em>name='pisothm.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.pisothm"title="Permalink to this definition">¶</a></dt>
<dd><p>Pseudo-isothermal sphere
Mass in the radius r for the distribution</p>
<p>rho = 1/(1+(r/rc)**2)</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.pisothm_mr">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">pisothm_mr</tt><big>(</big><em>r</em>, <em>args</em><big>)</big><aclass="headerlink"href="#pNbody.ic.pisothm_mr"title="Permalink to this definition">¶</a></dt>
<dd><p>Mass in the radius r for the distribution</p>
<p>rho = 1/(1+(r/rc)**2)</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.plummer">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">plummer</tt><big>(</big><em>n</em>, <em>a</em>, <em>b</em>, <em>c</em>, <em>eps</em>, <em>rmax</em>, <em>M=1.0</em>, <em>vel='no'</em>, <em>name='plummer.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.plummer"title="Permalink to this definition">¶</a></dt>
<dd><p>Return an Nbody object that contains n particules distributed
in a triaxial plummer model of axis a,b,c and core radius eps
and max radius of rmax.</p>
<p>rho = (1.+(r/eps)**2)**(-5/2)</p>
</dd></dl>
<dlclass="function">
<dtid="pNbody.ic.shell">
<ttclass="descclassname">pNbody.ic.</tt><ttclass="descname">shell</tt><big>(</big><em>n</em>, <em>r</em>, <em>name='cell.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><aclass="headerlink"href="#pNbody.ic.shell"title="Permalink to this definition">¶</a></dt>