From e99270fb8ab49757ab2f724cb8fffced6ab07f73 Mon Sep 17 00:00:00 2001
From: Robert Izzard <r.izzard@surrey.ac.uk>
Date: Fri, 18 Oct 2019 23:09:57 +0100
Subject: [PATCH] clean up code

---
 src/binary_c_macros.h             | 1 +
 src/evolution/evolution_difflog.c | 2 +-
 src/timestep/timestep_limits.c    | 6 ++++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/binary_c_macros.h b/src/binary_c_macros.h
index 98b72131c..c24b6d2d1 100644
--- a/src/binary_c_macros.h
+++ b/src/binary_c_macros.h
@@ -836,6 +836,7 @@
         "HG fractional envelope",               \
     }
 
+
 #define NOVA_STATE_NONE 0
 #define NOVA_STATE_TRIGGER 1
 #define NOVA_STATE_POST 2
diff --git a/src/evolution/evolution_difflog.c b/src/evolution/evolution_difflog.c
index 46a6af0a9..3b605207e 100644
--- a/src/evolution/evolution_difflog.c
+++ b/src/evolution/evolution_difflog.c
@@ -475,7 +475,7 @@ static void cf_diffstats(struct stardata_t * RESTRICT const stardata,
         {
             const Boolean novae =
                 stardata->preferences->individual_novae == TRUE ?
-                Boolean_(now->novastate[k] != NOVA_STATE_NONE) :
+                Boolean_(now->novastate[k] == TRUE) :
                 Boolean_(now->novarate[k] < 0.0);
             
             if((novae == TRUE) &&
diff --git a/src/timestep/timestep_limits.c b/src/timestep/timestep_limits.c
index 5359f09de..26c9f38e6 100644
--- a/src/timestep/timestep_limits.c
+++ b/src/timestep/timestep_limits.c
@@ -289,6 +289,7 @@ void timestep_limits(Timestep_prototype_args)
                                                             star->mass);
                     }
 
+#ifdef __DEPRECATED
                     if(star->novastate == NOVA_STATE_TRIGGER)
                     {
                         /* 
@@ -322,7 +323,12 @@ void timestep_limits(Timestep_prototype_args)
                          */
                         dtlim = stardata->preferences->timestep_multipliers[DT_LIMIT_NOVAE] * star->dtnova;
                     }
+#endif
 
+                    star->dtnova = nova_recurrence_time(accretion_rate,
+                                                            star->mass);
+                    dtlim = stardata->preferences->timestep_multipliers[DT_LIMIT_NOVAE] * star->dtnova;
+                    
                     dtlim *= 1e-6; // convert to Myr
                     
                     /* 
-- 
GitLab