reduce compiler warnings by avoiding to redeclare variables so they shadow others
This commit is contained in:
@ -183,16 +183,16 @@ void AngleHybrid::allocate()
|
|||||||
|
|
||||||
void AngleHybrid::settings(int narg, char **arg)
|
void AngleHybrid::settings(int narg, char **arg)
|
||||||
{
|
{
|
||||||
int i,m,istyle;
|
int i, m,istyle;
|
||||||
|
|
||||||
if (narg < 1) error->all(FLERR,"Illegal angle_style command");
|
if (narg < 1) error->all(FLERR,"Illegal angle_style command");
|
||||||
|
|
||||||
// delete old lists, since cannot just change settings
|
// delete old lists, since cannot just change settings
|
||||||
|
|
||||||
if (nstyles) {
|
if (nstyles) {
|
||||||
for (int i = 0; i < nstyles; i++) delete styles[i];
|
for (i = 0; i < nstyles; i++) delete styles[i];
|
||||||
delete [] styles;
|
delete [] styles;
|
||||||
for (int i = 0; i < nstyles; i++) delete [] keywords[i];
|
for (i = 0; i < nstyles; i++) delete [] keywords[i];
|
||||||
delete [] keywords;
|
delete [] keywords;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ void AngleHybrid::settings(int narg, char **arg)
|
|||||||
memory->destroy(map);
|
memory->destroy(map);
|
||||||
delete [] nanglelist;
|
delete [] nanglelist;
|
||||||
delete [] maxangle;
|
delete [] maxangle;
|
||||||
for (int i = 0; i < nstyles; i++)
|
for (i = 0; i < nstyles; i++)
|
||||||
memory->destroy(anglelist[i]);
|
memory->destroy(anglelist[i]);
|
||||||
delete [] anglelist;
|
delete [] anglelist;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,7 +98,7 @@ void AtomVecHybrid::process_args(int narg, char **arg)
|
|||||||
// call process_args() with set of args that are not atom style names
|
// call process_args() with set of args that are not atom style names
|
||||||
// use known_style() to determine which args these are
|
// use known_style() to determine which args these are
|
||||||
|
|
||||||
int i,jarg,dummy;
|
int i,k,jarg,dummy;
|
||||||
|
|
||||||
int iarg = 0;
|
int iarg = 0;
|
||||||
nstyles = 0;
|
nstyles = 0;
|
||||||
@ -123,7 +123,7 @@ void AtomVecHybrid::process_args(int narg, char **arg)
|
|||||||
molecular = Atom::ATOMIC;
|
molecular = Atom::ATOMIC;
|
||||||
maxexchange = 0;
|
maxexchange = 0;
|
||||||
|
|
||||||
for (int k = 0; k < nstyles; k++) {
|
for (k = 0; k < nstyles; k++) {
|
||||||
if ((styles[k]->molecular == Atom::MOLECULAR && molecular == Atom::TEMPLATE) ||
|
if ((styles[k]->molecular == Atom::MOLECULAR && molecular == Atom::TEMPLATE) ||
|
||||||
(styles[k]->molecular == Atom::TEMPLATE && molecular == Atom::MOLECULAR))
|
(styles[k]->molecular == Atom::TEMPLATE && molecular == Atom::MOLECULAR))
|
||||||
error->all(FLERR,
|
error->all(FLERR,
|
||||||
@ -147,7 +147,7 @@ void AtomVecHybrid::process_args(int narg, char **arg)
|
|||||||
int mass_pertype = 0;
|
int mass_pertype = 0;
|
||||||
int mass_peratom = 0;
|
int mass_peratom = 0;
|
||||||
|
|
||||||
for (int k = 0; k < nstyles; k++) {
|
for (k = 0; k < nstyles; k++) {
|
||||||
if (styles[k]->mass_type == 0) mass_peratom = 1;
|
if (styles[k]->mass_type == 0) mass_peratom = 1;
|
||||||
if (styles[k]->mass_type == 1) mass_pertype = 1;
|
if (styles[k]->mass_type == 1) mass_pertype = 1;
|
||||||
}
|
}
|
||||||
@ -159,14 +159,14 @@ void AtomVecHybrid::process_args(int narg, char **arg)
|
|||||||
|
|
||||||
// free allstyles created by build_styles()
|
// free allstyles created by build_styles()
|
||||||
|
|
||||||
for (int i = 0; i < nallstyles; i++) delete [] allstyles[i];
|
for (i = 0; i < nallstyles; i++) delete [] allstyles[i];
|
||||||
delete [] allstyles;
|
delete [] allstyles;
|
||||||
|
|
||||||
// set field strings from all substyles
|
// set field strings from all substyles
|
||||||
|
|
||||||
fieldstrings = new FieldStrings[nstyles];
|
fieldstrings = new FieldStrings[nstyles];
|
||||||
|
|
||||||
for (int k = 0; k < nstyles; k++) {
|
for (k = 0; k < nstyles; k++) {
|
||||||
fieldstrings[k].fstr = new char*[NFIELDSTRINGS];
|
fieldstrings[k].fstr = new char*[NFIELDSTRINGS];
|
||||||
fieldstrings[k].fstr[0] = styles[k]->fields_grow;
|
fieldstrings[k].fstr[0] = styles[k]->fields_grow;
|
||||||
fieldstrings[k].fstr[1] = styles[k]->fields_copy;
|
fieldstrings[k].fstr[1] = styles[k]->fields_copy;
|
||||||
@ -226,7 +226,7 @@ void AtomVecHybrid::process_args(int narg, char **arg)
|
|||||||
// sum two sizes over contributions from each substyle with bonus data.
|
// sum two sizes over contributions from each substyle with bonus data.
|
||||||
|
|
||||||
nstyles_bonus = 0;
|
nstyles_bonus = 0;
|
||||||
for (int k = 0; k < nstyles; k++)
|
for (k = 0; k < nstyles; k++)
|
||||||
if (styles[k]->bonus_flag) nstyles_bonus++;
|
if (styles[k]->bonus_flag) nstyles_bonus++;
|
||||||
|
|
||||||
if (nstyles_bonus) {
|
if (nstyles_bonus) {
|
||||||
@ -235,7 +235,7 @@ void AtomVecHybrid::process_args(int narg, char **arg)
|
|||||||
nstyles_bonus = 0;
|
nstyles_bonus = 0;
|
||||||
size_forward_bonus = 0;
|
size_forward_bonus = 0;
|
||||||
size_border_bonus = 0;
|
size_border_bonus = 0;
|
||||||
for (int k = 0; k < nstyles; k++) {
|
for (k = 0; k < nstyles; k++) {
|
||||||
if (styles[k]->bonus_flag) {
|
if (styles[k]->bonus_flag) {
|
||||||
styles_bonus[nstyles_bonus++] = styles[k];
|
styles_bonus[nstyles_bonus++] = styles[k];
|
||||||
size_forward_bonus += styles[k]->size_forward_bonus;
|
size_forward_bonus += styles[k]->size_forward_bonus;
|
||||||
|
|||||||
@ -919,7 +919,7 @@ int Balance::shift()
|
|||||||
// do this with minimal adjustment to splits
|
// do this with minimal adjustment to splits
|
||||||
|
|
||||||
double close = (1.0+EPSNEIGH) * neighbor->skin / boxsize;
|
double close = (1.0+EPSNEIGH) * neighbor->skin / boxsize;
|
||||||
double delta,midpt,start,stop,lbound,ubound,spacing;
|
double midpt,start,stop,lbound,ubound,spacing;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < np) {
|
while (i < np) {
|
||||||
@ -1094,7 +1094,7 @@ int Balance::adjust(int n, double *split)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int change = 0;
|
int change = 0;
|
||||||
for (int i = 1; i < n; i++)
|
for (i = 1; i < n; i++)
|
||||||
if (sum[i] != target[i]) {
|
if (sum[i] != target[i]) {
|
||||||
change = 1;
|
change = 1;
|
||||||
if (rho == 0) split[i] = 0.5 * (lo[i]+hi[i]);
|
if (rho == 0) split[i] = 0.5 * (lo[i]+hi[i]);
|
||||||
|
|||||||
@ -182,9 +182,9 @@ void BondHybrid::settings(int narg, char **arg)
|
|||||||
// delete old lists, since cannot just change settings
|
// delete old lists, since cannot just change settings
|
||||||
|
|
||||||
if (nstyles) {
|
if (nstyles) {
|
||||||
for (int i = 0; i < nstyles; i++) delete styles[i];
|
for (i = 0; i < nstyles; i++) delete styles[i];
|
||||||
delete [] styles;
|
delete [] styles;
|
||||||
for (int i = 0; i < nstyles; i++) delete [] keywords[i];
|
for (i = 0; i < nstyles; i++) delete [] keywords[i];
|
||||||
delete [] keywords;
|
delete [] keywords;
|
||||||
has_quartic = -1;
|
has_quartic = -1;
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ void BondHybrid::settings(int narg, char **arg)
|
|||||||
memory->destroy(map);
|
memory->destroy(map);
|
||||||
delete [] nbondlist;
|
delete [] nbondlist;
|
||||||
delete [] maxbond;
|
delete [] maxbond;
|
||||||
for (int i = 0; i < nstyles; i++)
|
for (i = 0; i < nstyles; i++)
|
||||||
memory->destroy(bondlist[i]);
|
memory->destroy(bondlist[i]);
|
||||||
delete [] bondlist;
|
delete [] bondlist;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -193,7 +193,7 @@ void ChangeBox::command(int narg, char **arg)
|
|||||||
// compute scale factors if FINAL,DELTA used since they have distance units
|
// compute scale factors if FINAL,DELTA used since they have distance units
|
||||||
|
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
for (int i = 0; i < nops; i++)
|
for (i = 0; i < nops; i++)
|
||||||
if (ops[i].style == FINAL || ops[i].style == DELTA) flag = 1;
|
if (ops[i].style == FINAL || ops[i].style == DELTA) flag = 1;
|
||||||
|
|
||||||
if (flag && scaleflag) {
|
if (flag && scaleflag) {
|
||||||
@ -295,7 +295,7 @@ void ChangeBox::command(int narg, char **arg)
|
|||||||
if (output->ndump)
|
if (output->ndump)
|
||||||
error->all(FLERR,
|
error->all(FLERR,
|
||||||
"Cannot change box ortho/triclinic with dumps defined");
|
"Cannot change box ortho/triclinic with dumps defined");
|
||||||
for (int i = 0; i < modify->nfix; i++)
|
for (i = 0; i < modify->nfix; i++)
|
||||||
if (modify->fix[i]->no_change_box)
|
if (modify->fix[i]->no_change_box)
|
||||||
error->all(FLERR,
|
error->all(FLERR,
|
||||||
"Cannot change box ortho/triclinic with "
|
"Cannot change box ortho/triclinic with "
|
||||||
@ -310,7 +310,7 @@ void ChangeBox::command(int narg, char **arg)
|
|||||||
if (output->ndump)
|
if (output->ndump)
|
||||||
error->all(FLERR,
|
error->all(FLERR,
|
||||||
"Cannot change box ortho/triclinic with dumps defined");
|
"Cannot change box ortho/triclinic with dumps defined");
|
||||||
for (int i = 0; i < modify->nfix; i++)
|
for (i = 0; i < modify->nfix; i++)
|
||||||
if (modify->fix[i]->no_change_box)
|
if (modify->fix[i]->no_change_box)
|
||||||
error->all(FLERR,
|
error->all(FLERR,
|
||||||
"Cannot change box ortho/triclinic with "
|
"Cannot change box ortho/triclinic with "
|
||||||
|
|||||||
@ -101,7 +101,7 @@ void ComputeAngmomChunk::compute_array()
|
|||||||
|
|
||||||
// zero local per-chunk values
|
// zero local per-chunk values
|
||||||
|
|
||||||
for (int i = 0; i < nchunk; i++) {
|
for (i = 0; i < nchunk; i++) {
|
||||||
massproc[i] = 0.0;
|
massproc[i] = 0.0;
|
||||||
com[i][0] = com[i][1] = com[i][2] = 0.0;
|
com[i][0] = com[i][1] = com[i][2] = 0.0;
|
||||||
angmom[i][0] = angmom[i][1] = angmom[i][2] = 0.0;
|
angmom[i][0] = angmom[i][1] = angmom[i][2] = 0.0;
|
||||||
@ -117,7 +117,7 @@ void ComputeAngmomChunk::compute_array()
|
|||||||
double *rmass = atom->rmass;
|
double *rmass = atom->rmass;
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++)
|
for (i = 0; i < nlocal; i++)
|
||||||
if (mask[i] & groupbit) {
|
if (mask[i] & groupbit) {
|
||||||
index = ichunk[i]-1;
|
index = ichunk[i]-1;
|
||||||
if (index < 0) continue;
|
if (index < 0) continue;
|
||||||
@ -133,7 +133,7 @@ void ComputeAngmomChunk::compute_array()
|
|||||||
MPI_Allreduce(massproc,masstotal,nchunk,MPI_DOUBLE,MPI_SUM,world);
|
MPI_Allreduce(massproc,masstotal,nchunk,MPI_DOUBLE,MPI_SUM,world);
|
||||||
MPI_Allreduce(&com[0][0],&comall[0][0],3*nchunk,MPI_DOUBLE,MPI_SUM,world);
|
MPI_Allreduce(&com[0][0],&comall[0][0],3*nchunk,MPI_DOUBLE,MPI_SUM,world);
|
||||||
|
|
||||||
for (int i = 0; i < nchunk; i++) {
|
for (i = 0; i < nchunk; i++) {
|
||||||
if (masstotal[i] > 0.0) {
|
if (masstotal[i] > 0.0) {
|
||||||
comall[i][0] /= masstotal[i];
|
comall[i][0] /= masstotal[i];
|
||||||
comall[i][1] /= masstotal[i];
|
comall[i][1] /= masstotal[i];
|
||||||
|
|||||||
@ -269,7 +269,7 @@ void ComputeCentroAtom::compute_peratom()
|
|||||||
delx = x[jj][0] + x[kk][0] - 2.0*xtmp;
|
delx = x[jj][0] + x[kk][0] - 2.0*xtmp;
|
||||||
dely = x[jj][1] + x[kk][1] - 2.0*ytmp;
|
dely = x[jj][1] + x[kk][1] - 2.0*ytmp;
|
||||||
delz = x[jj][2] + x[kk][2] - 2.0*ztmp;
|
delz = x[jj][2] + x[kk][2] - 2.0*ztmp;
|
||||||
double rsq = delx*delx + dely*dely + delz*delz;
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
pairs[n++] = rsq;
|
pairs[n++] = rsq;
|
||||||
|
|
||||||
if (rsq < rsq2) {
|
if (rsq < rsq2) {
|
||||||
|
|||||||
@ -687,6 +687,7 @@ void ComputeChunkAtom::compute_ichunk()
|
|||||||
// or if idsflag = NFREQ and lock is in place and are on later timestep
|
// or if idsflag = NFREQ and lock is in place and are on later timestep
|
||||||
// else proceed to recalculate per-atom chunk assignments
|
// else proceed to recalculate per-atom chunk assignments
|
||||||
|
|
||||||
|
const int nlocal = atom->nlocal;
|
||||||
int restore = 0;
|
int restore = 0;
|
||||||
if (idsflag == ONCE && invoked_ichunk >= 0) restore = 1;
|
if (idsflag == ONCE && invoked_ichunk >= 0) restore = 1;
|
||||||
if (idsflag == NFREQ && lockfix && update->ntimestep > lockstart) restore = 1;
|
if (idsflag == NFREQ && lockfix && update->ntimestep > lockstart) restore = 1;
|
||||||
@ -694,7 +695,6 @@ void ComputeChunkAtom::compute_ichunk()
|
|||||||
if (restore) {
|
if (restore) {
|
||||||
invoked_ichunk = update->ntimestep;
|
invoked_ichunk = update->ntimestep;
|
||||||
double *vstore = fixstore->vstore;
|
double *vstore = fixstore->vstore;
|
||||||
int nlocal = atom->nlocal;
|
|
||||||
for (i = 0; i < nlocal; i++) ichunk[i] = static_cast<int> (vstore[i]);
|
for (i = 0; i < nlocal; i++) ichunk[i] = static_cast<int> (vstore[i]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -711,8 +711,6 @@ void ComputeChunkAtom::compute_ichunk()
|
|||||||
// compress chunk IDs via hash of the original uncompressed IDs
|
// compress chunk IDs via hash of the original uncompressed IDs
|
||||||
// also apply discard rule except for binning styles which already did
|
// also apply discard rule except for binning styles which already did
|
||||||
|
|
||||||
int nlocal = atom->nlocal;
|
|
||||||
|
|
||||||
if (compress) {
|
if (compress) {
|
||||||
if (binflag) {
|
if (binflag) {
|
||||||
for (i = 0; i < nlocal; i++) {
|
for (i = 0; i < nlocal; i++) {
|
||||||
@ -761,8 +759,7 @@ void ComputeChunkAtom::compute_ichunk()
|
|||||||
|
|
||||||
if (idsflag == ONCE || (idsflag == NFREQ && lockfix)) {
|
if (idsflag == ONCE || (idsflag == NFREQ && lockfix)) {
|
||||||
double *vstore = fixstore->vstore;
|
double *vstore = fixstore->vstore;
|
||||||
int nlocal = atom->nlocal;
|
for (i = 0; i < nlocal; i++) vstore[i] = ichunk[i];
|
||||||
for (int i = 0; i < nlocal; i++) vstore[i] = ichunk[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// one-time check if which = MOLECULE and
|
// one-time check if which = MOLECULE and
|
||||||
@ -897,7 +894,7 @@ void ComputeChunkAtom::assign_chunk_ids()
|
|||||||
|
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
int *mask = atom->mask;
|
int *mask = atom->mask;
|
||||||
int nlocal = atom->nlocal;
|
const int nlocal = atom->nlocal;
|
||||||
|
|
||||||
if (regionflag) {
|
if (regionflag) {
|
||||||
for (i = 0; i < nlocal; i++) {
|
for (i = 0; i < nlocal; i++) {
|
||||||
|
|||||||
@ -119,7 +119,7 @@ void ComputeDipoleChunk::compute_array()
|
|||||||
|
|
||||||
// zero local per-chunk values
|
// zero local per-chunk values
|
||||||
|
|
||||||
for (int i = 0; i < nchunk; i++) {
|
for (i = 0; i < nchunk; i++) {
|
||||||
massproc[i] = chrgproc[i] = 0.0;
|
massproc[i] = chrgproc[i] = 0.0;
|
||||||
com[i][0] = com[i][1] = com[i][2] = 0.0;
|
com[i][0] = com[i][1] = com[i][2] = 0.0;
|
||||||
dipole[i][0] = dipole[i][1] = dipole[i][2] = dipole[i][3] = 0.0;
|
dipole[i][0] = dipole[i][1] = dipole[i][2] = dipole[i][3] = 0.0;
|
||||||
@ -138,7 +138,7 @@ void ComputeDipoleChunk::compute_array()
|
|||||||
|
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++)
|
for (i = 0; i < nlocal; i++)
|
||||||
if (mask[i] & groupbit) {
|
if (mask[i] & groupbit) {
|
||||||
index = ichunk[i]-1;
|
index = ichunk[i]-1;
|
||||||
if (index < 0) continue;
|
if (index < 0) continue;
|
||||||
@ -159,7 +159,7 @@ void ComputeDipoleChunk::compute_array()
|
|||||||
MPI_Allreduce(chrgproc,chrgtotal,nchunk,MPI_DOUBLE,MPI_SUM,world);
|
MPI_Allreduce(chrgproc,chrgtotal,nchunk,MPI_DOUBLE,MPI_SUM,world);
|
||||||
MPI_Allreduce(&com[0][0],&comall[0][0],3*nchunk,MPI_DOUBLE,MPI_SUM,world);
|
MPI_Allreduce(&com[0][0],&comall[0][0],3*nchunk,MPI_DOUBLE,MPI_SUM,world);
|
||||||
|
|
||||||
for (int i = 0; i < nchunk; i++) {
|
for (i = 0; i < nchunk; i++) {
|
||||||
if (masstotal[i] > 0.0) {
|
if (masstotal[i] > 0.0) {
|
||||||
comall[i][0] /= masstotal[i];
|
comall[i][0] /= masstotal[i];
|
||||||
comall[i][1] /= masstotal[i];
|
comall[i][1] /= masstotal[i];
|
||||||
|
|||||||
@ -74,14 +74,14 @@ ComputeGlobalAtom::ComputeGlobalAtom(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
nvalues = 0;
|
nvalues = 0;
|
||||||
|
|
||||||
for (iarg = 0; iarg < nargnew; iarg++) {
|
for (iarg = 0; iarg < nargnew; iarg++) {
|
||||||
ArgInfo argi(arg[iarg]);
|
ArgInfo argi2(arg[iarg]);
|
||||||
|
|
||||||
which[nvalues] = argi.get_type();
|
which[nvalues] = argi2.get_type();
|
||||||
argindex[nvalues] = argi.get_index1();
|
argindex[nvalues] = argi2.get_index1();
|
||||||
ids[nvalues] = argi.copy_name();
|
ids[nvalues] = argi2.copy_name();
|
||||||
|
|
||||||
if ((which[nvalues] == ArgInfo::UNKNOWN) || (which[nvalues] == ArgInfo::NONE)
|
if ((which[nvalues] == ArgInfo::UNKNOWN) || (which[nvalues] == ArgInfo::NONE)
|
||||||
|| (argi.get_dim() > 1))
|
|| (argi2.get_dim() > 1))
|
||||||
error->all(FLERR,"Illegal compute slice command");
|
error->all(FLERR,"Illegal compute slice command");
|
||||||
|
|
||||||
nvalues++;
|
nvalues++;
|
||||||
|
|||||||
@ -109,18 +109,16 @@ double ComputeReduceRegion::compute_one(int m, int flag)
|
|||||||
|
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
double *compute_vector = compute->vector_atom;
|
double *compute_vector = compute->vector_atom;
|
||||||
int n = nlocal;
|
|
||||||
if (flag < 0) {
|
if (flag < 0) {
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < nlocal; i++)
|
||||||
if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]))
|
if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]))
|
||||||
combine(one,compute_vector[i],i);
|
combine(one,compute_vector[i],i);
|
||||||
} else one = compute_vector[flag];
|
} else one = compute_vector[flag];
|
||||||
} else {
|
} else {
|
||||||
double **compute_array = compute->array_atom;
|
double **compute_array = compute->array_atom;
|
||||||
int n = nlocal;
|
|
||||||
int jm1 = j - 1;
|
int jm1 = j - 1;
|
||||||
if (flag < 0) {
|
if (flag < 0) {
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < nlocal; i++)
|
||||||
if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]))
|
if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]))
|
||||||
combine(one,compute_array[i][jm1],i);
|
combine(one,compute_array[i][jm1],i);
|
||||||
} else one = compute_array[flag][jm1];
|
} else one = compute_array[flag][jm1];
|
||||||
@ -134,17 +132,15 @@ double ComputeReduceRegion::compute_one(int m, int flag)
|
|||||||
|
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
double *compute_vector = compute->vector_local;
|
double *compute_vector = compute->vector_local;
|
||||||
int n = compute->size_local_rows;
|
|
||||||
if (flag < 0)
|
if (flag < 0)
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < compute->size_local_rows; i++)
|
||||||
combine(one,compute_vector[i],i);
|
combine(one,compute_vector[i],i);
|
||||||
else one = compute_vector[flag];
|
else one = compute_vector[flag];
|
||||||
} else {
|
} else {
|
||||||
double **compute_array = compute->array_local;
|
double **compute_array = compute->array_local;
|
||||||
int n = compute->size_local_rows;
|
|
||||||
int jm1 = j - 1;
|
int jm1 = j - 1;
|
||||||
if (flag < 0)
|
if (flag < 0)
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < compute->size_local_rows; i++)
|
||||||
combine(one,compute_array[i][jm1],i);
|
combine(one,compute_array[i][jm1],i);
|
||||||
else one = compute_array[flag][jm1];
|
else one = compute_array[flag][jm1];
|
||||||
}
|
}
|
||||||
@ -161,9 +157,8 @@ double ComputeReduceRegion::compute_one(int m, int flag)
|
|||||||
if (flavor[m] == PERATOM) {
|
if (flavor[m] == PERATOM) {
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
double *fix_vector = fix->vector_atom;
|
double *fix_vector = fix->vector_atom;
|
||||||
int n = nlocal;
|
|
||||||
if (flag < 0) {
|
if (flag < 0) {
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < nlocal; i++)
|
||||||
if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]))
|
if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]))
|
||||||
combine(one,fix_vector[i],i);
|
combine(one,fix_vector[i],i);
|
||||||
} else one = fix_vector[flag];
|
} else one = fix_vector[flag];
|
||||||
@ -180,17 +175,15 @@ double ComputeReduceRegion::compute_one(int m, int flag)
|
|||||||
} else if (flavor[m] == LOCAL) {
|
} else if (flavor[m] == LOCAL) {
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
double *fix_vector = fix->vector_local;
|
double *fix_vector = fix->vector_local;
|
||||||
int n = fix->size_local_rows;
|
|
||||||
if (flag < 0)
|
if (flag < 0)
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < fix->size_local_rows; i++)
|
||||||
combine(one,fix_vector[i],i);
|
combine(one,fix_vector[i],i);
|
||||||
else one = fix_vector[flag];
|
else one = fix_vector[flag];
|
||||||
} else {
|
} else {
|
||||||
double **fix_array = fix->array_local;
|
double **fix_array = fix->array_local;
|
||||||
int n = fix->size_local_rows;
|
|
||||||
int jm1 = j - 1;
|
int jm1 = j - 1;
|
||||||
if (flag < 0)
|
if (flag < 0)
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < fix->size_local_rows; i++)
|
||||||
combine(one,fix_array[i][jm1],i);
|
combine(one,fix_array[i][jm1],i);
|
||||||
else one = fix_array[flag][jm1];
|
else one = fix_array[flag][jm1];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -135,8 +135,8 @@ void ComputeTempSphere::dof_compute()
|
|||||||
// user should correct this via compute_modify if needed
|
// user should correct this via compute_modify if needed
|
||||||
|
|
||||||
double *radius = atom->radius;
|
double *radius = atom->radius;
|
||||||
int *mask = atom->mask;
|
const int *mask = atom->mask;
|
||||||
int nlocal = atom->nlocal;
|
const int nlocal = atom->nlocal;
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
if (domain->dimension == 3) {
|
if (domain->dimension == 3) {
|
||||||
@ -170,9 +170,6 @@ void ComputeTempSphere::dof_compute()
|
|||||||
if (mode == ALL) dof -= tbias->dof_remove(-1) * natoms_temp;
|
if (mode == ALL) dof -= tbias->dof_remove(-1) * natoms_temp;
|
||||||
|
|
||||||
} else if (tempbias == 2) {
|
} else if (tempbias == 2) {
|
||||||
int *mask = atom->mask;
|
|
||||||
int nlocal = atom->nlocal;
|
|
||||||
|
|
||||||
tbias->dof_remove_pre();
|
tbias->dof_remove_pre();
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|||||||
@ -310,7 +310,7 @@ void CreateBonds::many()
|
|||||||
// recount bonds
|
// recount bonds
|
||||||
|
|
||||||
bigint nbonds = 0;
|
bigint nbonds = 0;
|
||||||
for (int i = 0; i < nlocal; i++) nbonds += num_bond[i];
|
for (i = 0; i < nlocal; i++) nbonds += num_bond[i];
|
||||||
|
|
||||||
MPI_Allreduce(&nbonds,&atom->nbonds,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
MPI_Allreduce(&nbonds,&atom->nbonds,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
if (!force->newton_bond) atom->nbonds /= 2;
|
if (!force->newton_bond) atom->nbonds /= 2;
|
||||||
|
|||||||
@ -177,9 +177,9 @@ void DihedralHybrid::settings(int narg, char **arg)
|
|||||||
// delete old lists, since cannot just change settings
|
// delete old lists, since cannot just change settings
|
||||||
|
|
||||||
if (nstyles) {
|
if (nstyles) {
|
||||||
for (int i = 0; i < nstyles; i++) delete styles[i];
|
for (i = 0; i < nstyles; i++) delete styles[i];
|
||||||
delete [] styles;
|
delete [] styles;
|
||||||
for (int i = 0; i < nstyles; i++) delete [] keywords[i];
|
for (i = 0; i < nstyles; i++) delete [] keywords[i];
|
||||||
delete [] keywords;
|
delete [] keywords;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ void DihedralHybrid::settings(int narg, char **arg)
|
|||||||
memory->destroy(map);
|
memory->destroy(map);
|
||||||
delete [] ndihedrallist;
|
delete [] ndihedrallist;
|
||||||
delete [] maxdihedral;
|
delete [] maxdihedral;
|
||||||
for (int i = 0; i < nstyles; i++)
|
for (i = 0; i < nstyles; i++)
|
||||||
memory->destroy(dihedrallist[i]);
|
memory->destroy(dihedrallist[i]);
|
||||||
delete [] dihedrallist;
|
delete [] dihedrallist;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -317,14 +317,14 @@ void DumpCustom::init_style()
|
|||||||
// check that fix frequency is acceptable
|
// check that fix frequency is acceptable
|
||||||
|
|
||||||
int icompute;
|
int icompute;
|
||||||
for (int i = 0; i < ncompute; i++) {
|
for (i = 0; i < ncompute; i++) {
|
||||||
icompute = modify->find_compute(id_compute[i]);
|
icompute = modify->find_compute(id_compute[i]);
|
||||||
if (icompute < 0) error->all(FLERR,"Could not find dump custom compute ID");
|
if (icompute < 0) error->all(FLERR,"Could not find dump custom compute ID");
|
||||||
compute[i] = modify->compute[icompute];
|
compute[i] = modify->compute[icompute];
|
||||||
}
|
}
|
||||||
|
|
||||||
int ifix;
|
int ifix;
|
||||||
for (int i = 0; i < nfix; i++) {
|
for (i = 0; i < nfix; i++) {
|
||||||
ifix = modify->find_fix(id_fix[i]);
|
ifix = modify->find_fix(id_fix[i]);
|
||||||
if (ifix < 0) error->all(FLERR,"Could not find dump custom fix ID");
|
if (ifix < 0) error->all(FLERR,"Could not find dump custom fix ID");
|
||||||
fix[i] = modify->fix[ifix];
|
fix[i] = modify->fix[ifix];
|
||||||
@ -333,7 +333,7 @@ void DumpCustom::init_style()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ivariable;
|
int ivariable;
|
||||||
for (int i = 0; i < nvariable; i++) {
|
for (i = 0; i < nvariable; i++) {
|
||||||
ivariable = input->variable->find(id_variable[i]);
|
ivariable = input->variable->find(id_variable[i]);
|
||||||
if (ivariable < 0)
|
if (ivariable < 0)
|
||||||
error->all(FLERR,"Could not find dump custom variable name");
|
error->all(FLERR,"Could not find dump custom variable name");
|
||||||
@ -341,7 +341,7 @@ void DumpCustom::init_style()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int icustom;
|
int icustom;
|
||||||
for (int i = 0; i < ncustom; i++) {
|
for (i = 0; i < ncustom; i++) {
|
||||||
icustom = atom->find_custom(id_custom[i],flag_custom[i]);
|
icustom = atom->find_custom(id_custom[i],flag_custom[i]);
|
||||||
if (icustom < 0)
|
if (icustom < 0)
|
||||||
error->all(FLERR,"Could not find custom per-atom property ID");
|
error->all(FLERR,"Could not find custom per-atom property ID");
|
||||||
@ -546,7 +546,7 @@ int DumpCustom::count()
|
|||||||
|
|
||||||
// grow choose and variable vbuf arrays if needed
|
// grow choose and variable vbuf arrays if needed
|
||||||
|
|
||||||
int nlocal = atom->nlocal;
|
const int nlocal = atom->nlocal;
|
||||||
if (atom->nmax > maxlocal) {
|
if (atom->nmax > maxlocal) {
|
||||||
maxlocal = atom->nmax;
|
maxlocal = atom->nmax;
|
||||||
|
|
||||||
@ -620,7 +620,6 @@ int DumpCustom::count()
|
|||||||
double *values;
|
double *values;
|
||||||
double value;
|
double value;
|
||||||
int nstride,lastflag;
|
int nstride,lastflag;
|
||||||
int nlocal = atom->nlocal;
|
|
||||||
|
|
||||||
for (int ithresh = 0; ithresh < nthresh; ithresh++) {
|
for (int ithresh = 0; ithresh < nthresh; ithresh++) {
|
||||||
|
|
||||||
@ -1536,7 +1535,6 @@ int DumpCustom::parse_fields(int narg, char **arg)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
return iarg;
|
return iarg;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1042,7 +1042,7 @@ void DumpImage::create_image()
|
|||||||
// render outline of my sub-box, orthogonal or triclinic
|
// render outline of my sub-box, orthogonal or triclinic
|
||||||
|
|
||||||
if (subboxflag) {
|
if (subboxflag) {
|
||||||
double diameter = MIN(boxxhi-boxxlo,boxyhi-boxylo);
|
diameter = MIN(boxxhi-boxxlo,boxyhi-boxylo);
|
||||||
if (domain->dimension == 3) diameter = MIN(diameter,boxzhi-boxzlo);
|
if (domain->dimension == 3) diameter = MIN(diameter,boxzhi-boxzlo);
|
||||||
diameter *= subboxdiam;
|
diameter *= subboxdiam;
|
||||||
|
|
||||||
@ -1072,7 +1072,7 @@ void DumpImage::create_image()
|
|||||||
// render outline of simulation box, orthogonal or triclinic
|
// render outline of simulation box, orthogonal or triclinic
|
||||||
|
|
||||||
if (boxflag) {
|
if (boxflag) {
|
||||||
double diameter = MIN(boxxhi-boxxlo,boxyhi-boxylo);
|
diameter = MIN(boxxhi-boxxlo,boxyhi-boxylo);
|
||||||
if (domain->dimension == 3) diameter = MIN(diameter,boxzhi-boxzlo);
|
if (domain->dimension == 3) diameter = MIN(diameter,boxzhi-boxzlo);
|
||||||
diameter *= boxdiam;
|
diameter *= boxdiam;
|
||||||
|
|
||||||
@ -1100,7 +1100,7 @@ void DumpImage::create_image()
|
|||||||
// offset by 10% of box size and scale by axeslen
|
// offset by 10% of box size and scale by axeslen
|
||||||
|
|
||||||
if (axesflag) {
|
if (axesflag) {
|
||||||
double diameter = MIN(boxxhi-boxxlo,boxyhi-boxylo);
|
diameter = MIN(boxxhi-boxxlo,boxyhi-boxylo);
|
||||||
if (domain->dimension == 3) diameter = MIN(diameter,boxzhi-boxzlo);
|
if (domain->dimension == 3) diameter = MIN(diameter,boxzhi-boxzlo);
|
||||||
diameter *= axesdiam;
|
diameter *= axesdiam;
|
||||||
|
|
||||||
|
|||||||
@ -198,14 +198,14 @@ void DumpLocal::init_style()
|
|||||||
// check that fix frequency is acceptable
|
// check that fix frequency is acceptable
|
||||||
|
|
||||||
int icompute;
|
int icompute;
|
||||||
for (int i = 0; i < ncompute; i++) {
|
for (i = 0; i < ncompute; i++) {
|
||||||
icompute = modify->find_compute(id_compute[i]);
|
icompute = modify->find_compute(id_compute[i]);
|
||||||
if (icompute < 0) error->all(FLERR,"Could not find dump local compute ID");
|
if (icompute < 0) error->all(FLERR,"Could not find dump local compute ID");
|
||||||
compute[i] = modify->compute[icompute];
|
compute[i] = modify->compute[icompute];
|
||||||
}
|
}
|
||||||
|
|
||||||
int ifix;
|
int ifix;
|
||||||
for (int i = 0; i < nfix; i++) {
|
for (i = 0; i < nfix; i++) {
|
||||||
ifix = modify->find_fix(id_fix[i]);
|
ifix = modify->find_fix(id_fix[i]);
|
||||||
if (ifix < 0) error->all(FLERR,"Could not find dump local fix ID");
|
if (ifix < 0) error->all(FLERR,"Could not find dump local fix ID");
|
||||||
fix[i] = modify->fix[ifix];
|
fix[i] = modify->fix[ifix];
|
||||||
@ -332,14 +332,14 @@ int DumpLocal::count()
|
|||||||
|
|
||||||
nmine = -1;
|
nmine = -1;
|
||||||
|
|
||||||
for (int i = 0; i < ncompute; i++) {
|
for (i = 0; i < ncompute; i++) {
|
||||||
if (nmine < 0) nmine = compute[i]->size_local_rows;
|
if (nmine < 0) nmine = compute[i]->size_local_rows;
|
||||||
else if (nmine != compute[i]->size_local_rows)
|
else if (nmine != compute[i]->size_local_rows)
|
||||||
error->one(FLERR,
|
error->one(FLERR,
|
||||||
"Dump local count is not consistent across input fields");
|
"Dump local count is not consistent across input fields");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nfix; i++) {
|
for (i = 0; i < nfix; i++) {
|
||||||
if (nmine < 0) nmine = fix[i]->size_local_rows;
|
if (nmine < 0) nmine = fix[i]->size_local_rows;
|
||||||
else if (nmine != fix[i]->size_local_rows)
|
else if (nmine != fix[i]->size_local_rows)
|
||||||
error->one(FLERR,
|
error->one(FLERR,
|
||||||
|
|||||||
@ -488,7 +488,7 @@ void FixAveChunk::init()
|
|||||||
|
|
||||||
for (int m = 0; m < nvalues; m++) {
|
for (int m = 0; m < nvalues; m++) {
|
||||||
if (which[m] == ArgInfo::COMPUTE) {
|
if (which[m] == ArgInfo::COMPUTE) {
|
||||||
int icompute = modify->find_compute(ids[m]);
|
icompute = modify->find_compute(ids[m]);
|
||||||
if (icompute < 0)
|
if (icompute < 0)
|
||||||
error->all(FLERR,"Compute ID for fix ave/chunk does not exist");
|
error->all(FLERR,"Compute ID for fix ave/chunk does not exist");
|
||||||
value2index[m] = icompute;
|
value2index[m] = icompute;
|
||||||
@ -984,7 +984,6 @@ void FixAveChunk::end_of_step()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int j;
|
|
||||||
if (ncoord == 0) {
|
if (ncoord == 0) {
|
||||||
for (m = 0; m < nchunk; m++) {
|
for (m = 0; m < nchunk; m++) {
|
||||||
fprintf(fp," %d %d %g",m+1,chunkID[m],count_total[m]/normcount);
|
fprintf(fp," %d %d %g",m+1,chunkID[m],count_total[m]/normcount);
|
||||||
|
|||||||
Reference in New Issue
Block a user