From d62c845bffa023b637b7117b0e5f10fd53e28a8d Mon Sep 17 00:00:00 2001
From: James Willis <james.s.willis@durham.ac.uk>
Date: Mon, 23 Apr 2018 11:39:20 +0800
Subject: [PATCH] Only use the total number of DM particles to calculate the
 linking length.

---
 src/velociraptor_interface.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/velociraptor_interface.c b/src/velociraptor_interface.c
index 7ff11a603b..cf2a9af3c6 100644
--- a/src/velociraptor_interface.c
+++ b/src/velociraptor_interface.c
@@ -89,7 +89,8 @@ void velociraptor_init(struct engine *e) {
     message("G: %e", unit_info.gravity);
     message("H: %e", unit_info.hubbleunit);
 
-    const int total_nr_gparts = e->total_nr_gparts;
+    /* TODO: Find the total number of DM particles when running with star particles and BHs. */
+    const int total_nr_dmparts = e->total_nr_gparts - e->total_nr_parts;
     
     /* Set simulation information. */
     if(e->s->periodic) {
@@ -97,7 +98,7 @@ void velociraptor_init(struct engine *e) {
     }
     else sim_info.period = 0.0;
     sim_info.zoomhigresolutionmass = -1.0; /* Placeholder. */
-    sim_info.interparticlespacing = sim_info.period / pow(total_nr_gparts, 1./3.);
+    sim_info.interparticlespacing = sim_info.period / pow(total_nr_dmparts, 1./3.);
     sim_info.icosmologicalsim = (e->policy & engine_policy_cosmology);
     sim_info.spacedimension[0] = unit_info.lengthtokpc * s->dim[0];
     sim_info.spacedimension[1] = unit_info.lengthtokpc * s->dim[1];
-- 
GitLab