git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8099 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2012-05-18 22:45:56 +00:00
parent d99dd02a72
commit f35d71d798
3 changed files with 19 additions and 13 deletions

View File

@ -1199,9 +1199,7 @@ void Input::package()
fixarg[1] = (char *) "all";
fixarg[2] = (char *) "GPU";
for (int i = 1; i < narg; i++) fixarg[i+2] = arg[i];
modify->allow_early_fix = 1;
modify->add_fix(2+narg,fixarg,NULL);
modify->allow_early_fix = 0;
delete [] fixarg;
} else if (strcmp(arg[0],"omp") == 0) {
@ -1210,9 +1208,7 @@ void Input::package()
fixarg[1] = (char *) "all";
fixarg[2] = (char *) "OMP";
for (int i = 1; i < narg; i++) fixarg[i+2] = arg[i];
modify->allow_early_fix = 1;
modify->add_fix(2+narg,fixarg,NULL);
modify->allow_early_fix = 0;
delete [] fixarg;
} else error->all(FLERR,"Illegal package command");

View File

@ -30,9 +30,8 @@ using namespace LAMMPS_NS;
using namespace FixConst;
#define DELTA 4
#define BIG 1.0e20
#define NEXCEPT 3 // change when add to exceptions in add_fix()
/* ---------------------------------------------------------------------- */
@ -70,8 +69,6 @@ Modify::Modify(LAMMPS *lmp) : Pointers(lmp)
id_restart_peratom = style_restart_peratom = NULL;
index_restart_peratom = NULL;
allow_early_fix = 0;
ncompute = maxcompute = 0;
compute = NULL;
}
@ -216,7 +213,8 @@ void Modify::init()
int checkall;
MPI_Allreduce(&check,&checkall,1,MPI_INT,MPI_SUM,world);
if (comm->me == 0 && checkall)
error->warning(FLERR,"One or more atoms are time integrated more than once");
error->warning(FLERR,
"One or more atoms are time integrated more than once");
}
/* ----------------------------------------------------------------------
@ -570,10 +568,24 @@ int Modify::min_reset_ref()
void Modify::add_fix(int narg, char **arg, char *suffix)
{
if (domain->box_exist == 0 && allow_early_fix == 0)
error->all(FLERR,"Fix command before simulation box is defined");
const char *exceptions[NEXCEPT] = {"GPU","OMP","cmap"};
if (narg < 3) error->all(FLERR,"Illegal fix command");
// cannot define fix before box exists unless style is in exception list
// don't like this way of checking for exceptions by adding to list,
// but can't think of better way
// too late if instantiate fix, then check flag set in fix constructor,
// since some fixes access domain settings in their constructor
if (domain->box_exist == 0) {
int m;
for (m = 0; m < NEXCEPT; m++)
if (strcmp(arg[2],exceptions[m]) == 0) break;
if (m == NEXCEPT)
error->all(FLERR,"Fix command before simulation box is defined");
}
// check group ID
int igroup = group->find(arg[1]);

View File

@ -33,8 +33,6 @@ class Modify : protected Pointers {
int nfix_restart_global; // stored fix global info from restart file
int nfix_restart_peratom; // stored fix peratom info from restart file
int allow_early_fix; // 1 if allow fix creation at start of script
class Fix **fix; // list of fixes
int *fmask; // bit mask for when each fix is applied