diff --git a/src/parallel_io.c b/src/parallel_io.c
index 89945b58d96f22c93699ebe78935cd00a0fc3d54..dbd029569e0947cd5d5884ad392bedc81ab04468 100644
--- a/src/parallel_io.c
+++ b/src/parallel_io.c
@@ -445,6 +445,12 @@ void read_ic_parallel(char* fileName, const struct unit_system* internal_units,
   dim[1] = (boxSize[1] < 0) ? boxSize[0] : boxSize[1];
   dim[2] = (boxSize[2] < 0) ? boxSize[0] : boxSize[2];
 
+  /* Change box size in the 1D and 2D case */
+  if (hydro_dimension == 2)
+    dim[2] = min(dim[0], dim[1]);
+  else if (hydro_dimension == 1)
+    dim[2] = dim[1] = dim[0];
+
   /* message("Found %lld particles in a %speriodic box of size [%f %f %f].", */
   /* 	  N_total[0], (periodic ? "": "non-"), dim[0], */
   /* 	  dim[1], dim[2]); */
diff --git a/src/serial_io.c b/src/serial_io.c
index 52c52ff24c186a04da3e3945aea6684abcd95476..a7e342f0a90fcf4c57f334526ff91b1923de4585 100644
--- a/src/serial_io.c
+++ b/src/serial_io.c
@@ -493,10 +493,17 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units,
       N_total[ptype] =
           (numParticles[ptype]) + (numParticles_highWord[ptype] << 32);
 
+    /* Get the box size if not cubic */
     dim[0] = boxSize[0];
     dim[1] = (boxSize[1] < 0) ? boxSize[0] : boxSize[1];
     dim[2] = (boxSize[2] < 0) ? boxSize[0] : boxSize[2];
 
+    /* Change box size in the 1D and 2D case */
+    if (hydro_dimension == 2)
+      dim[2] = min(dim[0], dim[1]);
+    else if (hydro_dimension == 1)
+      dim[2] = dim[1] = dim[0];
+
     /* message("Found %lld particles in a %speriodic box of size [%f %f %f].",
      */
     /* 	    N_total, (periodic ? "": "non-"), dim[0], dim[1], dim[2]); */
diff --git a/src/single_io.c b/src/single_io.c
index 85c1286f7f0d3769c30a79af411b03d1523aa292..0b091a5997504e5f5a4cc3b8af7ca06c994e993c 100644
--- a/src/single_io.c
+++ b/src/single_io.c
@@ -400,10 +400,17 @@ void read_ic_single(char* fileName, const struct unit_system* internal_units,
     N[ptype] = ((long long)numParticles[ptype]) +
                ((long long)numParticles_highWord[ptype] << 32);
 
+  /* Get the box size if not cubic */
   dim[0] = boxSize[0];
   dim[1] = (boxSize[1] < 0) ? boxSize[0] : boxSize[1];
   dim[2] = (boxSize[2] < 0) ? boxSize[0] : boxSize[2];
 
+  /* Change box size in the 1D and 2D case */
+  if (hydro_dimension == 2)
+    dim[2] = min(dim[0], dim[1]);
+  else if (hydro_dimension == 1)
+    dim[2] = dim[1] = dim[0];
+
   /* message("Found %d particles in a %speriodic box of size [%f %f %f].",  */
   /* 	  *N, (periodic ? "": "non-"), dim[0], dim[1], dim[2]);  */