From 1891ff7c2420e91701e41c9f9556e2938170649e Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 16 Feb 2023 13:47:42 -0600 Subject: [PATCH] Updating batch number checks for simulation and sp load --- src/simulation.cpp | 2 +- src/state_point.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/simulation.cpp b/src/simulation.cpp index 2f07f8124f..7740c81d80 100644 --- a/src/simulation.cpp +++ b/src/simulation.cpp @@ -236,7 +236,7 @@ int openmc_next_batch(int* status) // Check simulation ending criteria if (status) { - if (simulation::current_batch == settings::n_max_batches) { + if (simulation::current_batch >= settings::n_max_batches) { *status = STATUS_EXIT_MAX_BATCH; } else if (simulation::satisfy_triggers) { *status = STATUS_EXIT_ON_TRIGGER; diff --git a/src/state_point.cpp b/src/state_point.cpp index 4170421bec..8ca0166c63 100644 --- a/src/state_point.cpp +++ b/src/state_point.cpp @@ -403,9 +403,10 @@ void load_state_point() // Read batch number to restart at read_dataset(file_id, "current_batch", simulation::restart_batch); - if (simulation::restart_batch > settings::n_batches) { - fatal_error("The number batches specified in settings.xml is fewer " - " than the number of batches in the given statepoint file."); + if (simulation::restart_batch >= settings::n_batches) { + fatal_error(fmt::format("The number of batches specified for simiulation ({}) is smaller" + " than the number of batches in the restart statepoint file ({})", + settings::n_batches, simulation::restart_batch)); } // Logical flag for source present in statepoint file