I would like to study the Illustris simulation in Lagrangian space. For this, I want to access or infer the initial position of the dark matter particles in a given snapshot. However, I have difficulty doing this at the moment as the coordinates in both the snapshots and the initial conditions (obtained with the Zel'dovich approximation), of for example the TNG100-3-Dark simulation, do not seem to be ordered.
For example, in the initial conditions of the TNG100-3-Dark simulations the first 10 particles with particle id's 1 to 10 with the coordinates
167.658 18.483 33.461
110.104 99.4598 15061.3
61.6123 112.504 30053.5
72.9463 93.4387 45036.8
74993.8 17.0464 59971.4
94.3829 15100. 44.5771
78.0164 15099.8 15055.7
40.0065 15059.4 29989.3
85.9055 15015.8 44967.
120.644 15072.5 60009.2
jump around (see for example the y-coordinate for the particles 1 to 5 and 6 to 10) before shell-crossing has taken place. I am assuming this is part of the parallelization architecture.
I would thus like to inquire whether I can access the mapping from the ParticleIDs to the initial positions of the dark matter particles before the Zel'dovich approximation has been applied. I have made several attempts to infer this from the initial conditions (snap_ics.hdf5) but have so far not managed to reliably do this. Is there a way to do this which I have overlooked?
Thanks in advance,
You are right that the ordering of particles changes with every snapshot, the goal here is primarily to make analysis at any given time easier (by grouping particles that are within the same collapsed objects, and nearby in space).
Since the population of DM particles is completely constant (their number, and their set of unique ParticleIDs never changes), you can always find the unique cross-match between the set of DM particles in any snapshot, and the set of DM particles in the initial conditions file.
The easiest way to do this would be to simply sort both sets of ParticleIDs (e.g. np.argsort()). The corresponding Coordinates, so sorted, give you the change of comoving position of each DM particle, between the initial conditions and the considered snapshot.
If you have a finite set of DM particles at some snapshot, and want to know their initial coordinates, then you would need to locate their indices in the initial conditions by cross-matching their ParticleIDs, for instance using an approach like np.searchsorted() or np.in1d() for efficiency.
I'm not sure if you really need "before the Zel'dovich approximation has been applied"? The initial conditions are after this, and we haven't stored the coordinates before this (although the perturbations are small), as this is just tiling of a glass configuration.
Thank you very much for your quick response. This is really helpful!
I would like to pose a small follow up question. You mentioned that the coordinates before the Zel'dovich approximation have not been stored. Do you know where I can find the growing mode used in the Zel'dovich approximation to generate the initial conditions? I could not find it in either the in the Background and Important Details or the summary of the specific simulations. If this is not available I will use the initial conditions (provided in snap_ics.hdf5) as the Lagrangian positions and move forward from there as you suggested.
Thank you very much for your answer,
The ICs have been made with a code which is very similar to the publicly available N-GenIC. If you need an intermediate step or inputs from the configuration files, etc, I can probably dig them up.