From a09d0b828fceb3b4fc7313b8e56266b4bf7d4952 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Tue, 29 Jan 2019 15:16:48 +1100
Subject: [PATCH] If a particle has 0 neighbours, make the EAGLE chemistry
 model default to the un-smoothed quantities.

---
 src/chemistry/EAGLE/chemistry.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/chemistry/EAGLE/chemistry.h b/src/chemistry/EAGLE/chemistry.h
index b8a50f237a..f095c8bcef 100644
--- a/src/chemistry/EAGLE/chemistry.h
+++ b/src/chemistry/EAGLE/chemistry.h
@@ -129,7 +129,21 @@ chemistry_part_has_no_neighbours(struct part* restrict p,
                                  struct xpart* restrict xp,
                                  const struct chemistry_global_data* cd,
                                  const struct cosmology* cosmo) {
-  error("Needs implementing!");
+
+  /* Just make all the smoothed fields default to the un-smoothed values */
+  struct chemistry_part_data* cpd = &p->chemistry_data;
+
+  /* Total metal mass fraction */
+  cpd->smoothed_metal_mass_fraction_total = cpd->metal_mass_fraction_total;
+
+  /* Iron frac from SNIa */
+  cpd->smoothed_iron_mass_fraction_from_SNIa =
+      cpd->iron_mass_fraction_from_SNIa;
+
+  /* Individual metal mass fractions */
+  for (int i = 0; i < chemistry_element_count; i++) {
+    cpd->smoothed_metal_mass_fraction[i] = cpd->metal_mass_fraction[i];
+  }
 }
 
 /**
-- 
GitLab