diff --git a/src/cosmology.c b/src/cosmology.c
index 90dfd6da8742fe8afe13323322ec144b4b5facb6..e330031a6c79d0fd3c3e0cab0764a1f6510e3f11 100644
--- a/src/cosmology.c
+++ b/src/cosmology.c
@@ -30,6 +30,7 @@
 
 /* Local headers */
 #include "adiabatic_index.h"
+#include "common_io.h"
 #include "inline.h"
 #include "restart.h"
 
@@ -627,6 +628,26 @@ void cosmology_clean(struct cosmology *c) {
   free(c->time_interp_table);
 }
 
+#ifdef HAVE_HDF5
+void cosmology_write_model(hid_t h_grp, const struct cosmology *c) {
+
+  io_write_attribute_d(h_grp, "a_beg", c->a_begin);
+  io_write_attribute_d(h_grp, "a_end", c->a_end);
+  io_write_attribute_d(h_grp, "time_beg [internal units]", c->time_begin);
+  io_write_attribute_d(h_grp, "time_end [internal units]", c->time_end);
+  io_write_attribute_d(h_grp, "h", c->h);
+  io_write_attribute_d(h_grp, "H0 [internal units]", c->H0);
+  io_write_attribute_d(h_grp, "Hubble time [internal units]", c->Hubble_time);
+  io_write_attribute_d(h_grp, "Omega_m", c->Omega_m);
+  io_write_attribute_d(h_grp, "Omega_r", c->Omega_r);
+  io_write_attribute_d(h_grp, "Omega_b", c->Omega_b);
+  io_write_attribute_d(h_grp, "Omega_k", c->Omega_k);
+  io_write_attribute_d(h_grp, "Omega_lambda", c->Omega_lambda);
+  io_write_attribute_d(h_grp, "w_0", c->w_0);
+  io_write_attribute_d(h_grp, "w_a", c->w_a);
+}
+#endif
+
 /**
  * @brief Write a cosmology struct to the given FILE as a stream of bytes.
  *
diff --git a/src/cosmology.h b/src/cosmology.h
index 7ecc9afc227a70ea3b696455f68d1e62571a1045..b1b33930bad7a49c0f2abe3a2201d71c9be57305 100644
--- a/src/cosmology.h
+++ b/src/cosmology.h
@@ -186,6 +186,10 @@ void cosmology_init_no_cosmo(struct cosmology *c);
 void cosmology_print(const struct cosmology *c);
 void cosmology_clean(struct cosmology *c);
 
+#ifdef HAVE_HDF5
+void cosmology_write_model(hid_t h_grp, const struct cosmology *c);
+#endif
+
 /* Dump/restore. */
 void cosmology_struct_dump(const struct cosmology *cosmology, FILE *stream);
 void cosmology_struct_restore(struct cosmology *cosmology, FILE *stream);
diff --git a/src/parallel_io.c b/src/parallel_io.c
index e6e1dfd703084a7de1eac20864940b129cad4fcb..9a534d8e8918aa5cea2442ca0fbb81cebb6d6357 100644
--- a/src/parallel_io.c
+++ b/src/parallel_io.c
@@ -929,6 +929,15 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6],
     H5Gclose(h_grp);
   }
 
+  /* Print the gravity parameters */
+  if (e->policy & engine_policy_cosmology) {
+    h_grp = H5Gcreate(h_file, "/Cosmology", H5P_DEFAULT, H5P_DEFAULT,
+                      H5P_DEFAULT) if (h_grp < 0)
+        error("Error while creating cosmology group");
+    cosmology_write_model(h_grp, e->cosmology);
+    H5Gclose(h_grp);
+  }
+
   /* Print the runtime parameters */
   h_grp =
       H5Gcreate(h_file, "/Parameters", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
diff --git a/src/serial_io.c b/src/serial_io.c
index 6747b345db1dac9bff51e4d9c4d888105a01a90f..7fb8421086f4aa7462637dbafe92a974ea1199bf 100644
--- a/src/serial_io.c
+++ b/src/serial_io.c
@@ -837,6 +837,15 @@ void write_output_serial(struct engine* e, const char* baseName,
       H5Gclose(h_grp);
     }
 
+    /* Print the cosmological model */
+    if (e->policy & engine_policy_cosmology) {
+      h_grp = H5Gcreate(h_file, "/Cosmology", H5P_DEFAULT, H5P_DEFAULT,
+                        H5P_DEFAULT);
+      if (h_grp < 0) error("Error while creating cosmology group");
+      cosmology_write_model(h_grp, e->cosmology);
+      H5Gclose(h_grp);
+    }
+
     /* Print the runtime parameters */
     h_grp =
         H5Gcreate(h_file, "/Parameters", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
diff --git a/src/single_io.c b/src/single_io.c
index 862851378d0cc82f775c144f10a47e8fdbe6591e..33b6554468f45091763eeeaca4724e0c5f37be32 100644
--- a/src/single_io.c
+++ b/src/single_io.c
@@ -689,6 +689,15 @@ void write_output_single(struct engine* e, const char* baseName,
     H5Gclose(h_grp);
   }
 
+  /* Print the cosmological model  */
+  if (e->policy & engine_policy_cosmology) {
+    h_grp =
+        H5Gcreate(h_file, "/Cosmology", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+    if (h_grp < 0) error("Error while creating cosmology group");
+    cosmology_write_model(h_grp, e->cosmology);
+    H5Gclose(h_grp);
+  }
+
   /* Print the runtime parameters */
   h_grp =
       H5Gcreate(h_file, "/Parameters", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);