replace 'strstr(xxx,"x_") == xxx' with utils::strmatch("^x_")
This commit is contained in:
@ -59,7 +59,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) :
|
||||
qe2f = force->qe2f;
|
||||
xstr = ystr = zstr = nullptr;
|
||||
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
xstr = new char[n];
|
||||
strcpy(xstr,&arg[3][2]);
|
||||
@ -68,7 +68,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) :
|
||||
xstyle = CONSTANT;
|
||||
}
|
||||
|
||||
if (strstr(arg[4],"v_") == arg[4]) {
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(&arg[4][2]) + 1;
|
||||
ystr = new char[n];
|
||||
strcpy(ystr,&arg[4][2]);
|
||||
@ -77,7 +77,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) :
|
||||
ystyle = CONSTANT;
|
||||
}
|
||||
|
||||
if (strstr(arg[5],"v_") == arg[5]) {
|
||||
if (utils::strmatch(arg[5],"^v_")) {
|
||||
int n = strlen(&arg[5][2]) + 1;
|
||||
zstr = new char[n];
|
||||
strcpy(zstr,&arg[5][2]);
|
||||
@ -105,7 +105,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) :
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"energy") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix efield command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) {
|
||||
int n = strlen(&arg[iarg+1][2]) + 1;
|
||||
estr = new char[n];
|
||||
strcpy(estr,&arg[iarg+1][2]);
|
||||
|
||||
@ -450,7 +450,7 @@ int PythonImpl::create_entry(char *name)
|
||||
char type = format[i];
|
||||
if (type == 'i') {
|
||||
pfuncs[ifunc].itype[i] = INT;
|
||||
if (strstr(istr[i],"v_") == istr[i]) {
|
||||
if (utils::strmatch(istr[i],"^v_")) {
|
||||
pfuncs[ifunc].ivarflag[i] = 1;
|
||||
int n = strlen(&istr[i][2]) + 1;
|
||||
pfuncs[ifunc].svalue[i] = new char[n];
|
||||
@ -461,7 +461,7 @@ int PythonImpl::create_entry(char *name)
|
||||
}
|
||||
} else if (type == 'f') {
|
||||
pfuncs[ifunc].itype[i] = DOUBLE;
|
||||
if (strstr(istr[i],"v_") == istr[i]) {
|
||||
if (utils::strmatch(istr[i],"^v_")) {
|
||||
pfuncs[ifunc].ivarflag[i] = 1;
|
||||
int n = strlen(&istr[i][2]) + 1;
|
||||
pfuncs[ifunc].svalue[i] = new char[n];
|
||||
@ -472,7 +472,7 @@ int PythonImpl::create_entry(char *name)
|
||||
}
|
||||
} else if (type == 's') {
|
||||
pfuncs[ifunc].itype[i] = STRING;
|
||||
if (strstr(istr[i],"v_") == istr[i]) {
|
||||
if (utils::strmatch(istr[i],"^v_")) {
|
||||
pfuncs[ifunc].ivarflag[i] = 1;
|
||||
int n = strlen(&istr[i][2]) + 1;
|
||||
pfuncs[ifunc].svalue[i] = new char[n];
|
||||
|
||||
@ -129,7 +129,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
// determine whether atom-style variable or atom property is used
|
||||
|
||||
if (strstr(arg[4],"i_") == arg[4]) {
|
||||
if (utils::strmatch(arg[4],"^i_")) {
|
||||
int is_double=0;
|
||||
int custom_index = atom->find_custom(arg[4]+2,is_double);
|
||||
if (custom_index == -1)
|
||||
@ -151,7 +151,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
|
||||
else
|
||||
molecule[i] = 0;
|
||||
|
||||
} else if (strstr(arg[4],"v_") == arg[4]) {
|
||||
} else if (utils::strmatch(arg[4],"^v_")) {
|
||||
int ivariable = input->variable->find(arg[4]+2);
|
||||
if (ivariable < 0)
|
||||
error->all(FLERR,"Variable name for fix rigid custom does not exist");
|
||||
|
||||
@ -113,7 +113,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
// determine whether atom-style variable or atom property is used
|
||||
|
||||
if (strstr(arg[4],"i_") == arg[4]) {
|
||||
if (utils::strmatch(arg[4],"^i_")) {
|
||||
int is_double=0;
|
||||
int custom_index = atom->find_custom(arg[4]+2,is_double);
|
||||
if (custom_index == -1)
|
||||
@ -135,7 +135,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
|
||||
bodyID[i] = (tagint)(value[i] - minval + 1);
|
||||
else bodyID[i] = 0;
|
||||
|
||||
} else if (strstr(arg[4],"v_") == arg[4]) {
|
||||
} else if (utils::strmatch(arg[4],"^v_")) {
|
||||
int ivariable = input->variable->find(arg[4]+2);
|
||||
if (ivariable < 0)
|
||||
error->all(FLERR,"Variable name for fix rigid/small custom "
|
||||
|
||||
@ -69,7 +69,7 @@ FixWallSRD::FixWallSRD(LAMMPS *lmp, int narg, char **arg) :
|
||||
int side = wallwhich[nwall] % 2;
|
||||
if (side == 0) coord0[nwall] = domain->boxlo[dim];
|
||||
else coord0[nwall] = domain->boxhi[dim];
|
||||
} else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||
} else if (utils::strmatch(arg[iarg+1],"^v_")) {
|
||||
wallstyle[nwall] = VARIABLE;
|
||||
int n = strlen(&arg[iarg+1][2]) + 1;
|
||||
varstr[nwall] = new char[n];
|
||||
|
||||
@ -49,7 +49,7 @@ FixLangevinDrude::FixLangevinDrude(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
// core temperature
|
||||
tstr_core = nullptr;
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
tstr_core = new char[n];
|
||||
strcpy(tstr_core,&arg[3][2]);
|
||||
|
||||
@ -99,7 +99,7 @@ ComputeFEP::ComputeFEP(LAMMPS *lmp, int narg, char **arg) :
|
||||
perturb[npert].ilo,perturb[npert].ihi,error);
|
||||
utils::bounds(FLERR,arg[iarg+4],1,atom->ntypes,
|
||||
perturb[npert].jlo,perturb[npert].jhi,error);
|
||||
if (strstr(arg[iarg+5],"v_") == arg[iarg+5]) {
|
||||
if (utils::strmatch(arg[iarg+5],"^v_")) {
|
||||
n = strlen(&arg[iarg+5][2]) + 1;
|
||||
perturb[npert].var = new char[n];
|
||||
strcpy(perturb[npert].var,&arg[iarg+5][2]);
|
||||
@ -114,7 +114,7 @@ ComputeFEP::ComputeFEP(LAMMPS *lmp, int narg, char **arg) :
|
||||
} else error->all(FLERR,"Illegal atom argument in compute fep");
|
||||
utils::bounds(FLERR,arg[iarg+2],1,atom->ntypes,
|
||||
perturb[npert].ilo,perturb[npert].ihi,error);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) {
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) {
|
||||
int n = strlen(&arg[iarg+3][2]) + 1;
|
||||
perturb[npert].var = new char[n];
|
||||
strcpy(perturb[npert].var,&arg[iarg+3][2]);
|
||||
|
||||
@ -98,7 +98,7 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) :
|
||||
adapt[nadapt].ilo,adapt[nadapt].ihi,error);
|
||||
utils::bounds(FLERR,arg[iarg+4],1,atom->ntypes,
|
||||
adapt[nadapt].jlo,adapt[nadapt].jhi,error);
|
||||
if (strstr(arg[iarg+5],"v_") == arg[iarg+5]) {
|
||||
if (utils::strmatch(arg[iarg+5],"^v_")) {
|
||||
n = strlen(&arg[iarg+5][2]) + 1;
|
||||
adapt[nadapt].var = new char[n];
|
||||
strcpy(adapt[nadapt].var,&arg[iarg+5][2]);
|
||||
@ -108,7 +108,7 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) :
|
||||
} else if (strcmp(arg[iarg],"kspace") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix adapt/fep command");
|
||||
adapt[nadapt].which = KSPACE;
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) {
|
||||
int n = strlen(&arg[iarg+1][2]) + 1;
|
||||
adapt[nadapt].var = new char[n];
|
||||
strcpy(adapt[nadapt].var,&arg[iarg+1][2]);
|
||||
@ -127,7 +127,7 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) :
|
||||
} else error->all(FLERR,"Illegal fix adapt/fep command");
|
||||
utils::bounds(FLERR,arg[iarg+2],1,atom->ntypes,
|
||||
adapt[nadapt].ilo,adapt[nadapt].ihi,error);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) {
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) {
|
||||
int n = strlen(&arg[iarg+3][2]) + 1;
|
||||
adapt[nadapt].var = new char[n];
|
||||
strcpy(adapt[nadapt].var,&arg[iarg+3][2]);
|
||||
|
||||
@ -53,7 +53,7 @@ FixAddTorque::FixAddTorque(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
xstr = ystr = zstr = nullptr;
|
||||
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
xstr = new char[n];
|
||||
strcpy(xstr,&arg[3][2]);
|
||||
@ -61,7 +61,7 @@ FixAddTorque::FixAddTorque(LAMMPS *lmp, int narg, char **arg) :
|
||||
xvalue = utils::numeric(FLERR,arg[3],false,lmp);
|
||||
xstyle = CONSTANT;
|
||||
}
|
||||
if (strstr(arg[4],"v_") == arg[4]) {
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(&arg[4][2]) + 1;
|
||||
ystr = new char[n];
|
||||
strcpy(ystr,&arg[4][2]);
|
||||
@ -69,7 +69,7 @@ FixAddTorque::FixAddTorque(LAMMPS *lmp, int narg, char **arg) :
|
||||
yvalue = utils::numeric(FLERR,arg[4],false,lmp);
|
||||
ystyle = CONSTANT;
|
||||
}
|
||||
if (strstr(arg[5],"v_") == arg[5]) {
|
||||
if (utils::strmatch(arg[5],"^v_")) {
|
||||
int n = strlen(&arg[5][2]) + 1;
|
||||
zstr = new char[n];
|
||||
strcpy(zstr,&arg[5][2]);
|
||||
|
||||
@ -127,37 +127,37 @@ FixMesoMove::FixMesoMove (LAMMPS *lmp, int narg, char **arg) :
|
||||
iarg = 10;
|
||||
mstyle = VARIABLE;
|
||||
if (strcmp(arg[4],"NULL") == 0) xvarstr = nullptr;
|
||||
else if (strstr(arg[4],"v_") == arg[4]) {
|
||||
else if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(&arg[4][2]) + 1;
|
||||
xvarstr = new char[n];
|
||||
strcpy(xvarstr,&arg[4][2]);
|
||||
} else error->all(FLERR,"Illegal fix meso/move command");
|
||||
if (strcmp(arg[5],"NULL") == 0) yvarstr = nullptr;
|
||||
else if (strstr(arg[5],"v_") == arg[5]) {
|
||||
else if (utils::strmatch(arg[5],"^v_")) {
|
||||
int n = strlen(&arg[5][2]) + 1;
|
||||
yvarstr = new char[n];
|
||||
strcpy(yvarstr,&arg[5][2]);
|
||||
} else error->all(FLERR,"Illegal fix meso/move command");
|
||||
if (strcmp(arg[6],"NULL") == 0) zvarstr = nullptr;
|
||||
else if (strstr(arg[6],"v_") == arg[6]) {
|
||||
else if (utils::strmatch(arg[6],"^v_")) {
|
||||
int n = strlen(&arg[6][2]) + 1;
|
||||
zvarstr = new char[n];
|
||||
strcpy(zvarstr,&arg[6][2]);
|
||||
} else error->all(FLERR,"Illegal fix meso/move command");
|
||||
if (strcmp(arg[7],"NULL") == 0) vxvarstr = nullptr;
|
||||
else if (strstr(arg[7],"v_") == arg[7]) {
|
||||
else if (utils::strmatch(arg[7],"^v_")) {
|
||||
int n = strlen(&arg[7][2]) + 1;
|
||||
vxvarstr = new char[n];
|
||||
strcpy(vxvarstr,&arg[7][2]);
|
||||
} else error->all(FLERR,"Illegal fix meso/move command");
|
||||
if (strcmp(arg[8],"NULL") == 0) vyvarstr = nullptr;
|
||||
else if (strstr(arg[8],"v_") == arg[8]) {
|
||||
else if (utils::strmatch(arg[8],"^v_")) {
|
||||
int n = strlen(&arg[8][2]) + 1;
|
||||
vyvarstr = new char[n];
|
||||
strcpy(vyvarstr,&arg[8][2]);
|
||||
} else error->all(FLERR,"Illegal fix meso/move command");
|
||||
if (strcmp(arg[9],"NULL") == 0) vzvarstr = nullptr;
|
||||
else if (strstr(arg[9],"v_") == arg[9]) {
|
||||
else if (utils::strmatch(arg[9],"^v_")) {
|
||||
int n = strlen(&arg[9][2]) + 1;
|
||||
vzvarstr = new char[n];
|
||||
strcpy(vzvarstr,&arg[9][2]);
|
||||
|
||||
@ -361,14 +361,14 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
"atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_nbonds;
|
||||
|
||||
} else if (strstr(arg[iarg],"i_") == arg[iarg]) {
|
||||
} else if (utils::strmatch(arg[iarg],"^i_")) {
|
||||
int flag;
|
||||
index[i] = atom->find_custom(&arg[iarg][2],flag);
|
||||
if (index[i] < 0 || flag != 0)
|
||||
error->all(FLERR,"Compute property/atom integer "
|
||||
"vector does not exist");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_iname;
|
||||
} else if (strstr(arg[iarg],"d_") == arg[iarg]) {
|
||||
} else if (utils::strmatch(arg[iarg],"^d_")) {
|
||||
int flag;
|
||||
index[i] = atom->find_custom(&arg[iarg][2],flag);
|
||||
if (index[i] < 0 || flag != 1)
|
||||
|
||||
@ -225,7 +225,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
} else if (strcmp(arg[iarg],"view") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) {
|
||||
int n = strlen(&arg[iarg+1][2]) + 1;
|
||||
thetastr = new char[n];
|
||||
strcpy(thetastr,&arg[iarg+1][2]);
|
||||
@ -236,7 +236,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
|
||||
theta *= MY_PI/180.0;
|
||||
image->theta = theta;
|
||||
}
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) {
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) {
|
||||
int n = strlen(&arg[iarg+2][2]) + 1;
|
||||
phistr = new char[n];
|
||||
strcpy(phistr,&arg[iarg+2][2]);
|
||||
@ -252,19 +252,19 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
|
||||
if (strcmp(arg[iarg+1],"s") == 0) cflag = STATIC;
|
||||
else if (strcmp(arg[iarg+1],"d") == 0) cflag = DYNAMIC;
|
||||
else error->all(FLERR,"Illegal dump image command");
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) {
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) {
|
||||
int n = strlen(&arg[iarg+2][2]) + 1;
|
||||
cxstr = new char[n];
|
||||
strcpy(cxstr,&arg[iarg+2][2]);
|
||||
cflag = DYNAMIC;
|
||||
} else cx = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) {
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) {
|
||||
int n = strlen(&arg[iarg+3][2]) + 1;
|
||||
cystr = new char[n];
|
||||
strcpy(cystr,&arg[iarg+3][2]);
|
||||
cflag = DYNAMIC;
|
||||
} else cy = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) {
|
||||
if (utils::strmatch(arg[iarg+4],"^v_")) {
|
||||
int n = strlen(&arg[iarg+4][2]) + 1;
|
||||
czstr = new char[n];
|
||||
strcpy(czstr,&arg[iarg+4][2]);
|
||||
@ -274,17 +274,17 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
} else if (strcmp(arg[iarg],"up") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal dump image command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) {
|
||||
int n = strlen(&arg[iarg+1][2]) + 1;
|
||||
upxstr = new char[n];
|
||||
strcpy(upxstr,&arg[iarg+1][2]);
|
||||
} else image->up[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) {
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) {
|
||||
int n = strlen(&arg[iarg+2][2]) + 1;
|
||||
upystr = new char[n];
|
||||
strcpy(upystr,&arg[iarg+2][2]);
|
||||
} else image->up[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) {
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) {
|
||||
int n = strlen(&arg[iarg+3][2]) + 1;
|
||||
upzstr = new char[n];
|
||||
strcpy(upzstr,&arg[iarg+3][2]);
|
||||
@ -293,7 +293,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
} else if (strcmp(arg[iarg],"zoom") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal dump image command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) {
|
||||
int n = strlen(&arg[iarg+1][2]) + 1;
|
||||
zoomstr = new char[n];
|
||||
strcpy(zoomstr,&arg[iarg+1][2]);
|
||||
|
||||
@ -102,7 +102,7 @@ nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr)
|
||||
adapt[nadapt].ilo,adapt[nadapt].ihi,error);
|
||||
utils::bounds(FLERR,arg[iarg+4],1,atom->ntypes,
|
||||
adapt[nadapt].jlo,adapt[nadapt].jhi,error);
|
||||
if (strstr(arg[iarg+5],"v_") == arg[iarg+5]) {
|
||||
if (utils::strmatch(arg[iarg+5],"^v_")) {
|
||||
n = strlen(&arg[iarg+5][2]) + 1;
|
||||
adapt[nadapt].var = new char[n];
|
||||
strcpy(adapt[nadapt].var,&arg[iarg+5][2]);
|
||||
@ -122,7 +122,7 @@ nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr)
|
||||
strcpy(adapt[nadapt].bparam,arg[iarg+2]);
|
||||
utils::bounds(FLERR,arg[iarg+3],1,atom->nbondtypes,
|
||||
adapt[nadapt].ilo,adapt[nadapt].ihi,error);
|
||||
if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) {
|
||||
if (utils::strmatch(arg[iarg+4],"^v_")) {
|
||||
n = strlen(&arg[iarg+4][2]) + 1;
|
||||
adapt[nadapt].var = new char[n];
|
||||
strcpy(adapt[nadapt].var,&arg[iarg+4][2]);
|
||||
@ -133,7 +133,7 @@ nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr)
|
||||
} else if (strcmp(arg[iarg],"kspace") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix adapt command");
|
||||
adapt[nadapt].which = KSPACE;
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) {
|
||||
int n = strlen(&arg[iarg+1][2]) + 1;
|
||||
adapt[nadapt].var = new char[n];
|
||||
strcpy(adapt[nadapt].var,&arg[iarg+1][2]);
|
||||
@ -154,7 +154,7 @@ nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr)
|
||||
adapt[nadapt].aparam = CHARGE;
|
||||
chgflag = 1;
|
||||
} else error->all(FLERR,"Illegal fix adapt command");
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) {
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) {
|
||||
int n = strlen(&arg[iarg+2][2]) + 1;
|
||||
adapt[nadapt].var = new char[n];
|
||||
strcpy(adapt[nadapt].var,&arg[iarg+2][2]);
|
||||
|
||||
@ -54,7 +54,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
xstr = ystr = zstr = nullptr;
|
||||
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
xstr = new char[n];
|
||||
strcpy(xstr,&arg[3][2]);
|
||||
@ -62,7 +62,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
xvalue = utils::numeric(FLERR,arg[3],false,lmp);
|
||||
xstyle = CONSTANT;
|
||||
}
|
||||
if (strstr(arg[4],"v_") == arg[4]) {
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(&arg[4][2]) + 1;
|
||||
ystr = new char[n];
|
||||
strcpy(ystr,&arg[4][2]);
|
||||
@ -70,7 +70,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
yvalue = utils::numeric(FLERR,arg[4],false,lmp);
|
||||
ystyle = CONSTANT;
|
||||
}
|
||||
if (strstr(arg[5],"v_") == arg[5]) {
|
||||
if (utils::strmatch(arg[5],"^v_")) {
|
||||
int n = strlen(&arg[5][2]) + 1;
|
||||
zstr = new char[n];
|
||||
strcpy(zstr,&arg[5][2]);
|
||||
@ -102,7 +102,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"energy") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix addforce command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) {
|
||||
int n = strlen(&arg[iarg+1][2]) + 1;
|
||||
estr = new char[n];
|
||||
strcpy(estr,&arg[iarg+1][2]);
|
||||
|
||||
@ -48,7 +48,7 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
xstr = ystr = zstr = nullptr;
|
||||
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
xstr = new char[n];
|
||||
strcpy(xstr,&arg[3][2]);
|
||||
@ -58,7 +58,7 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
xvalue = utils::numeric(FLERR,arg[3],false,lmp);
|
||||
xstyle = CONSTANT;
|
||||
}
|
||||
if (strstr(arg[4],"v_") == arg[4]) {
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(&arg[4][2]) + 1;
|
||||
ystr = new char[n];
|
||||
strcpy(ystr,&arg[4][2]);
|
||||
@ -68,7 +68,7 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
yvalue = utils::numeric(FLERR,arg[4],false,lmp);
|
||||
ystyle = CONSTANT;
|
||||
}
|
||||
if (strstr(arg[5],"v_") == arg[5]) {
|
||||
if (utils::strmatch(arg[5],"^v_")) {
|
||||
int n = strlen(&arg[5][2]) + 1;
|
||||
zstr = new char[n];
|
||||
strcpy(zstr,&arg[5][2]);
|
||||
|
||||
@ -52,7 +52,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) :
|
||||
mstr = vstr = pstr = tstr = xstr = ystr = zstr = nullptr;
|
||||
mstyle = vstyle = pstyle = tstyle = xstyle = ystyle = zstyle = CONSTANT;
|
||||
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
mstr = new char[n];
|
||||
strcpy(mstr,&arg[3][2]);
|
||||
@ -67,7 +67,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) :
|
||||
if (strcmp(arg[4],"chute") == 0) {
|
||||
if (narg < 6) error->all(FLERR,"Illegal fix gravity command");
|
||||
style = CHUTE;
|
||||
if (strstr(arg[5],"v_") == arg[5]) {
|
||||
if (utils::strmatch(arg[5],"^v_")) {
|
||||
int n = strlen(&arg[5][2]) + 1;
|
||||
vstr = new char[n];
|
||||
strcpy(vstr,&arg[5][2]);
|
||||
@ -81,7 +81,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) :
|
||||
} else if (strcmp(arg[4],"spherical") == 0) {
|
||||
if (narg < 7) error->all(FLERR,"Illegal fix gravity command");
|
||||
style = SPHERICAL;
|
||||
if (strstr(arg[5],"v_") == arg[5]) {
|
||||
if (utils::strmatch(arg[5],"^v_")) {
|
||||
int n = strlen(&arg[5][2]) + 1;
|
||||
pstr = new char[n];
|
||||
strcpy(pstr,&arg[5][2]);
|
||||
@ -90,7 +90,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) :
|
||||
phi = utils::numeric(FLERR,arg[5],false,lmp);
|
||||
pstyle = CONSTANT;
|
||||
}
|
||||
if (strstr(arg[6],"v_") == arg[6]) {
|
||||
if (utils::strmatch(arg[6],"^v_")) {
|
||||
int n = strlen(&arg[6][2]) + 1;
|
||||
tstr = new char[n];
|
||||
strcpy(tstr,&arg[6][2]);
|
||||
@ -104,7 +104,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) :
|
||||
} else if (strcmp(arg[4],"vector") == 0) {
|
||||
if (narg < 8) error->all(FLERR,"Illegal fix gravity command");
|
||||
style = VECTOR;
|
||||
if (strstr(arg[5],"v_") == arg[5]) {
|
||||
if (utils::strmatch(arg[5],"^v_")) {
|
||||
int n = strlen(&arg[5][2]) + 1;
|
||||
xstr = new char[n];
|
||||
strcpy(xstr,&arg[5][2]);
|
||||
@ -113,7 +113,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) :
|
||||
xdir = utils::numeric(FLERR,arg[5],false,lmp);
|
||||
xstyle = CONSTANT;
|
||||
}
|
||||
if (strstr(arg[6],"v_") == arg[6]) {
|
||||
if (utils::strmatch(arg[6],"^v_")) {
|
||||
int n = strlen(&arg[6][2]) + 1;
|
||||
ystr = new char[n];
|
||||
strcpy(ystr,&arg[6][2]);
|
||||
@ -122,7 +122,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) :
|
||||
ydir = utils::numeric(FLERR,arg[6],false,lmp);
|
||||
ystyle = CONSTANT;
|
||||
}
|
||||
if (strstr(arg[7],"v_") == arg[7]) {
|
||||
if (utils::strmatch(arg[7],"^v_")) {
|
||||
int n = strlen(&arg[7][2]) + 1;
|
||||
zstr = new char[n];
|
||||
strcpy(zstr,&arg[7][2]);
|
||||
|
||||
@ -52,7 +52,7 @@ idregion(nullptr), hstr(nullptr), vheat(nullptr), vscale(nullptr)
|
||||
|
||||
hstr = nullptr;
|
||||
|
||||
if (strstr(arg[4],"v_") == arg[4]) {
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(&arg[4][2]) + 1;
|
||||
hstr = new char[n];
|
||||
strcpy(hstr,&arg[4][2]);
|
||||
|
||||
@ -417,22 +417,22 @@ void FixIndent::options(int narg, char **arg)
|
||||
if (strcmp(arg[iarg],"sphere") == 0) {
|
||||
if (iarg+5 > narg) error->all(FLERR,"Illegal fix indent command");
|
||||
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) {
|
||||
int n = strlen(&arg[iarg+1][2]) + 1;
|
||||
xstr = new char[n];
|
||||
strcpy(xstr,&arg[iarg+1][2]);
|
||||
} else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) {
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) {
|
||||
int n = strlen(&arg[iarg+2][2]) + 1;
|
||||
ystr = new char[n];
|
||||
strcpy(ystr,&arg[iarg+2][2]);
|
||||
} else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) {
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) {
|
||||
int n = strlen(&arg[iarg+3][2]) + 1;
|
||||
zstr = new char[n];
|
||||
strcpy(zstr,&arg[iarg+3][2]);
|
||||
} else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) {
|
||||
if (utils::strmatch(arg[iarg+4],"^v_")) {
|
||||
int n = strlen(&arg[iarg+4][2]) + 1;
|
||||
rstr = new char[n];
|
||||
strcpy(rstr,&arg[iarg+4][2]);
|
||||
@ -446,43 +446,43 @@ void FixIndent::options(int narg, char **arg)
|
||||
|
||||
if (strcmp(arg[iarg+1],"x") == 0) {
|
||||
cdim = 0;
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) {
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) {
|
||||
int n = strlen(&arg[iarg+2][2]) + 1;
|
||||
ystr = new char[n];
|
||||
strcpy(ystr,&arg[iarg+2][2]);
|
||||
} else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) {
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) {
|
||||
int n = strlen(&arg[iarg+3][2]) + 1;
|
||||
zstr = new char[n];
|
||||
strcpy(zstr,&arg[iarg+3][2]);
|
||||
} else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
} else if (strcmp(arg[iarg+1],"y") == 0) {
|
||||
cdim = 1;
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) {
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) {
|
||||
int n = strlen(&arg[iarg+2][2]) + 1;
|
||||
xstr = new char[n];
|
||||
strcpy(xstr,&arg[iarg+2][2]);
|
||||
} else xvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) {
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) {
|
||||
int n = strlen(&arg[iarg+3][2]) + 1;
|
||||
zstr = new char[n];
|
||||
strcpy(zstr,&arg[iarg+3][2]);
|
||||
} else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
} else if (strcmp(arg[iarg+1],"z") == 0) {
|
||||
cdim = 2;
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) {
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) {
|
||||
int n = strlen(&arg[iarg+2][2]) + 1;
|
||||
xstr = new char[n];
|
||||
strcpy(xstr,&arg[iarg+2][2]);
|
||||
} else xvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) {
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) {
|
||||
int n = strlen(&arg[iarg+3][2]) + 1;
|
||||
ystr = new char[n];
|
||||
strcpy(ystr,&arg[iarg+3][2]);
|
||||
} else yvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
} else error->all(FLERR,"Illegal fix indent command");
|
||||
|
||||
if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) {
|
||||
if (utils::strmatch(arg[iarg+4],"^v_")) {
|
||||
int n = strlen(&arg[iarg+4][2]) + 1;
|
||||
rstr = new char[n];
|
||||
strcpy(rstr,&arg[iarg+4][2]);
|
||||
@ -498,7 +498,7 @@ void FixIndent::options(int narg, char **arg)
|
||||
else if (strcmp(arg[iarg+1],"z") == 0) cdim = 2;
|
||||
else error->all(FLERR,"Illegal fix indent command");
|
||||
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) {
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) {
|
||||
int n = strlen(&arg[iarg+2][2]) + 1;
|
||||
pstr = new char[n];
|
||||
strcpy(pstr,&arg[iarg+2][2]);
|
||||
|
||||
@ -64,7 +64,7 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) :
|
||||
extscalar = 1;
|
||||
nevery = 1;
|
||||
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
tstr = new char[n];
|
||||
strcpy(tstr,&arg[3][2]);
|
||||
|
||||
@ -128,37 +128,37 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) :
|
||||
iarg = 10;
|
||||
mstyle = VARIABLE;
|
||||
if (strcmp(arg[4],"NULL") == 0) xvarstr = nullptr;
|
||||
else if (strstr(arg[4],"v_") == arg[4]) {
|
||||
else if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(&arg[4][2]) + 1;
|
||||
xvarstr = new char[n];
|
||||
strcpy(xvarstr,&arg[4][2]);
|
||||
} else error->all(FLERR,"Illegal fix move command");
|
||||
if (strcmp(arg[5],"NULL") == 0) yvarstr = nullptr;
|
||||
else if (strstr(arg[5],"v_") == arg[5]) {
|
||||
else if (utils::strmatch(arg[5],"^v_")) {
|
||||
int n = strlen(&arg[5][2]) + 1;
|
||||
yvarstr = new char[n];
|
||||
strcpy(yvarstr,&arg[5][2]);
|
||||
} else error->all(FLERR,"Illegal fix move command");
|
||||
if (strcmp(arg[6],"NULL") == 0) zvarstr = nullptr;
|
||||
else if (strstr(arg[6],"v_") == arg[6]) {
|
||||
else if (utils::strmatch(arg[6],"^v_")) {
|
||||
int n = strlen(&arg[6][2]) + 1;
|
||||
zvarstr = new char[n];
|
||||
strcpy(zvarstr,&arg[6][2]);
|
||||
} else error->all(FLERR,"Illegal fix move command");
|
||||
if (strcmp(arg[7],"NULL") == 0) vxvarstr = nullptr;
|
||||
else if (strstr(arg[7],"v_") == arg[7]) {
|
||||
else if (utils::strmatch(arg[7],"^v_")) {
|
||||
int n = strlen(&arg[7][2]) + 1;
|
||||
vxvarstr = new char[n];
|
||||
strcpy(vxvarstr,&arg[7][2]);
|
||||
} else error->all(FLERR,"Illegal fix move command");
|
||||
if (strcmp(arg[8],"NULL") == 0) vyvarstr = nullptr;
|
||||
else if (strstr(arg[8],"v_") == arg[8]) {
|
||||
else if (utils::strmatch(arg[8],"^v_")) {
|
||||
int n = strlen(&arg[8][2]) + 1;
|
||||
vyvarstr = new char[n];
|
||||
strcpy(vyvarstr,&arg[8][2]);
|
||||
} else error->all(FLERR,"Illegal fix move command");
|
||||
if (strcmp(arg[9],"NULL") == 0) vzvarstr = nullptr;
|
||||
else if (strstr(arg[9],"v_") == arg[9]) {
|
||||
else if (utils::strmatch(arg[9],"^v_")) {
|
||||
int n = strlen(&arg[9][2]) + 1;
|
||||
vzvarstr = new char[n];
|
||||
strcpy(vzvarstr,&arg[9][2]);
|
||||
|
||||
@ -32,7 +32,7 @@ FixPrint::FixPrint(LAMMPS *lmp, int narg, char **arg) :
|
||||
fp(nullptr), string(nullptr), copy(nullptr), work(nullptr), var_print(nullptr)
|
||||
{
|
||||
if (narg < 5) error->all(FLERR,"Illegal fix print command");
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
var_print = new char[n];
|
||||
strcpy(var_print,&arg[3][2]);
|
||||
|
||||
@ -75,7 +75,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
style[nvalue] = RMASS;
|
||||
atom->rmass_flag = rmass_flag = 1;
|
||||
nvalue++;
|
||||
} else if (strstr(arg[iarg],"i_") == arg[iarg]) {
|
||||
} else if (utils::strmatch(arg[iarg],"^i_")) {
|
||||
style[nvalue] = INTEGER;
|
||||
int tmp;
|
||||
index[nvalue] = atom->find_custom(&arg[iarg][2],tmp);
|
||||
@ -83,7 +83,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
error->all(FLERR,"Fix property/atom vector name already exists");
|
||||
index[nvalue] = atom->add_custom(&arg[iarg][2],0);
|
||||
nvalue++;
|
||||
} else if (strstr(arg[iarg],"d_") == arg[iarg]) {
|
||||
} else if (utils::strmatch(arg[iarg],"^d_")) {
|
||||
style[nvalue] = DOUBLE;
|
||||
int tmp;
|
||||
index[nvalue] = atom->find_custom(&arg[iarg][2],tmp);
|
||||
|
||||
@ -48,7 +48,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
ilevel_respa = nlevels_respa = 0;
|
||||
xstr = ystr = zstr = nullptr;
|
||||
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
xstr = new char[n];
|
||||
strcpy(xstr,&arg[3][2]);
|
||||
@ -58,7 +58,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
xvalue = utils::numeric(FLERR,arg[3],false,lmp);
|
||||
xstyle = CONSTANT;
|
||||
}
|
||||
if (strstr(arg[4],"v_") == arg[4]) {
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(&arg[4][2]) + 1;
|
||||
ystr = new char[n];
|
||||
strcpy(ystr,&arg[4][2]);
|
||||
@ -68,7 +68,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
yvalue = utils::numeric(FLERR,arg[4],false,lmp);
|
||||
ystyle = CONSTANT;
|
||||
}
|
||||
if (strstr(arg[5],"v_") == arg[5]) {
|
||||
if (utils::strmatch(arg[5],"^v_")) {
|
||||
int n = strlen(&arg[5][2]) + 1;
|
||||
zstr = new char[n];
|
||||
strcpy(zstr,&arg[5][2]);
|
||||
|
||||
@ -51,7 +51,7 @@ FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) :
|
||||
extscalar = 1;
|
||||
|
||||
tstr = nullptr;
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
tstr = new char[n];
|
||||
strcpy(tstr,&arg[3][2]);
|
||||
|
||||
@ -57,7 +57,7 @@ FixTempCSLD::FixTempCSLD(LAMMPS *lmp, int narg, char **arg) :
|
||||
extscalar = 1;
|
||||
|
||||
tstr = nullptr;
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
tstr = new char[n];
|
||||
strcpy(tstr,&arg[3][2]);
|
||||
|
||||
@ -134,7 +134,7 @@ FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) :
|
||||
extscalar = 1;
|
||||
|
||||
tstr = nullptr;
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
tstr = new char[n];
|
||||
strcpy(tstr,&arg[3][2]);
|
||||
|
||||
@ -51,7 +51,7 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) :
|
||||
dynamic_group_allow = 1;
|
||||
|
||||
tstr = nullptr;
|
||||
if (strstr(arg[4],"v_") == arg[4]) {
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(&arg[4][2]) + 1;
|
||||
tstr = new char[n];
|
||||
strcpy(tstr,&arg[4][2]);
|
||||
|
||||
@ -79,7 +79,7 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) :
|
||||
int side = wallwhich[nwall] % 2;
|
||||
if (side == 0) coord0[nwall] = domain->boxlo[dim];
|
||||
else coord0[nwall] = domain->boxhi[dim];
|
||||
} else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||
} else if (utils::strmatch(arg[iarg+1],"^v_")) {
|
||||
xstyle[nwall] = VARIABLE;
|
||||
int n = strlen(&arg[iarg+1][2]) + 1;
|
||||
xstr[nwall] = new char[n];
|
||||
@ -89,7 +89,7 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) :
|
||||
coord0[nwall] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
}
|
||||
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) {
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) {
|
||||
int n = strlen(&arg[iarg+2][2]) + 1;
|
||||
estr[nwall] = new char[n];
|
||||
strcpy(estr[nwall],&arg[iarg+2][2]);
|
||||
@ -100,7 +100,7 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) :
|
||||
}
|
||||
|
||||
if (utils::strmatch(style,"^wall/morse")) {
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) {
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) {
|
||||
int n = strlen(&arg[iarg+3][2]) + 1;
|
||||
astr[nwall] = new char[n];
|
||||
strcpy(astr[nwall],&arg[iarg+3][2]);
|
||||
@ -112,7 +112,7 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) :
|
||||
++iarg;
|
||||
}
|
||||
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) {
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) {
|
||||
int n = strlen(&arg[iarg+3][2]) + 1;
|
||||
sstr[nwall] = new char[n];
|
||||
strcpy(sstr[nwall],&arg[iarg+3][2]);
|
||||
|
||||
@ -73,7 +73,7 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) :
|
||||
int side = wallwhich[nwall] % 2;
|
||||
if (side == 0) coord0[nwall] = domain->boxlo[dim];
|
||||
else coord0[nwall] = domain->boxhi[dim];
|
||||
} else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||
} else if (utils::strmatch(arg[iarg+1],"^v_")) {
|
||||
wallstyle[nwall] = VARIABLE;
|
||||
int n = strlen(&arg[iarg+1][2]) + 1;
|
||||
varstr[nwall] = new char[n];
|
||||
|
||||
@ -664,7 +664,7 @@ void Output::set_thermo(int narg, char **arg)
|
||||
delete [] var_thermo;
|
||||
var_thermo = nullptr;
|
||||
|
||||
if (strstr(arg[0],"v_") == arg[0]) {
|
||||
if (utils::strmatch(arg[0],"^v_")) {
|
||||
int n = strlen(&arg[0][2]) + 1;
|
||||
var_thermo = new char[n];
|
||||
strcpy(var_thermo,&arg[0][2]);
|
||||
@ -712,7 +712,7 @@ void Output::create_restart(int narg, char **arg)
|
||||
int every = 0;
|
||||
int varflag = 0;
|
||||
|
||||
if (strstr(arg[0],"v_") == arg[0]) varflag = 1;
|
||||
if (utils::strmatch(arg[0],"^v_")) varflag = 1;
|
||||
else every = utils::inumeric(FLERR,arg[0],false,lmp);
|
||||
|
||||
if (!varflag && every == 0) {
|
||||
|
||||
@ -44,7 +44,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
|
||||
axis = arg[2][0];
|
||||
|
||||
if (axis == 'x') {
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(arg[3]+2) + 1;
|
||||
c1str = new char[n];
|
||||
strcpy(c1str,arg[3]+2);
|
||||
@ -55,7 +55,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
|
||||
c1 = yscale*utils::numeric(FLERR,arg[3],false,lmp);
|
||||
c1style = CONSTANT;
|
||||
}
|
||||
if (strstr(arg[4],"v_") == arg[4]) {
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(arg[4]+2) + 1;
|
||||
c2str = new char[n];
|
||||
strcpy(c2str,arg[4]+2);
|
||||
@ -67,7 +67,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
|
||||
c2style = CONSTANT;
|
||||
}
|
||||
} else if (axis == 'y') {
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(arg[3]+2) + 1;
|
||||
c1str = new char[n];
|
||||
strcpy(c1str,arg[3]+2);
|
||||
@ -78,7 +78,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
|
||||
c1 = xscale*utils::numeric(FLERR,arg[3],false,lmp);
|
||||
c1style = CONSTANT;
|
||||
}
|
||||
if (strstr(arg[4],"v_") == arg[4]) {
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(arg[4]+2) + 1;
|
||||
c2str = new char[n];
|
||||
strcpy(c2str,arg[4]+2);
|
||||
@ -90,7 +90,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
|
||||
c2style = CONSTANT;
|
||||
}
|
||||
} else if (axis == 'z') {
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(arg[3]+2) + 1;
|
||||
c1str = new char[n];
|
||||
strcpy(c1str,arg[3]+2);
|
||||
@ -101,7 +101,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
|
||||
c1 = xscale*utils::numeric(FLERR,arg[3],false,lmp);
|
||||
c1style = CONSTANT;
|
||||
}
|
||||
if (strstr(arg[4],"v_") == arg[4]) {
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(arg[4]+2) + 1;
|
||||
c2str = new char[n];
|
||||
strcpy(c2str,arg[4]+2);
|
||||
@ -114,7 +114,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
|
||||
}
|
||||
}
|
||||
|
||||
if (strstr(arg[5],"v_") == arg[5]) {
|
||||
if (utils::strmatch(arg[5],"^v_")) {
|
||||
int n = strlen(&arg[5][2]) + 1;
|
||||
rstr = new char[n];
|
||||
strcpy(rstr,&arg[5][2]);
|
||||
|
||||
@ -32,7 +32,7 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) :
|
||||
{
|
||||
options(narg-6,&arg[6]);
|
||||
|
||||
if (strstr(arg[2],"v_") == arg[2]) {
|
||||
if (utils::strmatch(arg[2],"^v_")) {
|
||||
int n = strlen(arg[2]+2) + 1;
|
||||
xstr = new char[n];
|
||||
strcpy(xstr,arg[2]+2);
|
||||
@ -44,7 +44,7 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) :
|
||||
xstyle = CONSTANT;
|
||||
}
|
||||
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(arg[3]+2) + 1;
|
||||
ystr = new char[n];
|
||||
strcpy(ystr,arg[3]+2);
|
||||
@ -56,7 +56,7 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) :
|
||||
ystyle = CONSTANT;
|
||||
}
|
||||
|
||||
if (strstr(arg[4],"v_") == arg[4]) {
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(arg[4]+2) + 1;
|
||||
zstr = new char[n];
|
||||
strcpy(zstr,arg[4]+2);
|
||||
@ -68,7 +68,7 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) :
|
||||
zstyle = CONSTANT;
|
||||
}
|
||||
|
||||
if (strstr(arg[5],"v_") == arg[5]) {
|
||||
if (utils::strmatch(arg[5],"^v_")) {
|
||||
int n = strlen(&arg[5][2]) + 1;
|
||||
rstr = new char[n];
|
||||
strcpy(rstr,&arg[5][2]);
|
||||
|
||||
104
src/set.cpp
104
src/set.cpp
@ -92,7 +92,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
if (strcmp(arg[iarg],"type") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
set(TYPE);
|
||||
iarg += 2;
|
||||
@ -141,7 +141,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"mol") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->molecule_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -150,49 +150,49 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"x") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
set(X);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"y") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
set(Y);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"z") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
set(Z);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"vx") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
set(VX);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"vy") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
set(VY);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"vz") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
set(VZ);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"charge") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -201,7 +201,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"mass") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->rmass_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -210,11 +210,11 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"shape") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3);
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
|
||||
else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (!atom->ellipsoid_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -223,7 +223,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"length") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->line_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -232,7 +232,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"tri") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->tri_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -241,11 +241,11 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"dipole") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3);
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
|
||||
else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (!atom->mu_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -267,13 +267,13 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"spin") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
else xvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3);
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
|
||||
else yvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) varparse(arg[iarg+4],4);
|
||||
if (utils::strmatch(arg[iarg+4],"^v_")) varparse(arg[iarg+4],4);
|
||||
else zvalue = utils::numeric(FLERR,arg[iarg+4],false,lmp);
|
||||
if (!atom->sp_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -295,13 +295,13 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"quat") == 0) {
|
||||
if (iarg+5 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3);
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
|
||||
else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) varparse(arg[iarg+4],4);
|
||||
if (utils::strmatch(arg[iarg+4],"^v_")) varparse(arg[iarg+4],4);
|
||||
else wvalue = utils::numeric(FLERR,arg[iarg+4],false,lmp);
|
||||
if (!atom->ellipsoid_flag && !atom->tri_flag && !atom->body_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -320,7 +320,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"theta") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else {
|
||||
dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
dvalue *= MY_PI/180.0;
|
||||
@ -342,11 +342,11 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"angmom") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3);
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
|
||||
else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (!atom->angmom_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -355,11 +355,11 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"omega") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3);
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
|
||||
else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (!atom->omega_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -368,7 +368,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"diameter") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->radius_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -378,7 +378,7 @@ void Set::command(int narg, char **arg)
|
||||
} else if (strcmp(arg[iarg],"density") == 0 ||
|
||||
(strcmp(arg[iarg],"density/disc") == 0)) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->rmass_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -394,7 +394,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"volume") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->vfrac_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -407,17 +407,17 @@ void Set::command(int narg, char **arg)
|
||||
ximageflag = yimageflag = zimageflag = 0;
|
||||
if (strcmp(arg[iarg+1],"NULL") != 0) {
|
||||
ximageflag = 1;
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else ximage = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
}
|
||||
if (strcmp(arg[iarg+2],"NULL") != 0) {
|
||||
yimageflag = 1;
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
else yimage = utils::inumeric(FLERR,arg[iarg+2],false,lmp);
|
||||
}
|
||||
if (strcmp(arg[iarg+3],"NULL") != 0) {
|
||||
zimageflag = 1;
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3);
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
|
||||
else zimage = utils::inumeric(FLERR,arg[iarg+3],false,lmp);
|
||||
}
|
||||
if (ximageflag && ximage && !domain->xperiodic)
|
||||
@ -474,7 +474,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"sph/e") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->esph_flag)
|
||||
error->all(FLERR,"Cannot set meso/e for this atom style");
|
||||
@ -483,7 +483,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"sph/cv") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->cv_flag)
|
||||
error->all(FLERR,"Cannot set meso/cv for this atom style");
|
||||
@ -492,7 +492,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"sph/rho") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->rho_flag)
|
||||
error->all(FLERR,"Cannot set meso/rho for this atom style");
|
||||
@ -502,7 +502,7 @@ void Set::command(int narg, char **arg)
|
||||
} else if (strcmp(arg[iarg],"edpd/temp") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0;
|
||||
else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else {
|
||||
dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (dvalue < 0.0) error->all(FLERR,"Illegal set command");
|
||||
@ -515,7 +515,7 @@ void Set::command(int narg, char **arg)
|
||||
} else if (strcmp(arg[iarg],"edpd/cv") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0;
|
||||
else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else {
|
||||
dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (dvalue < 0.0) error->all(FLERR,"Illegal set command");
|
||||
@ -528,7 +528,7 @@ void Set::command(int narg, char **arg)
|
||||
} else if (strcmp(arg[iarg],"cc") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0;
|
||||
else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else {
|
||||
cc_index = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
dvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
@ -541,7 +541,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"smd/mass/density") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->smd_flag)
|
||||
error->all(FLERR,"Cannot set smd/mass/density for this atom style");
|
||||
@ -550,7 +550,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"smd/contact/radius") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->smd_flag)
|
||||
error->all(FLERR,"Cannot set smd/contact/radius "
|
||||
@ -561,7 +561,7 @@ void Set::command(int narg, char **arg)
|
||||
} else if (strcmp(arg[iarg],"dpd/theta") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0;
|
||||
else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else {
|
||||
dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (dvalue < 0.0) error->all(FLERR,"Illegal set command");
|
||||
@ -571,9 +571,9 @@ void Set::command(int narg, char **arg)
|
||||
set(DPDTHETA);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strstr(arg[iarg],"i_") == arg[iarg]) {
|
||||
} else if (utils::strmatch(arg[iarg],"^i_")) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
int flag;
|
||||
index_custom = atom->find_custom(&arg[iarg][2],flag);
|
||||
@ -582,9 +582,9 @@ void Set::command(int narg, char **arg)
|
||||
set(INAME);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strstr(arg[iarg],"d_") == arg[iarg]) {
|
||||
} else if (utils::strmatch(arg[iarg],"^d_")) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
int flag;
|
||||
index_custom = atom->find_custom(&arg[iarg][2],flag);
|
||||
|
||||
@ -3309,7 +3309,7 @@ tagint Variable::int_between_brackets(char *&ptr, int varallow)
|
||||
|
||||
char *start = ++ptr;
|
||||
|
||||
if (varallow && strstr(ptr,"v_") == ptr) {
|
||||
if (varallow && utils::strmatch(ptr,"^v_")) {
|
||||
varflag = 1;
|
||||
while (*ptr && *ptr != ']') {
|
||||
if (!isalnum(*ptr) && *ptr != '_')
|
||||
@ -4112,7 +4112,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
|
||||
|
||||
// argument is compute
|
||||
|
||||
if (strstr(args[0],"c_") == args[0]) {
|
||||
if (utils::strmatch(args[0],"^c_")) {
|
||||
ptr1 = strchr(args[0],'[');
|
||||
if (ptr1) {
|
||||
ptr2 = ptr1;
|
||||
@ -4157,7 +4157,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
|
||||
|
||||
// argument is fix
|
||||
|
||||
} else if (strstr(args[0],"f_") == args[0]) {
|
||||
} else if (utils::strmatch(args[0],"^f_")) {
|
||||
ptr1 = strchr(args[0],'[');
|
||||
if (ptr1) {
|
||||
ptr2 = ptr1;
|
||||
@ -4195,7 +4195,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
|
||||
|
||||
// argument is vector-style variable
|
||||
|
||||
} else if (strstr(args[0],"v_") == args[0]) {
|
||||
} else if (utils::strmatch(args[0],"^v_")) {
|
||||
ptr1 = strchr(args[0],'[');
|
||||
if (ptr1) {
|
||||
ptr2 = ptr1;
|
||||
|
||||
@ -419,21 +419,21 @@ void Velocity::set(int /*narg*/, char **arg)
|
||||
xstyle = ystyle = zstyle = CONSTANT;
|
||||
xstr = ystr = zstr = nullptr;
|
||||
|
||||
if (strstr(arg[0],"v_") == arg[0]) {
|
||||
if (utils::strmatch(arg[0],"^v_")) {
|
||||
int n = strlen(&arg[0][2]) + 1;
|
||||
xstr = new char[n];
|
||||
strcpy(xstr,&arg[0][2]);
|
||||
} else if (strcmp(arg[0],"NULL") == 0) xstyle = NONE;
|
||||
else vx = utils::numeric(FLERR,arg[0],false,lmp);
|
||||
|
||||
if (strstr(arg[1],"v_") == arg[1]) {
|
||||
if (utils::strmatch(arg[1],"^v_")) {
|
||||
int n = strlen(&arg[1][2]) + 1;
|
||||
ystr = new char[n];
|
||||
strcpy(ystr,&arg[1][2]);
|
||||
} else if (strcmp(arg[1],"NULL") == 0) ystyle = NONE;
|
||||
else vy = utils::numeric(FLERR,arg[1],false,lmp);
|
||||
|
||||
if (strstr(arg[2],"v_") == arg[2]) {
|
||||
if (utils::strmatch(arg[2],"^v_")) {
|
||||
int n = strlen(&arg[2][2]) + 1;
|
||||
zstr = new char[n];
|
||||
strcpy(zstr,&arg[2][2]);
|
||||
|
||||
Reference in New Issue
Block a user