File Formats:
Data files are in binary unformatted Fortran format. More specifically, in the case of the ΛCDM-W5, RPCDM-W5 and SUCDM-W5 simulations the files are binary big endian unformatted Fortran files, while the data file of the ΛCDM-W7, RPCDM-W7 and wCDM-W7 are binary little endian unformatted Fortran files.
Files containing snapshot particles (field): fof_boxlenX_nY_COSMO_cube_N
Files containing halo positions (halo): fof_boxlenX_nY_COSMO_masst_N
Files containing the halo particles (halo): fof_boxlenX_nY_COSMO_strct_N
where X is the box length of the simulation, Y the cubic root of the number of particles in the simulation, COSMO = (lcdmw5, lcdmw7, rpcdmw5, rpcdmw7, wcdmw7) and N is the file ID number.
File Content:
Files containing snapshot particles:
| npart | integer(4) | Number of particles in the field |
| procid | integer(4) | ID of the cube |
| boundaries | real(4)*6 | xmin, xmax, ymin, ymax, zmin, zmax |
| positions | real(4)*3*npart | x, y, z position of each particles |
| velocities | real(4)*3*npart | vx, vy, vz velocity of each particles |
| ids | int(8)*npart | unique id of each particle |
Files containing halo positions:
| nhalos | integer(4) | Number of halos in the file |
| haoid | integer(8) | ID of each halo |
| apart | integer(4) | Number of particles of each halo |
| positions | real(4)*3*npart | x, y, z position of each halo centre of mass |
| velocities | real(4)*3*npart | vx, vy, vz velocity of each halo centre of mass |
Files containing halo particles:
| npart | integer(4) | Number of particles for each halo |
| positions | real(4)*3*npart | x, y, z position of each halo centre of mass |
| velocities | real(4)*3*npart | vx, vy, vz velocity of each halo centre of mass |
| ids | integer(8) | Unique ID of each particle for each halo |
Position and velocities are in RAMSES units. The data files can be read natively in Fortran, or using a C++ library as described below.
Reading Data File Scripts:
In order to read the binary files, you need to use the proper compilation flag to convert the big-endian or little-endian binary of your compiler, e.g. for ifort:
ifort -convert big_endian -O3 my_program.f90 - o my_program
Fortran script for reading field particle velocities and positions from the files containing snapshot particles:
program read_field
implicit none
integer(4) :: npart, procID, Ucub, j, i
real(4) :: xmin, xmax, ymin, ymax, zmin, zmax
integer(8), allocatable :: id(:)
real(4), allocatable :: x(:,:), v(:,:)
Open(Unit=Ucub,file='/path_for_data/ &
& fof_boxlen648_n1024_lcdmw5_cube_00001',Form='Unformatted')
! read number of particles in the cube
Read(Ucub) npart
! read ID of the FoF process assigned to this cube
Read(Ucub) procID
! read boundary values of the cube
Read(Ucub) xmin, xmax, ymin, ymax, zmin, zmax
! allocate memory
allocate(id(1:npart))
allocate(x(1:3,1:npart))
allocate(v(1:3,1:npart))
! read positions
Read(Ucub) ((x(j,i),j=1,3),i=1,npart)
! read velocities
Read(Ucub) ((v(j,i),j=1,3),i=1,npart)
! read id's
Read(Ucub) (id(i),i=1,npart)
Close(Ucub)
end program read_field
Fortran script for reading halo mass and centre of mass positions from the files containing halo positions:
program read_masst
implicit none
integer(4) :: nhalos, Ucub, j, i, i_halos
integer(4), allocatable :: nparthalos(:)
integer(8), allocatable :: id(:)
real(4),allocatable :: x(:,:)
Open(Unit=Ucub,file='/path_for_data/ &
& fof_boxlen648_n1024_lcdmw5_masst_00001',Form='Unformatted')
! read number of halos
Read(Ucub) nhalos
! allocate memory
allocate(id(1:nhalos))
allocate(nparthalos(1:nhalos))
allocate(x(1:3,1:nhalos))
do i_halos = 1, nhalos ! loop over all halos in the file
! read number of particles
Read(Ucub) id(i_halos), nparthalos(i_halo),((x(j,i_halos),j=1,3)
end do
Close(Ucub)
end program read_masst
Fortran script for reading halo particle positions and velocities from the files containing halo particles:
program read_struct
implicit none
integer(4) :: mynpart, Ucub, j, i, mynhalos
integer(8), allocatable :: id(:)
real(4),allocatable :: x(:,:),v(:,:)
Open(Unit=Ucub,file='/path_for_data/ &
& fof_boxlen648_n1024_lcdmw5_strct_00001',Form='Unformatted')
! read number of halos
Read(Ucub) mynhalos
do i_halos = 1, mynhalos ! look over all halos in the file
! read number of particles
Read(Ucub) mynpart
! allocate memory
allocate(id(1:mynpart))
allocate(x(1:3,1:mynpart))
allocate(v(1:3,1:mynpart))
! read positions
Read(Ucub) ((x(j,i),j=1,3),i=1,mynpart)
! read velocities
Read(Ucub) ((v(j,i),j=1,3),i=1,mynpart)
! read id's
Read(Ucub) (id(i),i=1,mynpart)
end do
Close(Ucub)
end program read_struct