From 8aef100ff61dcf5d0e1f845530e324c9bb9c9145 Mon Sep 17 00:00:00 2001
From: Josh Borrow <joshua.borrow@durham.ac.uk>
Date: Mon, 1 Oct 2018 07:50:12 +0100
Subject: [PATCH] Added check to see if a_begin < a_end

---
 src/cosmology.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/cosmology.c b/src/cosmology.c
index f209997dd3..bb9e5714ed 100644
--- a/src/cosmology.c
+++ b/src/cosmology.c
@@ -487,6 +487,11 @@ void cosmology_init(struct swift_params *params, const struct unit_system *us,
   c->time_base = (c->log_a_end - c->log_a_begin) / max_nr_timesteps;
   c->time_base_inv = 1. / c->time_base;
 
+  /* If a_begin == a_end we hang */
+
+  if (c->a_begin >= c->a_end)
+    error("a_begin must be strictly before (and not equal to) a_end");
+
   /* Construct derived quantities */
 
   /* Curvature density (for closure) */
-- 
GitLab