Mostly specific to the HIMALAYA project
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.
Gadget4
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
IDS_64BIT: Always use for HIMALAYA outputs.NTYPES=6: Tells Gadget4 that there are 6 PartTypes. This should work even if it is a DMO run. So leave as such.NSOFTCLASSES=3: This enables 3 sets of softenings. You then match each PartType to a particular softening class. This can be as high as NTYPES, but three should be enough for HIMALAYA, one each for gas, DM, and star particles.POSITIONS_IN_64BIT: Gadget4 uses integer coordinates internally. Switching to integers frees up more bits (the ones that are reserved for the exponent in the floating point). The 64bit is more than enough for HIMALAYA with a relative accuracy of $\sim10^{−20}$…! See $\S$ 2.10 of the code paper 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.
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.
The following flags can always be added and is recommended:
ENABLE_HEALTHTEST
HOST_MEMORY_REPORTING
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].
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
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.