From f43eab5de211b1d3d63d4a11ce7c447e9b68d936 Mon Sep 17 00:00:00 2001
From: Folkert Nobels <nobels@strw.leidenuniv.nl>
Date: Tue, 18 Dec 2018 17:38:36 +0100
Subject: [PATCH] Add the metallicity in threshold

---
 src/starformation/schaye08/starformation.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/starformation/schaye08/starformation.h b/src/starformation/schaye08/starformation.h
index 56a78d32ff..888382c0e3 100644
--- a/src/starformation/schaye08/starformation.h
+++ b/src/starformation/schaye08/starformation.h
@@ -164,8 +164,9 @@ INLINE static int star_formation_potential_to_become_star(
       /* If the maximum density is not exceeded check if the redshift dependent
        * one is exceeded */
     } else {
-      /* NEED TO USE A PROPER WAY OF FINDING Z */
-      double Z = 0.002;
+      /* Get the metallicity from the chemistry struct
+       * Do we use SMOOTHED OR NON SMOOTHED IN EAGLE???*/
+      double Z = p->chemistry_data.smoothed_metal_mass_fraction_total;
       double den_crit_current =
           starform->den_crit * pow(Z * starform->Z0_inv, starform->n_Z0);
       if (p->rho > den_crit_current) {
-- 
GitLab