Halo-finding

Mostly specific to the HIMALAYA project

Basics

Get the code from the repo mentioned at https://wwwmpa.mpa-garching.mpg.de/gadget4/. This is also the official website with detailed information about the different config options.

And then run these commands in the root dir:

cp Template-Makefile.systype Makefile.systype
cp Template-Config.sh Config.sh

You now need to select a Systype option in the Makefile.systype file. The SYSTYPE="Generic-gcc" should work on almost all the systems.

The bare minimum modules you need are gcc openmpi gsl fftw hdf5 gmp.

Once you have chosen the relevant config compile options in Config.sh, run make clean && make -j4 to compile.

Now on to the relevant compile flags.

Config flags

Gadget4 comes bundled with the SUBFIND (and also its HBT-variant which is the preferred one) halo finder. We are going to set up Gadget4 to postprocess HIMALAYA outputs.

Always on / Uniform boxes

The following are the config flags that you always need. Note that this is for a DMO run.

DOUBLEPRECISION=1
FMM
FOF
FOF_ALLOW_HUGE_GROUPLENGTH
FOF_GROUP_MIN_LEN=32
FOF_LINKLENGTH=0.2
FOF_PRIMARY_LINK_TYPES=2
GADGET2_HEADER
HIERARCHICAL_GRAVITY
IDS_64BIT
MERGERTREE
NSOFTCLASSES=3
NTYPES=6
PERIODIC
PMGRID=512
POSITIONS_IN_64BIT
RANDOMIZE_DOMAINCENTER
SELFGRAVITY
SUBFIND
SUBFIND_HBT
TREEPM_NOTIMESPLIT

Hydrodynamical runs

If you’re running with baryon physics as well, add the following flags:

FOF_SECONDARY_LINK_TYPES=1+16

This tells Gadget4 to also link Type0 $(2^0 =1)$ gas and Type4 $(2^4=16)$ star particles as well.

Zoom runs

If you are runnning a zoom simulation, add the following:

PLACEHIGHRESREGION=2
HRPMGRID=512
PM_ZOOM_OPTIMIZED

You may also increase the HRPMGRID to even 1024 depending on the particular run.

Optional flags

The following flags can always be added and is recommended:

ENABLE_HEALTHTEST
HOST_MEMORY_REPORTING

Runtime Parameters

Use the input.params file from the repo here. The only parameters that you may need to change are the BoxSize, cosmology parameters, and the softenings.

Set up the three sets of comoving and physical softenings for SofteningComovingClass[0-2] and SofteningMaxPhysClass[0-2].

Postprocessing GIZMO outputs

The primary issue with running SUBFIND on GIZMO outputs is that in addition to the ParticleIDs, GIZMO has two extra fields: ParticleChildIDsNumber and ParticleIDGenerationNumber. These are used when a gas particle splits into two, for instance. Since SUBFIND-HBT uses past membership of particles to match subhaloes across snapshots, reliable particleIDs are vital for this part. Gadget4 outs are also ordered in terms of their halo membership. See and for recent works comparing halo-finders.

Grab the python scripts from here. The scripts will first create a 64bit unique ID by combining the three ID fields from GIZMO outputs, on which SUBFIND-HBT can be run. The last script will index the fields that are unknown to Gadget4 (our grackle variables for instance) and copy them over to the new snapshots in the correct order.