From 4643566b2519e7f896bad4703df7760a0aa48c0f Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 1 Dec 2011 17:37:10 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@7267 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/input.cpp | 9 +-------- src/lammps.cpp | 14 ++++++++++++++ src/lammps.h | 1 + src/main.cpp | 8 -------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index 3af9062d05..714b6b5a60 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -509,14 +509,7 @@ void Input::clear() if (narg > 0) error->all(FLERR,"Illegal clear command"); lmp->destroy(); lmp->create(); - - // use of "omp" suffix implies using "package omp" - // re-create the effect of that package command which creates a fix - - if (lmp->suffix && lmp->suffix_enable) { - if (strcmp(lmp->suffix,"omp") == 0) - lmp->input->one("package omp *"); - } + lmp->post_create(); } /* ---------------------------------------------------------------------- */ diff --git a/src/lammps.cpp b/src/lammps.cpp index f316a03ad7..d29797b028 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -394,6 +394,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) // allocate top-level classes create(); + post_create(); // if helpflag set, print help and exit @@ -465,6 +466,19 @@ void LAMMPS::create() timer = new Timer(this); } +/* ---------------------------------------------------------------------- + invoke package-specific commands + called from LAMMPS instance constructor and after clear() command + only invoke if suffix is set and enabled +------------------------------------------------------------------------- */ + +void LAMMPS::post_create() +{ + if (suffix && suffix_enable) { + if (strcmp(suffix,"omp") == 0) input->one("package omp *"); + } +} + /* ---------------------------------------------------------------------- initialize top-level classes ------------------------------------------------------------------------- */ diff --git a/src/lammps.h b/src/lammps.h index af25717ee2..811e01b2a5 100644 --- a/src/lammps.h +++ b/src/lammps.h @@ -49,6 +49,7 @@ class LAMMPS { LAMMPS(int, char **, MPI_Comm); ~LAMMPS(); void create(); + void post_create(); void init(); void destroy(); diff --git a/src/main.cpp b/src/main.cpp index 0776e7e977..13b391e121 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,14 +27,6 @@ int main(int argc, char **argv) MPI_Init(&argc,&argv); LAMMPS *lammps = new LAMMPS(argc,argv,MPI_COMM_WORLD); - - // using /omp suffix implies running the "package omp" - // command with default settings. - if (lammps->suffix && lammps->suffix_enable) { - if (strcmp(lammps->suffix,"omp") == 0) - lammps->input->one("package omp *"); - } - lammps->input->file(); delete lammps;