Skip to content
Snippets Groups Projects
Commit c3661272 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

re-allow commands after an exception was caught inside a run.

after an exception "all bets are off",
i.e. the user should be allowed to do anything to recover.
through setting Update::whichflag to 0, the guard against running commands during a run is removed.
parent 5c21d2af
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <cstring> #include <cstring>
#include "error.h" #include "error.h"
#include "universe.h" #include "universe.h"
#include "update.h"
#include "output.h" #include "output.h"
#include "input.h" #include "input.h"
...@@ -69,6 +70,10 @@ void Error::universe_all(const char *file, int line, const char *str) ...@@ -69,6 +70,10 @@ void Error::universe_all(const char *file, int line, const char *str)
if (universe->ulogfile) fclose(universe->ulogfile); if (universe->ulogfile) fclose(universe->ulogfile);
#ifdef LAMMPS_EXCEPTIONS #ifdef LAMMPS_EXCEPTIONS
// allow commands if an exception was caught in a run
update->whichflag = 0;
char msg[100]; char msg[100];
sprintf(msg, "ERROR: %s (%s:%d)\n", str, file, line); sprintf(msg, "ERROR: %s (%s:%d)\n", str, file, line);
throw LAMMPSException(msg); throw LAMMPSException(msg);
...@@ -90,6 +95,10 @@ void Error::universe_one(const char *file, int line, const char *str) ...@@ -90,6 +95,10 @@ void Error::universe_one(const char *file, int line, const char *str)
universe->me,str,truncpath(file),line); universe->me,str,truncpath(file),line);
#ifdef LAMMPS_EXCEPTIONS #ifdef LAMMPS_EXCEPTIONS
// allow commands if an exception was caught in a run
update->whichflag = 0;
char msg[100]; char msg[100];
sprintf(msg, "ERROR: %s (%s:%d)\n", str, file, line); sprintf(msg, "ERROR: %s (%s:%d)\n", str, file, line);
throw LAMMPSAbortException(msg, universe->uworld); throw LAMMPSAbortException(msg, universe->uworld);
...@@ -137,6 +146,10 @@ void Error::all(const char *file, int line, const char *str) ...@@ -137,6 +146,10 @@ void Error::all(const char *file, int line, const char *str)
} }
#ifdef LAMMPS_EXCEPTIONS #ifdef LAMMPS_EXCEPTIONS
// allow commands if an exception was caught in a run
update->whichflag = 0;
char msg[100]; char msg[100];
sprintf(msg, "ERROR: %s (%s:%d)\n", str, file, line); sprintf(msg, "ERROR: %s (%s:%d)\n", str, file, line);
...@@ -183,6 +196,10 @@ void Error::one(const char *file, int line, const char *str) ...@@ -183,6 +196,10 @@ void Error::one(const char *file, int line, const char *str)
universe->me,str,truncpath(file),line); universe->me,str,truncpath(file),line);
#ifdef LAMMPS_EXCEPTIONS #ifdef LAMMPS_EXCEPTIONS
// allow commands if an exception was caught in a run
update->whichflag = 0;
char msg[100]; char msg[100];
sprintf(msg, "ERROR on proc %d: %s (%s:%d)\n", me, str, file, line); sprintf(msg, "ERROR on proc %d: %s (%s:%d)\n", me, str, file, line);
throw LAMMPSAbortException(msg, world); throw LAMMPSAbortException(msg, world);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment