Note: GADGET-4 has been relased in Oct 2020, see this page.


GADGET is a freely available code for cosmological N-body/SPH simulations on massively parallel computers with distributed memory. GADGET uses an explicit communication model that is implemented with the standardized MPI communication interface. The code can be run on essentially all supercomputer systems presently in use, including clusters of workstations or individual PCs.

GADGET computes gravitational forces with a hierarchical tree algorithm (optionally in combination with a particle-mesh scheme for long-range gravitational forces) and represents fluids by means of smoothed particle hydrodynamics (SPH). The code can be used for studies of isolated systems, or for simulations that include the cosmological expansion of space, both with or without periodic boundary conditions. In all these types of simulations, GADGET follows the evolution of a self-gravitating collisionless N-body system, and allows gas dynamics to be optionally included. Both the force computation and the time stepping of GADGET are fully adaptive, with a dynamic range which is, in principle, unlimited. 

GADGET can therefore be used to address a wide array of astrophysically interesting problems, ranging from colliding and merging galaxies, to the formation of large-scale structure in the Universe. With the inclusion of additional physical processes such as radiative cooling and heating, GADGET can also be used to study the dynamics of the gaseous intergalactic medium, or to address star formation and its regulation by feedback processes.


Hierarchical multipole expansion (based on a geometrical oct-tree) for gravitational forces.
Optional TreePM method, where the tree is used for short-range gravitational forces only while long-range forces are computed with a FFT-based particle-mesh (PM) scheme. A second PM layer can be placed on a high-resolution region in 'zoom'-simulations.
Periodic boundary conditions, either by means of the Ewald summation technique or based on the FFT algorithm used in the TreePM scheme. Simulations that only follow gas dynamics without self-gravity can be run in periodic boxes with arbitrary aspect ratios, and also in 2D, if desired.
Smoothed particle hydrodynamics with fully adaptive smoothing lengths and a novel entropy conserving formulation of SPH.
Signal-velocity parameterisation of the artificial viscosity, as suggested by Monaghan.
Individual timesteps for all particles. In the TreePM scheme, long-range and short-range forces are integrated with different timesteps.
Work-load balanced domain decomposition and dynamic tree updates.
Efficient cell-opening criteria for the gravitational tree-walk.
Support for parallel I/O and a number of different output formats, including the HDF5 format.
Flexible control of all code options by a free-format parameterfile.
Portable, well documented and easily extendible code, relying only on standard ANSI C language features and MPI-1.0 communication calls.
High raw computational speed and comparatively low memory consumption. In particular, significant improvements in resource consumption compared with GADGET-1 have been achieved.
The code may be run on an arbitrary number of processors, with a restriction to powers of two. It may also be run on a single CPU in serial mode.
Fast method for the generation of a gravitational `glass'.
SPH simulations can be run in periodic boxes of arbitrary aspect ratio, or in 2D, if desired.

There have also been older versions of the code that supported the special-purpose hardware GRAPE, in the form of GRAPE-3 and GRAPE-6. However, this functionality is not included in the current version at the moment.

Authors and History

GADGET has been written by Volker Springel over the last couple of years. The first public version (GADGET-1, released in March 2000), was created as part of Springel's PhD project at the Max-Planck-Institute for Astrophysics, Garching, Germany, under the supervision of Simon White. Later, the code was continuously impoved during postdocs of Volker Springel at the CfA and the MPA, in collaboration with Simon White and Lars Hernquist. The second public version (GADGET-2, released in May 2005), contains most of these improvements, except the numerous physics modules developed for the code that go beyond gravity and ordinary gas-dynamics.

The first versions of the code in 1998 were originally designed for serial machines only, targeting primarily problems of galaxy collisions and interactions, which explains GADGET's somewhat contrived acronym.
The parallel tree code was also developed during the year 1998, with the first parallel version of SPH added during the end of 1999. For the latter part, Naoki Yoshida (at the time another PhD-student at MPA) joined Volker Springel's efforts, and helped developing and testing the parallel SPH algorithms.

In 2001-2003, GADGET-2 was created. The new code forms a nearly complete rewrite of GADGET-1, including a replacement of all core algorithms with new methods. The most important changes lie in a new time integration model, a new tree-code module, a new communication scheme for gravitational and SPH forces, a new domain decomposition strategy, a novel SPH formulation based on entropy as indepedent variable, and finally, in the addition of the TreePM functionality.

Current work on
GADGET-3 is done by a number of people besides Volker Springel. A public release of this code has not happened yet, but is foreseen for the not too distant future.


The author acknowledges many helpful discussions he had with Simon White, Lars Hernquist, Naoki Yoshida, Klaus Dolag, Liang Gao, Martin Jubelgas, Debora Sijacki, Christoph Pfrommer, Stefano Borgani, Martin White, Adrian Jenkins, Jasjeet Bagla, Matthias Steinmetz, and Julio Navarro. Note that this list is incomplete - my due apologies to everyone I forgot to mention here. Lots of thanks also to many users of GADGET for their patience with the daily moods of the code, and their continued encouragement to work towards a public release of GADGET-2


1 May  2005: Version 2.0 of GADGET  released. 
1 June  2001: GADGET updated to version 1.1
16 March  2000: The initial distribution contained a wrong version of the file `forcetree.c' of the serial version of GADGET. Please download the serial code again!
15 March  2000: Version 1.0 of GADGET released.
1  January 2000: GADGET's Y2K compliance established.

Download GADGET

You may download the GADGET-2 code as a compressed tar-file:

gadget-2.0.7.tar.gz   (~21.5 MB)

Please use the commands  `gunzip gadget-2.0.7.tar.gz' and  `tar -xvf gadget-2.0.7.tar' to unpack the files. You will obtain a directory `Gadget-2.0.7/' , and various subdirectories containing the actual source code, the code documentation, as well as a number of simulation examples and very basic analysis scripts. Please refer to the README file, and GADGET's User's Guide for further directions about installation and usage. A brief guide to parameters in the Makefile and the parameterfile, as well as a cross-referenced source code documentation is accessible with a web-browser in the `html/'-subdirectory (open the  `index.html' file). Note that the large size of the download is caused by the included example initial conditions.

IC-Code for cosmological structure formation

You may download the N-GenIC code as a compressed tar-file:

n-genic.tar.gz   (~0.03 MB)

This code is suitable for creating cosmological initial conditions based on the Zeldovich approximation, in a format directly compatible with GADGET. This IC generator has been written several years back (~2003) by Volker Springel. The code is MPI-parallel and suitable for creating very large initial conditions, if desired. Please consult to the enclosed README file for instructions on how to use it.

Note: An extension of this code that uses second-order Lagrangian Perturbation Theory (2LPT) instead of the Zeldovich approximation has been developed by Sebastian Pueblas, Roman Scoccimarro and collaborators. It can be obtained from this site.


GADGET is written in standard ANSI C, and uses the standardized MPI-1.0 communication interface in its parallel version. The provided makefile is compatible with GNU make. The code should thus compile and run on most, if not all, massively parallel computers that support MPI.

The new version GADGET-2, also needs the GNU Scientific Library GSL, and the FFTW library (Fastest Fourier Transform in the West) for the PM functionality. If usage the Hierarchical Data Format (HDF) is desired, the corresponding HDF5 library needs to be compiled as well (in version <= 1.6.9, or for new version, you need to pass -DH5_USE_16_API=1 to the compiler). These three libraries are available as fully portable open-source software. 


GADGET is free software, distributed under the GNU General Public License. This implies that you may freely distribute and copy the software. You may also modify it as you wish, and distribute these modified versions as long as you indicate prominently any changes you made in the original code, and as long as you leave the copyright notices, and the no-warranty notice intact. Please read the General Public License for more details. Note that the authors retain their copyright on the code.

If you use
GADGET-2 for scientific work, we kindly ask you to reference the code paper(s) on GADGET, i.e.

Springel V., 2005, MNRAS, 364, 1105
Springel V., Yoshida N., White S. D. M., 2001, New Astronomy, 6, 51

Mailing List

There is a mailing list for GADGET-related discussions, which you may join if you like. The emails exchanged via this list are also archived on the web. In case you encounter trouble with the code, please check this forum first for a possible answer to your question or problem, before contacting the author.

To join the mailing-list, please send an email to with the subject "subscribe gadget-list". You can unsubscribe in the same fashion using
"unsubscribe gadget-list" for the subject line . Once you have subscribed, you can also post to the mailing list.

If you would like to be informed about future releases of the code, or about bug fixes, please send an e-mail to with the subject line "subscribe gadget-announce". Only the author of GADGET can post to this list, so the traffic on this list will be very low. A web-archive of messages sent to this list is also available; it also serves as change-log of the public version of the code. To unsubscribe from this list, send a message with the word "unsubscribe gadget-announce" in the subject-line.


Please check the web-archive of the mailing list gadget-announce (see above) for a list of problems that have been fixed since the public release of GADGET-2.

At this point, it is worth noting that the author and his direct collaborators change and adapt GADGET for their own purposes constantly. Unfortunately, we don't have the time to incorporate all these changes and features into public versions of the code. However, we will try to correct any bugs or problems that come to our attention in this public release of the code. If in doubt about specific aspects of the code, or if you think you found a bug, please contact the author.


GADGET comes with a number of small examples (the same ones as for GADGET-1) that can be run to develop a feel for working with the simulation code. We provide initial conditions for the following systems:
A pair of colliding disk galaxies (collisionless)
A spherical collapse of a self-gravitating sphere of gas
Cosmological formation of a cluster of galaxies (collisionless, vacuum boundaries)
Cosmological structure formation in a periodic box with adiabatic gas physics

Please refer to the User's Guide for detailed information on how you can run these examples with GADGET. We also provide a few IDL-scripts for a simple analysis of some of GADGET's output.


The main reference for the implemented physics, and for algorithmic and numerical aspects of GADGET-2 is the paper "The cosmological simulation code GADGET-2",  Springel V., 2005, MNRAS, 364, 1105, and references therein. A copy of the paper is also contained in the 'Documentation' subdirectory of GADGET's distribution.

Additional information about the previous version of
GADGET is contained in the paper "GADGET: A code for collisionless and gasdynamical cosmological simulations", Springel V., Yoshida N., White S. D. M., 2001, New Astronomy, 6, 51.

User's Guide

A detailed description of GADGET's compilation and usage may be found in the User's Guide, which is also contained in the Documentation-subdirectory of the distribution. The User's Guide also explains the various examples accompanying this distribution, and the output produced by GADGET. A brief description of the compilation and usage of the code is also contained in the html-subdirectory of the code distribution, which also contains a cross-referenced guide to the structure of the source code itself.

Code Reference

A cross-referenced documentation of the source code can be accessed here. It also contains a short description of compilation of the code, and the various options of makefike and parameterfile

Scientific Papers

A number of scientific papers in the referenced literature have used GADGET for numerical work. A rough list may be obtained from ADS by querying for papers that cite the code paper of GADGET-2 or by querying for papers that cite GADGET-1. Note however that the returned list will also contain a number of papers that have not used GADGET itself but referenced it for other reasons.


From the author's efforts to visualize simulation results obtained with GADGET, a few `nice pictures' resulted. Below we provide a small sample of those. You may click on any of the following links to see a larger version of the image, and a brief explanation of it.
Millennium Simulation
Colliding disk galaxies
Hydrodynamical simulations of cosmic structure formation
Merging galaxies with quasar feedback
Constrained Realizations of the Local Universe
High-resolution simulations of a cluster of galaxies

Further and more current visual material can be obtained from the web-pages of the Theoretical Astrophysics  (TAP) group at the Heidelberg Insitute for Theoretical Studies (HITS), or the data visualization web-site of MPA's galaxy formation group.


Simulations done with GADGET have also been visualized in a number of movies. Some of these movies have been used for a multimedia presentation explaining research topics that are currently addressed at MPA.

We here just provide a few examples of these animations in the form of heavily size-reduced and compressed movies in the MPEG1 or MPEG4 formats. Playing these movies in proper quality requires a reasonably fast computer. Some of the movies are encoded using "divx", a flavour of the MPEG4 movie compression algorithms. On Linux computers, you can use the mplayer application to play them, on Apple or Windows computers you may have to install the free version of the divx-codec first.

The Local Universe (Constrained Realization project) (7.4 MB)  
Two colliding and merging spiral galaxies (4.8 MB)
Dark matter substructure in a cluster of galaxies (7.5 MB)
A forming cluster of galaxies (112 MB, divx)
Merging galaxies with supermassive black holes (22 MB, divx)
A zoom into the Millennium Simulation (49 MB, divx)
Further and more current visual material can be obtained from the web-pages of the Theoretical Astrophysics  (TAP) group at the Heidelberg Insitute for Theoretical Studies (HITS), or the data visualization web-site of MPA's galaxy formation group.


We here provide a few links to software by other people that can be used together with GADGET. Note that this list is likely not complete, and does not mean that we specifically endorse a certain type of software.

Visualization software SPLASH (by Daniel Price)  
Visualization software IRFIT (by Nick Gnedin) 

Contact address

Prof. Dr. Volker Springel 
Heidelberg Insitute for Theoretical Studies
Schloss-Wolfbrunnenweg 35
69118 Heidelberg
Zentrum für Astronomie, University of Heidelberg
Astronomisches Recheninstitut             
Mönchhofstr. 12-14                   
69120 Heidelberg