diff --git a/src/parallel_io.c b/src/parallel_io.c index 0da34d4dad114db0920c8e8f3bb617295ff3da96..0d7c0d5c3ca44af56a164421622af1115038bb7f 100644 --- a/src/parallel_io.c +++ b/src/parallel_io.c @@ -486,6 +486,10 @@ void read_ic_parallel(char* fileName, const struct UnitSystem* internal_units, } } + /* Convert the dimensions of the box */ + for (int j = 0; j<3 ; j++) + dim[j] *= units_conversion_factor(ic_units, internal_units, UNIT_CONV_LENGTH); + /* Allocate memory to store SPH particles */ *Ngas = N[0]; if (posix_memalign((void*)parts, part_align, (*Ngas) * sizeof(struct part)) != diff --git a/src/serial_io.c b/src/serial_io.c index 6e26be1a33fbc2c74ae1b8f7af2b83db285c962e..ab4a81a8f1360e9738efa76465bde29cb2abcf26 100644 --- a/src/serial_io.c +++ b/src/serial_io.c @@ -528,6 +528,10 @@ void read_ic_serial(char* fileName, const struct UnitSystem* internal_units, H5Fclose(h_file); } + /* Convert the dimensions of the box */ + for (int j = 0; j<3 ; j++) + dim[j] *= units_conversion_factor(ic_units, internal_units, UNIT_CONV_LENGTH); + /* Now need to broadcast that information to all ranks. */ MPI_Bcast(flag_entropy, 1, MPI_INT, 0, comm); MPI_Bcast(periodic, 1, MPI_INT, 0, comm); diff --git a/src/single_io.c b/src/single_io.c index 6cb7e830209b0d58919fe6f529f675b4c611a51d..6d752388ad088117a9bdf3e84de312338d5bb7a6 100644 --- a/src/single_io.c +++ b/src/single_io.c @@ -433,6 +433,10 @@ void read_ic_single(char* fileName, const struct UnitSystem* internal_units, internal_units->UnitTemperature_in_cgs); } + /* Convert the dimensions of the box */ + for (int j = 0; j<3 ; j++) + dim[j] *= units_conversion_factor(ic_units, internal_units, UNIT_CONV_LENGTH); + /* Allocate memory to store SPH particles */ *Ngas = N[0]; if (posix_memalign((void*)parts, part_align, *Ngas * sizeof(struct part)) !=