diff --git a/src/hydro/Gadget2/hydro.h b/src/hydro/Gadget2/hydro.h
index 829c7ce98579bca5f598df15ed28cde52c878a43..f7ce7d4b499a27707570b6172510c1b6c2bf5602 100644
--- a/src/hydro/Gadget2/hydro.h
+++ b/src/hydro/Gadget2/hydro.h
@@ -176,7 +176,7 @@ __attribute__((always_inline)) INLINE static void hydro_init_part(
     struct part *restrict p, const struct hydro_space *hs) {
 
 #ifdef DEBUG_INTERACTIONS_SPH
-  for (int i = 0; i < NUM_OF_NEIGHBOURS; ++i) p->ids_ngbs_density[i] = -1;
+  for (int i = 0; i < MAX_NUM_OF_NEIGHBOURS; ++i) p->ids_ngbs_density[i] = -1;
   p->num_ngb_density = 0;
 #endif
   
@@ -317,7 +317,7 @@ __attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
     struct part *restrict p) {
 
 #ifdef DEBUG_INTERACTIONS_SPH
-  for (int i = 0; i < NUM_OF_NEIGHBOURS; ++i) p->ids_ngbs_force[i] = -1;
+  for (int i = 0; i < MAX_NUM_OF_NEIGHBOURS; ++i) p->ids_ngbs_force[i] = -1;
   p->num_ngb_force = 0;
 #endif
   
diff --git a/src/hydro/Gadget2/hydro_iact.h b/src/hydro/Gadget2/hydro_iact.h
index f6d8be0da0cae61e2b1bda9cea1b1c1f7986de87..3b5b785a3eb83a4b5c53b4eed995e7f1fe46a980 100644
--- a/src/hydro/Gadget2/hydro_iact.h
+++ b/src/hydro/Gadget2/hydro_iact.h
@@ -106,13 +106,13 @@ __attribute__((always_inline)) INLINE static void runner_iact_density(
   
 #ifdef DEBUG_INTERACTIONS_SPH
   /* Update ngb counters */
-  if(pi->num_ngb_density < NUM_OF_NEIGHBOURS) {
+  if(pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS) {
     pi->ids_ngbs_density[pi->num_ngb_density] = pj->id;
     ++pi->num_ngb_density;
   }
   else ++pi->num_ngb_density;
 
-  if(pj->num_ngb_density < NUM_OF_NEIGHBOURS) {
+  if(pj->num_ngb_density < MAX_NUM_OF_NEIGHBOURS) {
     pj->ids_ngbs_density[pj->num_ngb_density] = pi->id;
     ++pj->num_ngb_density;
   }
@@ -170,7 +170,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density(
   
 #ifdef DEBUG_INTERACTIONS_SPH
   /* Update ngb counters */
-  if(pi->num_ngb_density < NUM_OF_NEIGHBOURS) {
+  if(pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS) {
     pi->ids_ngbs_density[pi->num_ngb_density] = pj->id;
     ++pi->num_ngb_density;
   }
@@ -503,13 +503,13 @@ __attribute__((always_inline)) INLINE static void runner_iact_force(
   
 #ifdef DEBUG_INTERACTIONS_SPH
   /* Update ngb counters */
-  if(pi->num_ngb_force < NUM_OF_NEIGHBOURS) {
+  if(pi->num_ngb_force < MAX_NUM_OF_NEIGHBOURS) {
     pi->ids_ngbs_force[pi->num_ngb_force] = pj->id;
     ++pi->num_ngb_force;
   }
   else ++pi->num_ngb_force;
 
-  if(pj->num_ngb_force < NUM_OF_NEIGHBOURS) {
+  if(pj->num_ngb_force < MAX_NUM_OF_NEIGHBOURS) {
     pj->ids_ngbs_force[pj->num_ngb_force] = pi->id;
     ++pj->num_ngb_force;
   }
@@ -608,7 +608,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
   
 #ifdef DEBUG_INTERACTIONS_SPH
   /* Update ngb counters */
-  if(pi->num_ngb_force < NUM_OF_NEIGHBOURS) {
+  if(pi->num_ngb_force < MAX_NUM_OF_NEIGHBOURS) {
     pi->ids_ngbs_force[pi->num_ngb_force] = pj->id;
     ++pi->num_ngb_force;
   }
diff --git a/src/hydro/Gadget2/hydro_io.h b/src/hydro/Gadget2/hydro_io.h
index fd3e058c1ade1c9b8d1003178f354726aaa9f603..7b7c5c647751800bceed84a33efb49e7bde87fdd 100644
--- a/src/hydro/Gadget2/hydro_io.h
+++ b/src/hydro/Gadget2/hydro_io.h
@@ -122,9 +122,9 @@ void hydro_write_particles(const struct part* parts, struct io_props* list,
                                  parts, num_ngb_density);
   list[11] = io_make_output_field("Num_ngb_force", INT, 1, UNIT_CONV_NO_UNITS,
                                  parts, num_ngb_force);
-  list[12] = io_make_output_field("Ids_ngb_density", LONGLONG, NUM_OF_NEIGHBOURS,
+  list[12] = io_make_output_field("Ids_ngb_density", LONGLONG, MAX_NUM_OF_NEIGHBOURS,
                                  UNIT_CONV_NO_UNITS, parts, ids_ngbs_density);
-  list[13] = io_make_output_field("Ids_ngb_force", LONGLONG, NUM_OF_NEIGHBOURS,
+  list[13] = io_make_output_field("Ids_ngb_force", LONGLONG, MAX_NUM_OF_NEIGHBOURS,
                                  UNIT_CONV_NO_UNITS, parts, ids_ngbs_force);
 #endif
 
diff --git a/src/runner_doiact_vec.c b/src/runner_doiact_vec.c
index e73cdf21114dfd5d01c1a0b8efe2f37c39da2a78..3373e0e1fe4b36543e8bd4d75bbb3c4b393701bd 100644
--- a/src/runner_doiact_vec.c
+++ b/src/runner_doiact_vec.c
@@ -669,7 +669,7 @@ __attribute__((always_inline)) INLINE void runner_doself1_density_vec(
 #ifdef DEBUG_INTERACTIONS_SPH
       for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
         if (doi_mask & (1 << bit_index)) { 
-          if(pi->num_ngb_density < NUM_OF_NEIGHBOURS) {
+          if(pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS) {
             pi->ids_ngbs_density[pi->num_ngb_density] = parts[pjd + bit_index].id;
             ++pi->num_ngb_density;
           }
@@ -677,7 +677,7 @@ __attribute__((always_inline)) INLINE void runner_doself1_density_vec(
         }
 
         if (doi_mask2 & (1 << bit_index)) { 
-          if(pi->num_ngb_density < NUM_OF_NEIGHBOURS) {
+          if(pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS) {
             pi->ids_ngbs_density[pi->num_ngb_density] = parts[pjd + VEC_SIZE + bit_index].id;
             ++pi->num_ngb_density;
           }
@@ -897,7 +897,7 @@ __attribute__((always_inline)) INLINE void runner_doself_subset_density_vec(
 #ifdef DEBUG_INTERACTIONS_SPH
       for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
         if (doi_mask & (1 << bit_index)) {
-          if(pi->num_ngb_density < NUM_OF_NEIGHBOURS) {
+          if(pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS) {
             pi->ids_ngbs_density[pi->num_ngb_density] = parts[pjd + bit_index].id;
             ++pi->num_ngb_density;
           }
@@ -905,7 +905,7 @@ __attribute__((always_inline)) INLINE void runner_doself_subset_density_vec(
         }
         
         if (doi_mask2 & (1 << bit_index)) {
-          if(pi->num_ngb_density < NUM_OF_NEIGHBOURS) {
+          if(pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS) {
             pi->ids_ngbs_density[pi->num_ngb_density] = parts[pjd + VEC_SIZE + bit_index].id;
             ++pi->num_ngb_density;
           }
@@ -1121,7 +1121,7 @@ __attribute__((always_inline)) INLINE void runner_doself2_force_vec(
 #ifdef DEBUG_INTERACTIONS_SPH
       for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
         if (vec_is_mask_true(v_doi_mask) & (1 << bit_index)) {
-          if(pi->num_ngb_force < NUM_OF_NEIGHBOURS) {
+          if(pi->num_ngb_force < MAX_NUM_OF_NEIGHBOURS) {
             pi->ids_ngbs_force[pi->num_ngb_force] = parts[pjd + bit_index].id;
             ++pi->num_ngb_force;
           }
@@ -1373,7 +1373,7 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
 #ifdef DEBUG_INTERACTIONS_SPH
         for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
           if (vec_is_mask_true(v_doi_mask) & (1 << bit_index)) { 
-            if(pi->num_ngb_density < NUM_OF_NEIGHBOURS) {
+            if(pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS) {
               pi->ids_ngbs_density[pi->num_ngb_density] = parts_j[sort_j[pjd + bit_index].i].id;
               ++pi->num_ngb_density;
             }
@@ -1500,7 +1500,7 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
 #ifdef DEBUG_INTERACTIONS_SPH
         for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
           if (vec_is_mask_true(v_doj_mask) & (1 << bit_index)) { 
-            if(pj->num_ngb_density < NUM_OF_NEIGHBOURS) {
+            if(pj->num_ngb_density < MAX_NUM_OF_NEIGHBOURS) {
               pj->ids_ngbs_density[pj->num_ngb_density] = parts_i[sort_i[ci_cache_idx + first_pi + bit_index].i].id;
               ++pj->num_ngb_density;
             }
@@ -1762,7 +1762,7 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci,
 #ifdef DEBUG_INTERACTIONS_SPH
         for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
           if (vec_is_mask_true(v_doi_mask) & (1 << bit_index)) {
-            if(pi->num_ngb_force < NUM_OF_NEIGHBOURS) {
+            if(pi->num_ngb_force < MAX_NUM_OF_NEIGHBOURS) {
               pi->ids_ngbs_force[pi->num_ngb_force] = parts_j[sort_j[pjd + bit_index].i].id;
               ++pi->num_ngb_force;
             }
@@ -1899,7 +1899,7 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci,
 #ifdef DEBUG_INTERACTIONS_SPH
         for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
           if (vec_is_mask_true(v_doj_mask) & (1 << bit_index)) {
-            if(pj->num_ngb_force < NUM_OF_NEIGHBOURS) {
+            if(pj->num_ngb_force < MAX_NUM_OF_NEIGHBOURS) {
               pj->ids_ngbs_force[pj->num_ngb_force] = parts_i[sort_i[ci_cache_idx + first_pi + bit_index].i].id;
               ++pj->num_ngb_force;
             }