diff --git a/src/velociraptor_interface.c b/src/velociraptor_interface.c
index 7ff11a603b7d59a60c39f63fcea5b49b32978a7c..cf2a9af3c658cc3c06e7f0431b44eeee3bf5eaa4 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];