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

This commit is contained in:
sjplimp
2014-09-10 19:39:31 +00:00
parent ea08246205
commit 58a11d6bc2
5 changed files with 51 additions and 11 deletions

View File

@ -108,17 +108,17 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) :
else if (strcmp(arg[iarg]+1,"hybrid") == 0) _gpu_mode = GPU_HYB_NEIGH;
else error->all(FLERR,"Illegal package gpu command");
iarg += 2;
} else if (strcmp(arg[iarg],"newton") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal package gpu command");
if (strcmp(arg[iarg]+1,"off") == 0) newtonflag = 0;
else if (strcmp(arg[iarg]+1,"on") == 0) newtonflag = 1;
else error->all(FLERR,"Illegal package gpu command");
} else if (strcmp(arg[iarg],"split") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal package gpu command");
_particle_split = force->numeric(FLERR,arg[iarg+1]);
if (_particle_split == 0.0 || _particle_split > 1.0)
error->all(FLERR,"Illegal package GPU command");
iarg += 2;
} else if (strcmp(arg[iarg],"newton") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal package gpu command");
if (strcmp(arg[iarg]+1,"off") == 0) newtonflag = 0;
else if (strcmp(arg[iarg]+1,"on") == 0) newtonflag = 1;
else error->all(FLERR,"Illegal package gpu command");
} else if (strcmp(arg[iarg],"gpuID") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal package gpu command");
first_gpu = force->inumeric(FLERR,arg[iarg+1]);

View File

@ -642,7 +642,7 @@ void Input::clear()
if (narg > 0) error->all(FLERR,"Illegal clear command");
lmp->destroy();
lmp->create();
lmp->post_create();
lmp->post_create(0,NULL,NULL,NULL);
}
/* ---------------------------------------------------------------------- */

View File

@ -92,6 +92,10 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
int wdfirst,wdlast;
int kkfirst,kklast;
int npack = 0;
int *pfirst = NULL;
int *plast = NULL;
int iarg = 1;
while (iarg < narg) {
if (strcmp(arg[iarg],"-partition") == 0 ||
@ -165,6 +169,22 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
kkfirst = iarg;
while (iarg < narg && arg[iarg][0] != '-') iarg++;
kklast = iarg;
} else if (strcmp(arg[iarg],"-package") == 0 ||
strcmp(arg[iarg],"-pk") == 0) {
if (iarg+2 > narg)
error->universe_all(FLERR,"Invalid command-line argument");
memory->grow(pfirst,npack+1,"lammps:pfirst");
memory->grow(plast,npack+1,"lammps:plast");
// delimit args for package command invocation
// any package arg with leading "-" will be followed by numeric digit
iarg++;
pfirst[npack] = iarg;
while (iarg < narg) {
if (arg[iarg][0] != '-') iarg++;
else if (isdigit(arg[iarg][1])) iarg++;
else break;
}
plast[npack++] = iarg;
} else if (strcmp(arg[iarg],"-suffix") == 0 ||
strcmp(arg[iarg],"-sf") == 0) {
if (iarg+2 > narg)
@ -480,7 +500,9 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
// allocate top-level classes
create();
post_create();
post_create(npack,pfirst,plast,arg);
memory->destroy(pfirst);
memory->destroy(plast);
// if helpflag set, print help and quit
@ -603,7 +625,7 @@ void LAMMPS::create()
so that package-specific core classes have been instantiated
------------------------------------------------------------------------- */
void LAMMPS::post_create()
void LAMMPS::post_create(int npack, int *pfirst, int *plast, char **arg)
{
// default package commands triggered by "-c on" and "-k on"
@ -644,6 +666,22 @@ void LAMMPS::post_create()
if (suffix2) {
if (strcmp(suffix,"omp") == 0) input->one("package omp 0");
}
// invoke any command-line package commands
if (npack) {
char str[128];
for (int i = 0; i < npack; i++) {
strcpy(str,"package");
for (int j = pfirst[i]; j < plast[i]; j++) {
if (strlen(str) + strlen(arg[j]) + 2 > 128)
error->all(FLERR,"Too many -pk arguments in command line");
strcat(str," ");
strcpy(str,arg[j]);
}
input->one(str);
}
}
}
/* ----------------------------------------------------------------------
@ -705,14 +743,16 @@ void LAMMPS::help()
"\nCommand line options:\n\n"
"-cuda on/off : turn CUDA mode on or off (-c)\n"
"-echo none/screen/log/both : echoing of input script (-e)\n"
"-in filename : read input from file, not stdin (-i)\n"
"-help : print this help message (-h)\n"
"-in filename : read input from file, not stdin (-i)\n"
"-kokkos on/off ... : turn KOKKOS mode on or off (-k)\n"
"-log none/filename : where to send log output (-l)\n"
"-nocite : disable writing log.cite file (-nc)\n"
"-package style ... : invoke package command (-pk)\n"
"-partition size1 size2 ... : assign partition sizes (-p)\n"
"-plog basename : basename for partition logs (-pl)\n"
"-pscreen basename : basename for partition screens (-ps)\n"
"-restart rfile dfile ... : convert restart to data file (-r)\n"
"-reorder topology-specs : processor reordering (-r)\n"
"-screen none/filename : where to send screen output (-sc)\n"
"-suffix cuda/gpu/opt/omp : style suffix to apply (-sf)\n"

View File

@ -54,7 +54,7 @@ class LAMMPS {
LAMMPS(int, char **, MPI_Comm);
~LAMMPS();
void create();
void post_create();
void post_create(int, int *, int *, char **);
void init();
void destroy();

View File

@ -661,7 +661,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix)
// MUST change NEXCEPT above when add new fix to this list
const char *exceptions[NEXCEPT] =
{"GPU","OMP","Intel","property/atom","cmap"};
{"GPU","OMP","INTEL","property/atom","cmap"};
if (domain->box_exist == 0) {
int m;