From 78d705edb7a6b99ed1e9c8b7de6aa2a8924d9e46 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Thu, 18 Jun 2020 22:35:22 +0100
Subject: [PATCH] Do not write particles that have no fields in parallel_io.c

---
 src/parallel_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/parallel_io.c b/src/parallel_io.c
index 9ca4a6eaf4..7b19ed7e18 100644
--- a/src/parallel_io.c
+++ b/src/parallel_io.c
@@ -1524,7 +1524,7 @@ void write_output_parallel(struct engine* e,
   for (int ptype = 0; ptype < swift_type_count; ptype++) {
 
     /* Don't do anything if no particle of this kind */
-    if (N_total[ptype] == 0) continue;
+    if (N_total[ptype] == 0 || numFields[ptype] == 0) continue;
 
     /* Open the particle group in the file */
     char partTypeGroupName[PARTICLE_GROUP_BUFFER_SIZE];
-- 
GitLab