From 832e9f4e79fccc9da4aa98d1323c54df8707b409 Mon Sep 17 00:00:00 2001
From: Volker Springel <vspringel@mpa-garching.mpg.de>
Date: Wed, 12 May 2021 14:01:59 +0200
Subject: [PATCH] in case an out of sequence snapshot at the final time is
 produced, make sure that also the group finder is run if enabled

---
 src/main/run.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/run.cc b/src/main/run.cc
index f99e806..70ebf39 100644
--- a/src/main/run.cc
+++ b/src/main/run.cc
@@ -172,11 +172,11 @@ void sim::run(void)
         {
           mpi_printf("\nFinal time=%g reached. Simulation ends.\n", All.TimeMax);
 
-          if(All.Ti_lastoutput != All.Ti_Current) /* make a snapshot at the final time in case none has been produced at this time */
+          /* make a snapshot at the final time in case none has been produced at this time yet */
+          if(All.Ti_lastoutput != All.Ti_Current)
             {
-              snap_io Snap(&Sp, Communicator, All.SnapFormat); /* get an I/O object */
-              /* this snapshot will be overwritten if All.TimeMax is increased and the run is continued */
-              Snap.write_snapshot(All.SnapshotFileCount++, NORMAL_SNAPSHOT);
+              All.Ti_nextoutput = All.Ti_Current;
+              create_snapshot_if_desired();
             }
 
           break;
-- 
GitLab