simplify by using utils::strdup()
This commit is contained in:
@ -49,22 +49,15 @@ Compute::Compute(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// compute ID, group, and style
|
// compute ID, group, and style
|
||||||
// ID must be all alphanumeric chars or underscores
|
// ID must be all alphanumeric chars or underscores
|
||||||
|
|
||||||
int n = strlen(arg[0]) + 1;
|
id = utils::strdup(arg[0]);
|
||||||
id = new char[n];
|
if (!utils::is_id(id))
|
||||||
strcpy(id,arg[0]);
|
error->all(FLERR,"Compute ID must be alphanumeric or underscore characters");
|
||||||
|
|
||||||
for (int i = 0; i < n-1; i++)
|
|
||||||
if (!isalnum(id[i]) && id[i] != '_')
|
|
||||||
error->all(FLERR,
|
|
||||||
"Compute ID must be alphanumeric or underscore characters");
|
|
||||||
|
|
||||||
igroup = group->find(arg[1]);
|
igroup = group->find(arg[1]);
|
||||||
if (igroup == -1) error->all(FLERR,"Could not find compute group ID");
|
if (igroup == -1) error->all(FLERR,"Could not find compute group ID");
|
||||||
groupbit = group->bitmask[igroup];
|
groupbit = group->bitmask[igroup];
|
||||||
|
|
||||||
n = strlen(arg[2]) + 1;
|
style = utils::strdup(arg[2]);
|
||||||
style = new char[n];
|
|
||||||
strcpy(style,arg[2]);
|
|
||||||
|
|
||||||
// set child class defaults
|
// set child class defaults
|
||||||
|
|
||||||
|
|||||||
@ -67,9 +67,7 @@ ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
bstyle[nvalues++] = ENG;
|
bstyle[nvalues++] = ENG;
|
||||||
} else if (strncmp(arg[iarg],"v_",2) == 0) {
|
} else if (strncmp(arg[iarg],"v_",2) == 0) {
|
||||||
bstyle[nvalues++] = VARIABLE;
|
bstyle[nvalues++] = VARIABLE;
|
||||||
int n = strlen(arg[iarg]);
|
vstr[nvar] = utils::strdup(&arg[iarg][2]);
|
||||||
vstr[nvar] = new char[n];
|
|
||||||
strcpy(vstr[nvar],&arg[iarg][2]);
|
|
||||||
nvar++;
|
nvar++;
|
||||||
} else break;
|
} else break;
|
||||||
}
|
}
|
||||||
@ -85,9 +83,7 @@ ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
if (iarg+3 > narg) error->all(FLERR,"Illegal compute angle/local command");
|
if (iarg+3 > narg) error->all(FLERR,"Illegal compute angle/local command");
|
||||||
if (strcmp(arg[iarg+1],"theta") == 0) {
|
if (strcmp(arg[iarg+1],"theta") == 0) {
|
||||||
delete [] tstr;
|
delete [] tstr;
|
||||||
int n = strlen(arg[iarg+2]) + 1;
|
tstr = utils::strdup(arg[iarg+2]);
|
||||||
tstr = new char[n];
|
|
||||||
strcpy(tstr,arg[iarg+2]);
|
|
||||||
tflag = 1;
|
tflag = 1;
|
||||||
} else error->all(FLERR,"Illegal compute angle/local command");
|
} else error->all(FLERR,"Illegal compute angle/local command");
|
||||||
iarg += 3;
|
iarg += 3;
|
||||||
|
|||||||
@ -41,9 +41,7 @@ ComputeAngmomChunk::ComputeAngmomChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// ID of compute chunk/atom
|
// ID of compute chunk/atom
|
||||||
|
|
||||||
int n = strlen(arg[3]) + 1;
|
idchunk = utils::strdup(arg[3]);
|
||||||
idchunk = new char[n];
|
|
||||||
strcpy(idchunk,arg[3]);
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
|||||||
@ -74,9 +74,7 @@ ComputeBondLocal::ComputeBondLocal(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
else if (strcmp(arg[iarg],"velvib") == 0) bstyle[nvalues++] = VELVIB;
|
else if (strcmp(arg[iarg],"velvib") == 0) bstyle[nvalues++] = VELVIB;
|
||||||
else if (strncmp(arg[iarg],"v_",2) == 0) {
|
else if (strncmp(arg[iarg],"v_",2) == 0) {
|
||||||
bstyle[nvalues++] = VARIABLE;
|
bstyle[nvalues++] = VARIABLE;
|
||||||
int n = strlen(arg[iarg]);
|
vstr[nvar] = utils::strdup(&arg[iarg][2]);
|
||||||
vstr[nvar] = new char[n];
|
|
||||||
strcpy(vstr[nvar],&arg[iarg][2]);
|
|
||||||
nvar++;
|
nvar++;
|
||||||
} else break;
|
} else break;
|
||||||
}
|
}
|
||||||
@ -92,9 +90,7 @@ ComputeBondLocal::ComputeBondLocal(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
if (iarg+3 > narg) error->all(FLERR,"Illegal compute bond/local command");
|
if (iarg+3 > narg) error->all(FLERR,"Illegal compute bond/local command");
|
||||||
if (strcmp(arg[iarg+1],"dist") == 0) {
|
if (strcmp(arg[iarg+1],"dist") == 0) {
|
||||||
delete [] dstr;
|
delete [] dstr;
|
||||||
int n = strlen(arg[iarg+2]) + 1;
|
dstr = utils::strdup(arg[iarg+2]);
|
||||||
dstr = new char[n];
|
|
||||||
strcpy(dstr,arg[iarg+2]);
|
|
||||||
} else error->all(FLERR,"Illegal compute bond/local command");
|
} else error->all(FLERR,"Illegal compute bond/local command");
|
||||||
iarg += 3;
|
iarg += 3;
|
||||||
} else error->all(FLERR,"Illegal compute bond/local command");
|
} else error->all(FLERR,"Illegal compute bond/local command");
|
||||||
|
|||||||
@ -51,9 +51,7 @@ ComputeCentroidStressAtom::ComputeCentroidStressAtom(LAMMPS *lmp, int narg, char
|
|||||||
|
|
||||||
if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr;
|
if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr;
|
||||||
else {
|
else {
|
||||||
int n = strlen(arg[3]) + 1;
|
id_temp = utils::strdup(arg[3]);
|
||||||
id_temp = new char[n];
|
|
||||||
strcpy(id_temp,arg[3]);
|
|
||||||
|
|
||||||
int icompute = modify->find_compute(id_temp);
|
int icompute = modify->find_compute(id_temp);
|
||||||
if (icompute < 0)
|
if (icompute < 0)
|
||||||
|
|||||||
@ -185,9 +185,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
int iregion = domain->find_region(arg[iarg+1]);
|
int iregion = domain->find_region(arg[iarg+1]);
|
||||||
if (iregion == -1)
|
if (iregion == -1)
|
||||||
error->all(FLERR,"Region ID for compute chunk/atom does not exist");
|
error->all(FLERR,"Region ID for compute chunk/atom does not exist");
|
||||||
int n = strlen(arg[iarg+1]) + 1;
|
idregion = utils::strdup(arg[iarg+1]);
|
||||||
idregion = new char[n];
|
|
||||||
strcpy(idregion,arg[iarg+1]);
|
|
||||||
regionflag = 1;
|
regionflag = 1;
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"nchunk") == 0) {
|
} else if (strcmp(arg[iarg],"nchunk") == 0) {
|
||||||
|
|||||||
@ -36,9 +36,7 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// ID of compute chunk/atom
|
// ID of compute chunk/atom
|
||||||
|
|
||||||
int n = strlen(arg[3]) + 1;
|
idchunk = utils::strdup(arg[3]);
|
||||||
idchunk = new char[n];
|
|
||||||
strcpy(idchunk,arg[3]);
|
|
||||||
init_chunk();
|
init_chunk();
|
||||||
|
|
||||||
// expand args if any have wildcard character "*"
|
// expand args if any have wildcard character "*"
|
||||||
|
|||||||
@ -43,9 +43,7 @@ ComputeCOMChunk::ComputeCOMChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// ID of compute chunk/atom
|
// ID of compute chunk/atom
|
||||||
|
|
||||||
int n = strlen(arg[3]) + 1;
|
idchunk = utils::strdup(arg[3]);
|
||||||
idchunk = new char[n];
|
|
||||||
strcpy(idchunk,arg[3]);
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
|||||||
@ -85,9 +85,7 @@ ComputeCoordAtom::ComputeCoordAtom(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
cstyle = ORIENT;
|
cstyle = ORIENT;
|
||||||
if (narg != 6) error->all(FLERR,"Illegal compute coord/atom command");
|
if (narg != 6) error->all(FLERR,"Illegal compute coord/atom command");
|
||||||
|
|
||||||
int n = strlen(arg[4]) + 1;
|
id_orientorder = utils::strdup(arg[4]);
|
||||||
id_orientorder = new char[n];
|
|
||||||
strcpy(id_orientorder,arg[4]);
|
|
||||||
|
|
||||||
int iorientorder = modify->find_compute(id_orientorder);
|
int iorientorder = modify->find_compute(id_orientorder);
|
||||||
if (iorientorder < 0)
|
if (iorientorder < 0)
|
||||||
|
|||||||
@ -64,9 +64,7 @@ ComputeDihedralLocal::ComputeDihedralLocal(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
bstyle[nvalues++] = PHI;
|
bstyle[nvalues++] = PHI;
|
||||||
} else if (strncmp(arg[iarg],"v_",2) == 0) {
|
} else if (strncmp(arg[iarg],"v_",2) == 0) {
|
||||||
bstyle[nvalues++] = VARIABLE;
|
bstyle[nvalues++] = VARIABLE;
|
||||||
int n = strlen(arg[iarg]);
|
vstr[nvar] = utils::strdup(&arg[iarg][2]);
|
||||||
vstr[nvar] = new char[n];
|
|
||||||
strcpy(vstr[nvar],&arg[iarg][2]);
|
|
||||||
nvar++;
|
nvar++;
|
||||||
} else break;
|
} else break;
|
||||||
}
|
}
|
||||||
@ -83,9 +81,7 @@ ComputeDihedralLocal::ComputeDihedralLocal(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
error->all(FLERR,"Illegal compute dihedral/local command");
|
error->all(FLERR,"Illegal compute dihedral/local command");
|
||||||
if (strcmp(arg[iarg+1],"phi") == 0) {
|
if (strcmp(arg[iarg+1],"phi") == 0) {
|
||||||
delete [] pstr;
|
delete [] pstr;
|
||||||
int n = strlen(arg[iarg+2]) + 1;
|
pstr = utils::strdup(arg[iarg+2]);
|
||||||
pstr = new char[n];
|
|
||||||
strcpy(pstr,arg[iarg+2]);
|
|
||||||
} else error->all(FLERR,"Illegal compute dihedral/local command");
|
} else error->all(FLERR,"Illegal compute dihedral/local command");
|
||||||
iarg += 3;
|
iarg += 3;
|
||||||
} else error->all(FLERR,"Illegal compute dihedral/local command");
|
} else error->all(FLERR,"Illegal compute dihedral/local command");
|
||||||
|
|||||||
@ -49,9 +49,7 @@ ComputeDipoleChunk::ComputeDipoleChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// ID of compute chunk/atom
|
// ID of compute chunk/atom
|
||||||
|
|
||||||
int n = strlen(arg[3]) + 1;
|
idchunk = utils::strdup(arg[3]);
|
||||||
idchunk = new char[n];
|
|
||||||
strcpy(idchunk,arg[3]);
|
|
||||||
|
|
||||||
usecenter = MASSCENTER;
|
usecenter = MASSCENTER;
|
||||||
|
|
||||||
|
|||||||
@ -53,9 +53,7 @@ ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
error->all(FLERR,"Illegal compute displace/atom command");
|
error->all(FLERR,"Illegal compute displace/atom command");
|
||||||
refreshflag = 1;
|
refreshflag = 1;
|
||||||
delete [] rvar;
|
delete [] rvar;
|
||||||
int n = strlen(arg[iarg+1]) + 1;
|
rvar = utils::strdup(arg[iarg+1]);
|
||||||
rvar = new char[n];
|
|
||||||
strcpy(rvar,arg[iarg+1]);
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else error->all(FLERR,"Illegal compute displace/atom command");
|
} else error->all(FLERR,"Illegal compute displace/atom command");
|
||||||
}
|
}
|
||||||
@ -74,11 +72,9 @@ ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// create a new fix STORE style
|
// create a new fix STORE style
|
||||||
// id = compute-ID + COMPUTE_STORE, fix group = compute group
|
// id = compute-ID + COMPUTE_STORE, fix group = compute group
|
||||||
|
|
||||||
std::string cmd = id + std::string("_COMPUTE_STORE");
|
id_fix = utils::strdup(std::string(id) + "_COMPUTE_STORE");
|
||||||
id_fix = new char[cmd.size()+1];
|
std::string cmd = id_fix + fmt::format(" {} STORE peratom 1 3",
|
||||||
strcpy(id_fix,cmd.c_str());
|
group->names[igroup]);
|
||||||
|
|
||||||
cmd += fmt::format(" {} STORE peratom 1 3", group->names[igroup]);
|
|
||||||
modify->add_fix(cmd);
|
modify->add_fix(cmd);
|
||||||
fix = (FixStore *) modify->fix[modify->nfix-1];
|
fix = (FixStore *) modify->fix[modify->nfix-1];
|
||||||
|
|
||||||
|
|||||||
@ -54,10 +54,7 @@ ComputeGroupGroup::ComputeGroupGroup(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
extscalar = 1;
|
extscalar = 1;
|
||||||
extvector = 1;
|
extvector = 1;
|
||||||
|
|
||||||
int n = strlen(arg[3]) + 1;
|
group2 = utils::strdup(arg[3]);
|
||||||
group2 = new char[n];
|
|
||||||
strcpy(group2,arg[3]);
|
|
||||||
|
|
||||||
jgroup = group->find(group2);
|
jgroup = group->find(group2);
|
||||||
if (jgroup == -1)
|
if (jgroup == -1)
|
||||||
error->all(FLERR,"Compute group/group group ID does not exist");
|
error->all(FLERR,"Compute group/group group ID does not exist");
|
||||||
|
|||||||
@ -36,9 +36,7 @@ ComputeGyrationChunk::ComputeGyrationChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// ID of compute chunk/atom
|
// ID of compute chunk/atom
|
||||||
|
|
||||||
int n = strlen(arg[3]) + 1;
|
idchunk = utils::strdup(arg[3]);
|
||||||
idchunk = new char[n];
|
|
||||||
strcpy(idchunk,arg[3]);
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
|||||||
@ -43,17 +43,9 @@ ComputeHeatFlux::ComputeHeatFlux(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// store ke/atom, pe/atom, stress/atom IDs used by heat flux computation
|
// store ke/atom, pe/atom, stress/atom IDs used by heat flux computation
|
||||||
// insure they are valid for these computations
|
// insure they are valid for these computations
|
||||||
|
|
||||||
int n = strlen(arg[3]) + 1;
|
id_ke = utils::strdup(arg[3]);
|
||||||
id_ke = new char[n];
|
id_pe = utils::strdup(arg[4]);
|
||||||
strcpy(id_ke,arg[3]);
|
id_stress = utils::strdup(arg[5]);
|
||||||
|
|
||||||
n = strlen(arg[4]) + 1;
|
|
||||||
id_pe = new char[n];
|
|
||||||
strcpy(id_pe,arg[4]);
|
|
||||||
|
|
||||||
n = strlen(arg[5]) + 1;
|
|
||||||
id_stress = new char[n];
|
|
||||||
strcpy(id_stress,arg[5]);
|
|
||||||
|
|
||||||
int ike = modify->find_compute(id_ke);
|
int ike = modify->find_compute(id_ke);
|
||||||
int ipe = modify->find_compute(id_pe);
|
int ipe = modify->find_compute(id_pe);
|
||||||
|
|||||||
@ -41,9 +41,7 @@ ComputeInertiaChunk::ComputeInertiaChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// ID of compute chunk/atom
|
// ID of compute chunk/atom
|
||||||
|
|
||||||
int n = strlen(arg[3]) + 1;
|
idchunk = utils::strdup(arg[3]);
|
||||||
idchunk = new char[n];
|
|
||||||
strcpy(idchunk,arg[3]);
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
|||||||
@ -44,9 +44,7 @@ ComputeMSDChunk::ComputeMSDChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// ID of compute chunk/atom
|
// ID of compute chunk/atom
|
||||||
|
|
||||||
int n = strlen(arg[3]) + 1;
|
idchunk = utils::strdup(arg[3]);
|
||||||
idchunk = new char[n];
|
|
||||||
strcpy(idchunk,arg[3]);
|
|
||||||
|
|
||||||
firstflag = 1;
|
firstflag = 1;
|
||||||
init();
|
init();
|
||||||
@ -58,11 +56,9 @@ ComputeMSDChunk::ComputeMSDChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// potentially re-populate the fix array (and change it to correct size)
|
// potentially re-populate the fix array (and change it to correct size)
|
||||||
// otherwise size reset and init will be done in setup()
|
// otherwise size reset and init will be done in setup()
|
||||||
|
|
||||||
std::string fixcmd = id + std::string("_COMPUTE_STORE");
|
id_fix = utils::strdup(std::string(id) + "_COMPUTE_STORE");
|
||||||
id_fix = new char[fixcmd.size()+1];
|
std::string fixcmd = id_fix
|
||||||
strcpy(id_fix,fixcmd.c_str());
|
+ fmt::format(" {} STORE global 1 1",group->names[igroup]);
|
||||||
|
|
||||||
fixcmd += fmt::format(" {} STORE global 1 1",group->names[igroup]);
|
|
||||||
modify->add_fix(fixcmd);
|
modify->add_fix(fixcmd);
|
||||||
fix = (FixStore *) modify->fix[modify->nfix-1];
|
fix = (FixStore *) modify->fix[modify->nfix-1];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,9 +45,7 @@ ComputeOmegaChunk::ComputeOmegaChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// ID of compute chunk/atom
|
// ID of compute chunk/atom
|
||||||
|
|
||||||
int n = strlen(arg[3]) + 1;
|
idchunk = utils::strdup(arg[3]);
|
||||||
idchunk = new char[n];
|
|
||||||
strcpy(idchunk,arg[3]);
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
|||||||
@ -37,10 +37,10 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
peflag = 1;
|
peflag = 1;
|
||||||
timeflag = 1;
|
timeflag = 1;
|
||||||
|
|
||||||
int n = strlen(arg[3]) + 1;
|
// copy with suffix so we can later chop it off, if needed
|
||||||
if (lmp->suffix) n += strlen(lmp->suffix) + 1;
|
if (lmp->suffix)
|
||||||
pstyle = new char[n];
|
pstyle = utils::strdup(fmt::format("{}/{}",arg[3],lmp->suffix));
|
||||||
strcpy(pstyle,arg[3]);
|
else pstyle = utils::strdup(arg[3]);
|
||||||
|
|
||||||
int iarg = 4;
|
int iarg = 4;
|
||||||
nsub = 0;
|
nsub = 0;
|
||||||
@ -67,8 +67,7 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
pair = force->pair_match(pstyle,1,nsub);
|
pair = force->pair_match(pstyle,1,nsub);
|
||||||
if (!pair && lmp->suffix) {
|
if (!pair && lmp->suffix) {
|
||||||
strcat(pstyle,"/");
|
pstyle[strlen(pstyle) - strlen(lmp->suffix) - 1] = '\0';
|
||||||
strcat(pstyle,lmp->suffix);
|
|
||||||
pair = force->pair_match(pstyle,1,nsub);
|
pair = force->pair_match(pstyle,1,nsub);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -53,9 +53,7 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr;
|
if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr;
|
||||||
else {
|
else {
|
||||||
int n = strlen(arg[3]) + 1;
|
id_temp = utils::strdup(arg[3]);
|
||||||
id_temp = new char[n];
|
|
||||||
strcpy(id_temp,arg[3]);
|
|
||||||
|
|
||||||
int icompute = modify->find_compute(id_temp);
|
int icompute = modify->find_compute(id_temp);
|
||||||
if (icompute < 0)
|
if (icompute < 0)
|
||||||
@ -82,10 +80,10 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
if (strcmp(arg[iarg],"ke") == 0) keflag = 1;
|
if (strcmp(arg[iarg],"ke") == 0) keflag = 1;
|
||||||
else if (strcmp(arg[iarg],"pair/hybrid") == 0) {
|
else if (strcmp(arg[iarg],"pair/hybrid") == 0) {
|
||||||
int n = strlen(arg[++iarg]) + 1;
|
if (lmp->suffix)
|
||||||
if (lmp->suffix) n += strlen(lmp->suffix) + 1;
|
pstyle = utils::strdup(fmt::format("{}/{}",arg[++iarg],lmp->suffix));
|
||||||
pstyle = new char[n];
|
else
|
||||||
strcpy(pstyle,arg[iarg++]);
|
pstyle = utils::strdup(arg[++iarg]);
|
||||||
|
|
||||||
nsub = 0;
|
nsub = 0;
|
||||||
|
|
||||||
@ -102,8 +100,7 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
pairhybrid = (Pair *) force->pair_match(pstyle,1,nsub);
|
pairhybrid = (Pair *) force->pair_match(pstyle,1,nsub);
|
||||||
if (!pairhybrid && lmp->suffix) {
|
if (!pairhybrid && lmp->suffix) {
|
||||||
strcat(pstyle,"/");
|
pstyle[strlen(pstyle) - strlen(lmp->suffix) - 1] = '\0';
|
||||||
strcat(pstyle,lmp->suffix);
|
|
||||||
pairhybrid = (Pair *) force->pair_match(pstyle,1,nsub);
|
pairhybrid = (Pair *) force->pair_match(pstyle,1,nsub);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -33,9 +33,7 @@ ComputePropertyChunk::ComputePropertyChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// ID of compute chunk/atom
|
// ID of compute chunk/atom
|
||||||
|
|
||||||
int n = strlen(arg[3]) + 1;
|
idchunk = utils::strdup(arg[3]);
|
||||||
idchunk = new char[n];
|
|
||||||
strcpy(idchunk,arg[3]);
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
|||||||
@ -47,9 +47,7 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
iregion = domain->find_region(arg[3]);
|
iregion = domain->find_region(arg[3]);
|
||||||
if (iregion == -1)
|
if (iregion == -1)
|
||||||
error->all(FLERR,"Region ID for compute reduce/region does not exist");
|
error->all(FLERR,"Region ID for compute reduce/region does not exist");
|
||||||
int n = strlen(arg[3]) + 1;
|
idregion = utils::strdup(arg[3]);
|
||||||
idregion = new char[n];
|
|
||||||
strcpy(idregion,arg[3]);
|
|
||||||
iarg = 4;
|
iarg = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -45,9 +45,7 @@ ComputeReduceChunk::ComputeReduceChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// ID of compute chunk/atom
|
// ID of compute chunk/atom
|
||||||
|
|
||||||
int n = strlen(arg[3]) + 1;
|
idchunk = utils::strdup(arg[3]);
|
||||||
idchunk = new char[n];
|
|
||||||
strcpy(idchunk,arg[3]);
|
|
||||||
init_chunk();
|
init_chunk();
|
||||||
|
|
||||||
// mode
|
// mode
|
||||||
|
|||||||
@ -51,9 +51,7 @@ ComputeStressAtom::ComputeStressAtom(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr;
|
if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr;
|
||||||
else {
|
else {
|
||||||
int n = strlen(arg[3]) + 1;
|
id_temp = utils::strdup(arg[3]);
|
||||||
id_temp = new char[n];
|
|
||||||
strcpy(id_temp,arg[3]);
|
|
||||||
|
|
||||||
int icompute = modify->find_compute(id_temp);
|
int icompute = modify->find_compute(id_temp);
|
||||||
if (icompute < 0)
|
if (icompute < 0)
|
||||||
|
|||||||
@ -44,9 +44,7 @@ ComputeTempChunk::ComputeTempChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// ID of compute chunk/atom
|
// ID of compute chunk/atom
|
||||||
|
|
||||||
int n = strlen(arg[3]) + 1;
|
idchunk = utils::strdup(arg[3]);
|
||||||
idchunk = new char[n];
|
|
||||||
strcpy(idchunk,arg[3]);
|
|
||||||
|
|
||||||
biasflag = 0;
|
biasflag = 0;
|
||||||
init();
|
init();
|
||||||
@ -87,9 +85,7 @@ ComputeTempChunk::ComputeTempChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
if (iarg+2 > narg)
|
if (iarg+2 > narg)
|
||||||
error->all(FLERR,"Illegal compute temp/chunk command");
|
error->all(FLERR,"Illegal compute temp/chunk command");
|
||||||
biasflag = 1;
|
biasflag = 1;
|
||||||
int n = strlen(arg[iarg+1]) + 1;
|
id_bias = utils::strdup(arg[iarg+1]);
|
||||||
id_bias = new char[n];
|
|
||||||
strcpy(id_bias,arg[iarg+1]);
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"adof") == 0) {
|
} else if (strcmp(arg[iarg],"adof") == 0) {
|
||||||
if (iarg+2 > narg)
|
if (iarg+2 > narg)
|
||||||
|
|||||||
@ -36,9 +36,7 @@ ComputeTempRegion::ComputeTempRegion(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
iregion = domain->find_region(arg[3]);
|
iregion = domain->find_region(arg[3]);
|
||||||
if (iregion == -1)
|
if (iregion == -1)
|
||||||
error->all(FLERR,"Region ID for compute temp/region does not exist");
|
error->all(FLERR,"Region ID for compute temp/region does not exist");
|
||||||
int n = strlen(arg[3]) + 1;
|
idregion = utils::strdup(arg[3]);
|
||||||
idregion = new char[n];
|
|
||||||
strcpy(idregion,arg[3]);
|
|
||||||
|
|
||||||
scalar_flag = vector_flag = 1;
|
scalar_flag = vector_flag = 1;
|
||||||
size_vector = 6;
|
size_vector = 6;
|
||||||
|
|||||||
@ -51,9 +51,7 @@ ComputeTempSphere::ComputeTempSphere(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
if (iarg+2 > narg)
|
if (iarg+2 > narg)
|
||||||
error->all(FLERR,"Illegal compute temp/sphere command");
|
error->all(FLERR,"Illegal compute temp/sphere command");
|
||||||
tempbias = 1;
|
tempbias = 1;
|
||||||
int n = strlen(arg[iarg+1]) + 1;
|
id_bias = utils::strdup(arg[iarg+1]);
|
||||||
id_bias = new char[n];
|
|
||||||
strcpy(id_bias,arg[iarg+1]);
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"dof") == 0) {
|
} else if (strcmp(arg[iarg],"dof") == 0) {
|
||||||
if (iarg+2 > narg)
|
if (iarg+2 > narg)
|
||||||
|
|||||||
@ -40,9 +40,7 @@ ComputeTorqueChunk::ComputeTorqueChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// ID of compute chunk/atom
|
// ID of compute chunk/atom
|
||||||
|
|
||||||
int n = strlen(arg[3]) + 1;
|
idchunk = utils::strdup(arg[3]);
|
||||||
idchunk = new char[n];
|
|
||||||
strcpy(idchunk,arg[3]);
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
|||||||
@ -41,9 +41,7 @@ ComputeVCMChunk::ComputeVCMChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// ID of compute chunk/atom
|
// ID of compute chunk/atom
|
||||||
|
|
||||||
int n = strlen(arg[3]) + 1;
|
idchunk = utils::strdup(arg[3]);
|
||||||
idchunk = new char[n];
|
|
||||||
strcpy(idchunk,arg[3]);
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user