From 90c83959845f9a17228c2938491b9b7c7b4f9cbb Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Sat, 5 Jan 2019 22:49:26 +0100
Subject: [PATCH] Do not assume the box is cubic when writing the box size to
 the snapshots.

---
 src/parallel_io.c | 4 ++--
 src/serial_io.c   | 4 ++--
 src/single_io.c   | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/parallel_io.c b/src/parallel_io.c
index 8bd7a41d66..b62422d22f 100644
--- a/src/parallel_io.c
+++ b/src/parallel_io.c
@@ -994,8 +994,8 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6],
       units_conversion_factor(internal_units, snapshot_units, UNIT_CONV_LENGTH);
   const double dblTime = e->time * factor_time;
   const double dim[3] = {e->s->dim[0] * factor_length,
-                         e->s->dim[0] * factor_length,
-                         e->s->dim[0] * factor_length};
+                         e->s->dim[1] * factor_length,
+                         e->s->dim[2] * factor_length};
 
   /* Print the relevant information and print status */
   io_write_attribute(h_grp, "BoxSize", DOUBLE, dim, 3);
diff --git a/src/serial_io.c b/src/serial_io.c
index 5b15505788..c05c43a652 100644
--- a/src/serial_io.c
+++ b/src/serial_io.c
@@ -856,8 +856,8 @@ void write_output_serial(struct engine* e, const char* baseName,
         internal_units, snapshot_units, UNIT_CONV_LENGTH);
     const double dblTime = e->time * factor_time;
     const double dim[3] = {e->s->dim[0] * factor_length,
-                           e->s->dim[0] * factor_length,
-                           e->s->dim[0] * factor_length};
+                           e->s->dim[1] * factor_length,
+                           e->s->dim[2] * factor_length};
 
     /* Print the relevant information and print status */
     io_write_attribute(h_grp, "BoxSize", DOUBLE, dim, 3);
diff --git a/src/single_io.c b/src/single_io.c
index f908c4581c..178f59a528 100644
--- a/src/single_io.c
+++ b/src/single_io.c
@@ -709,8 +709,8 @@ void write_output_single(struct engine* e, const char* baseName,
       units_conversion_factor(internal_units, snapshot_units, UNIT_CONV_LENGTH);
   const double dblTime = e->time * factor_time;
   const double dim[3] = {e->s->dim[0] * factor_length,
-                         e->s->dim[0] * factor_length,
-                         e->s->dim[0] * factor_length};
+                         e->s->dim[1] * factor_length,
+                         e->s->dim[2] * factor_length};
 
   /* Print the relevant information and print status */
   io_write_attribute(h_grp, "BoxSize", DOUBLE, dim, 3);
-- 
GitLab