diff --git a/src/runner.c b/src/runner.c
index 3f8cc7a2a306d2e9495627e7a644b04d871ab7eb..5511b92442c914d14b960d512f1c7fc981fbfc1e 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -1684,7 +1684,7 @@ void *runner_main(void *data) {
 
         case task_type_pair:
           if (t->subtype == task_subtype_density) {
-#ifdef WITH_VECTORIZATION
+#if defined(WITH_VECTORIZATION) && defined(GADGET2_SPH)
             runner_dopair1_density_vec(r, ci, cj);
 #else
             runner_dopair1_density(r, ci, cj);
diff --git a/src/runner_doiact.h b/src/runner_doiact.h
index 1fbaa3398dc7cd839ba1b1bafde1a2372658bbf1..e99baa64dbdf774a638c9ea3da25ce8ef9f7a329 100644
--- a/src/runner_doiact.h
+++ b/src/runner_doiact.h
@@ -2081,7 +2081,12 @@ void DOSUB_PAIR1(struct runner *r, struct cell *ci, struct cell *cj, int sid,
     if (!(cj->sorted & (1 << sid))) runner_do_sort(r, cj, (1 << sid), 1);
 
     /* Compute the interactions. */
-    DOPAIR1(r, ci, cj);
+#if (DOPAIR1 == runner_dopair1_density) && defined(WITH_VECTORIZATION) && \
+    defined(GADGET2_SPH)
+    runner_dopair1_density_vec(r, ci, cj);
+#else
+  DOPAIR1(r, ci, cj);
+#endif
   }
 
   if (gettimer) TIMER_TOC(TIMER_DOSUB_PAIR);