From 28f112e9c0d24c59e830a910f99cf3a63dba04f4 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Wed, 14 Jul 2021 09:29:17 +0200
Subject: [PATCH] Print the correct counts for the number of DM particles to
 screen on start-up.

---
 examples/main.c     | 12 ++++++------
 examples/main_fof.c |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/examples/main.c b/examples/main.c
index 02ce01776e..532ae973d6 100644
--- a/examples/main.c
+++ b/examples/main.c
@@ -1215,26 +1215,27 @@ int main(int argc, char *argv[]) {
 #if defined(WITH_MPI)
     long long N_long[swift_type_count + 1] = {0};
     N_long[swift_type_gas] = Ngas;
-    N_long[swift_type_dark_matter] =
-        with_gravity ? Ngpart - Ngpart_background - Nbaryons : 0;
     N_long[swift_type_dark_matter_background] = Ngpart_background;
     N_long[swift_type_sink] = Nsink;
     N_long[swift_type_stars] = Nspart;
     N_long[swift_type_black_hole] = Nbpart;
     N_long[swift_type_neutrino] = Nnupart;
     N_long[swift_type_count] = Ngpart;
+    N_long[swift_type_dark_matter] =
+        with_gravity ? Ngpart - Ngpart_background - Nbaryons - Nnupart : 0;
+
     MPI_Allreduce(&N_long, &N_total, swift_type_count + 1, MPI_LONG_LONG_INT,
                   MPI_SUM, MPI_COMM_WORLD);
 #else
     N_total[swift_type_gas] = Ngas;
-    N_total[swift_type_dark_matter] =
-        with_gravity ? Ngpart - Ngpart_background - Nbaryons : 0;
     N_total[swift_type_dark_matter_background] = Ngpart_background;
     N_total[swift_type_sink] = Nsink;
     N_total[swift_type_stars] = Nspart;
     N_total[swift_type_black_hole] = Nbpart;
     N_total[swift_type_neutrino] = Nnupart;
     N_total[swift_type_count] = Ngpart;
+    N_total[swift_type_dark_matter] =
+        with_gravity ? Ngpart - Ngpart_background - Nbaryons - Nnupart : 0;
 #endif
 
     if (myrank == 0)
@@ -1431,8 +1432,7 @@ int main(int argc, char *argv[]) {
     /* Get some info to the user. */
     if (myrank == 0) {
       const long long N_DM = N_total[swift_type_dark_matter] +
-                             N_total[swift_type_dark_matter_background] +
-                             N_total[swift_type_neutrino];
+                             N_total[swift_type_dark_matter_background];
       message(
           "Running on %lld gas particles, %lld sink particles, %lld stars "
           "particles %lld black hole particles, %lld neutrino particles, and "
diff --git a/examples/main_fof.c b/examples/main_fof.c
index a3dcbcc1de..3d807da400 100644
--- a/examples/main_fof.c
+++ b/examples/main_fof.c
@@ -652,8 +652,8 @@ int main(int argc, char *argv[]) {
   /* Get some info to the user. */
   if (myrank == 0) {
     const long long N_DM = N_total[swift_type_dark_matter] +
-                           N_total[swift_type_dark_matter_background] +
-                           N_total[swift_type_neutrino];
+                           N_total[swift_type_dark_matter_background];
+
     message(
         "Running FOF on %lld gas particles, %lld sink particles, %lld stars "
         "particles %lld black hole particles, %lld neutrino particles, and "
-- 
GitLab