This code computes the average halo sparsity for massive halos (>10^{13} M_{Sun} h^{-1}) at a given redshift for a given cosmological model by solving Eq. (4) in Corasaniti et al. (2018) for two different overdensity cases (<s_{200,500}> and <s_{500,1000}>) assuming mass function parametrizations from Despali et al. (2016) or calibrated against the RayGal simulation halo catalogs. In the case of the Despali et al. mass functions the average sparsity includes the matched halo correction calibrated on the RayGal simulations. The input linear matter power spectrum for a given set of cosmological parameters is given by the Eisenstein & Hu (1998) formulae of the linear transfer function, while the linearly extrapolated spherical collapse threshold is given by the formula from Kitayama & Suto (1996). For more details see Corasaniti et al. (2018) and Corasaniti, Sereno & Ettori (in preparation).

The code can be downloaded from the GitHub repository:

https://github.com/pierste75/Halo_Sparsity

**How to run the code**

Modify the Makefile for your compiler and optimization flags (default is gfortran -O3) and compile with the command

make

run the code with the command

./sparsity

Enter the values of: Omega_{m}, Omega_{b} h^{2}, h, sigma_{8}, n_{s}, w_{0}, w_{a} and z_{out} the redshift output of the halo sparsity (values should be separated by a coma or entered one by one touching the return key after each entry).

Namelist files for LCDM-WMAP7 and Planck cosmological parameters can be found in the NAMELIST folder, in such a case run as:

./sparsity < NAMELIST/par_XXX.nml

The code output on the screen the value of the sparsity.

The code can be easily modified to compute the sparsity over a discretized redshift interval z_{min} < z < z_{max}, and it can be hacked with a bit of work to include other mass function parametrizations (see corresponding functions in module MF in mf_commons.f90) and also extended to include sparsity definitions for other overdensity thresolds.

**Acknowledgements**

If you use the code please cite:

- Balmes et al., Mont. Not. Roy. Astron. Soc. 437, 2328 (2014), arXiv:1307.2922
- Corasaniti et al., Astrophys. J. 862, 40 (2018), arXiv:171100480