diff --git a/src/library.cpp b/src/library.cpp index 8f87d6fab240944bd523b5891b3279d41e204646..0544aa5a4a3538143cc7b7a8ec436b25f66d3964 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -203,7 +203,10 @@ void lammps_file(void *ptr, char *str) BEGIN_CAPTURE { - lmp->input->file(str); + if (lmp->update->whichflag != 0) + lmp->error->all(FLERR,"Library error: issuing LAMMPS command during run"); + else + lmp->input->file(str); } END_CAPTURE } @@ -221,7 +224,10 @@ char *lammps_command(void *ptr, char *str) BEGIN_CAPTURE { - result = lmp->input->one(str); + if (lmp->update->whichflag != 0) + lmp->error->all(FLERR,"Library error: issuing LAMMPS command during run"); + else + result = lmp->input->one(str); } END_CAPTURE @@ -270,6 +276,13 @@ void lammps_commands_string(void *ptr, char *str) { LAMMPS *lmp = (LAMMPS *) ptr; + BEGIN_CAPTURE + { + if (lmp->update->whichflag != 0) + lmp->error->all(FLERR,"Library error: issuing LAMMPS command during run"); + } + END_CAPTURE + // make copy of str so can strtok() it int n = strlen(str) + 1;