whitespace fixes

This commit is contained in:
Axel Kohlmeyer
2021-08-18 13:06:00 -04:00
parent 4fed16fe8b
commit e08c4abb4b
13 changed files with 90 additions and 90 deletions

View File

@ -136,7 +136,7 @@ When that command is used specific names are given to each attribute
which are the "name" portion of these attributes. For arrays *i2_name* which are the "name" portion of these attributes. For arrays *i2_name*
and *d2_name*, the column of the array must also be included following and *d2_name*, the column of the array must also be included following
the name in brackets: e.g. d2_xyz[2], i2_mySpin[3]. the name in brackets: e.g. d2_xyz[2], i2_mySpin[3].
The additional quantities only accessible via this command, and not The additional quantities only accessible via this command, and not
directly via the :doc:`dump custom <dump>` command, are as follows. directly via the :doc:`dump custom <dump>` command, are as follows.

View File

@ -272,7 +272,7 @@ int AtomKokkos::add_custom(const char *name, int flag, int cols)
ivector = (int **) memory->srealloc(ivector,nivector*sizeof(int *), ivector = (int **) memory->srealloc(ivector,nivector*sizeof(int *),
"atom:ivector"); "atom:ivector");
memory->create(ivector[index],nmax,"atom:ivector"); memory->create(ivector[index],nmax,"atom:ivector");
} else if (flag == 1 && cols == 0) { } else if (flag == 1 && cols == 0) {
index = ndvector; index = ndvector;
ndvector++; ndvector++;
@ -299,10 +299,10 @@ int AtomKokkos::add_custom(const char *name, int flag, int cols)
iarray = (int ***) memory->srealloc(iarray,niarray*sizeof(int **), iarray = (int ***) memory->srealloc(iarray,niarray*sizeof(int **),
"atom:iarray"); "atom:iarray");
memory->create(iarray[index],nmax,cols,"atom:iarray"); memory->create(iarray[index],nmax,cols,"atom:iarray");
icols = (int *) memory->srealloc(icols,niarray*sizeof(int),"atom:icols"); icols = (int *) memory->srealloc(icols,niarray*sizeof(int),"atom:icols");
icols[index] = cols; icols[index] = cols;
} else if (flag == 1 && cols) { } else if (flag == 1 && cols) {
index = ndarray; index = ndarray;
ndarray++; ndarray++;
@ -318,7 +318,7 @@ int AtomKokkos::add_custom(const char *name, int flag, int cols)
dcols = (int *) memory->srealloc(dcols,ndarray*sizeof(int),"atom:dcols"); dcols = (int *) memory->srealloc(dcols,ndarray*sizeof(int),"atom:dcols");
dcols[index] = cols; dcols[index] = cols;
} }
return index; return index;
} }
@ -335,7 +335,7 @@ void AtomKokkos::remove_custom(int index, int flag, int cols)
ivector[index] = NULL; ivector[index] = NULL;
delete [] ivname[index]; delete [] ivname[index];
ivname[index] = NULL; ivname[index] = NULL;
} else if (flag == 1 && cols == 0) { } else if (flag == 1 && cols == 0) {
dvector[index] = NULL; dvector[index] = NULL;
delete [] dvname[index]; delete [] dvname[index];
@ -346,7 +346,7 @@ void AtomKokkos::remove_custom(int index, int flag, int cols)
iarray[index] = NULL; iarray[index] = NULL;
delete [] ianame[index]; delete [] ianame[index];
ianame[index] = NULL; ianame[index] = NULL;
} else if (flag == 1 && cols) { } else if (flag == 1 && cols) {
memory->destroy(darray[index]); memory->destroy(darray[index]);
darray[index] = NULL; darray[index] = NULL;

View File

@ -757,7 +757,7 @@ int DumpVTK::count()
i = ATTRIBUTES + nfield + ithresh; i = ATTRIBUTES + nfield + ithresh;
iwhich = atom->find_custom(id_custom[field2index[i]],flag,cols); iwhich = atom->find_custom(id_custom[field2index[i]],flag,cols);
int *ivector = atom->ivector[iwhich]; int *ivector = atom->ivector[iwhich];
for (i = 0; i < nlocal; i++) for (i = 0; i < nlocal; i++)
dchoose[i] = ivector[i]; dchoose[i] = ivector[i];
ptr = dchoose; ptr = dchoose;
nstride = 1; nstride = 1;
@ -775,7 +775,7 @@ int DumpVTK::count()
iwhich = atom->find_custom(id_custom[field2index[i]],flag,cols); iwhich = atom->find_custom(id_custom[field2index[i]],flag,cols);
int **iarray = atom->iarray[iwhich]; int **iarray = atom->iarray[iwhich];
int icol = argindex[i] - 1; int icol = argindex[i] - 1;
for (i = 0; i < nlocal; i++) for (i = 0; i < nlocal; i++)
dchoose[i] = iarray[i][icol]; dchoose[i] = iarray[i][icol];
ptr = dchoose; ptr = dchoose;
nstride = 1; nstride = 1;
@ -1827,7 +1827,7 @@ int DumpVTK::parse_fields(int narg, char **arg)
field2index[ATTRIBUTES+i] = add_variable(argi.get_name()); field2index[ATTRIBUTES+i] = add_variable(argi.get_name());
name[ATTRIBUTES+i] = arg[iarg]; name[ATTRIBUTES+i] = arg[iarg];
break; break;
// custom per-atom integer vector = i_ID // custom per-atom integer vector = i_ID
case ArgInfo::INAME: case ArgInfo::INAME:

View File

@ -2481,7 +2481,7 @@ int Atom::add_custom(const char *name, int flag, int cols)
ivector = (int **) memory->srealloc(ivector,nivector*sizeof(int *), ivector = (int **) memory->srealloc(ivector,nivector*sizeof(int *),
"atom:ivector"); "atom:ivector");
memory->create(ivector[index],nmax,"atom:ivector"); memory->create(ivector[index],nmax,"atom:ivector");
} else if (flag == 1 && cols == 0) { } else if (flag == 1 && cols == 0) {
index = ndvector; index = ndvector;
ndvector++; ndvector++;
@ -2501,10 +2501,10 @@ int Atom::add_custom(const char *name, int flag, int cols)
iarray = (int ***) memory->srealloc(iarray,niarray*sizeof(int **), iarray = (int ***) memory->srealloc(iarray,niarray*sizeof(int **),
"atom:iarray"); "atom:iarray");
memory->create(iarray[index],nmax,cols,"atom:iarray"); memory->create(iarray[index],nmax,cols,"atom:iarray");
icols = (int *) memory->srealloc(icols,niarray*sizeof(int),"atom:icols"); icols = (int *) memory->srealloc(icols,niarray*sizeof(int),"atom:icols");
icols[index] = cols; icols[index] = cols;
} else if (flag == 1 && cols) { } else if (flag == 1 && cols) {
index = ndarray; index = ndarray;
ndarray++; ndarray++;
@ -2518,7 +2518,7 @@ int Atom::add_custom(const char *name, int flag, int cols)
dcols = (int *) memory->srealloc(dcols,ndarray*sizeof(int),"atom:dcols"); dcols = (int *) memory->srealloc(dcols,ndarray*sizeof(int),"atom:dcols");
dcols[index] = cols; dcols[index] = cols;
} }
return index; return index;
} }
@ -2542,7 +2542,7 @@ void Atom::remove_custom(int index, int flag, int cols)
ivector[index] = NULL; ivector[index] = NULL;
delete [] ivname[index]; delete [] ivname[index];
ivname[index] = NULL; ivname[index] = NULL;
} else if (flag == 1 && cols == 0) { } else if (flag == 1 && cols == 0) {
memory->destroy(dvector[index]); memory->destroy(dvector[index]);
dvector[index] = NULL; dvector[index] = NULL;
@ -2554,7 +2554,7 @@ void Atom::remove_custom(int index, int flag, int cols)
iarray[index] = NULL; iarray[index] = NULL;
delete [] ianame[index]; delete [] ianame[index];
ianame[index] = NULL; ianame[index] = NULL;
} else if (flag == 1 && cols) { } else if (flag == 1 && cols) {
memory->destroy(darray[index]); memory->destroy(darray[index]);
darray[index] = NULL; darray[index] = NULL;
@ -2762,7 +2762,7 @@ void *Atom::extract(const char *name)
if (strcmp(name, "damage") == 0) return (void *) damage; if (strcmp(name, "damage") == 0) return (void *) damage;
// DPD-REACT pakage // DPD-REACT pakage
if (strcmp(name,"dpdTheta") == 0) return (void *) dpdTheta; if (strcmp(name,"dpdTheta") == 0) return (void *) dpdTheta;
// DPD-MESO package // DPD-MESO package
@ -2790,15 +2790,15 @@ void *Atom::extract(const char *name)
if (name[0] == 'd') which = 1; if (name[0] == 'd') which = 1;
int array = 0; int array = 0;
if (name[1] == '2') array = 1; if (name[1] == '2') array = 1;
int index,flag,cols; int index,flag,cols;
if (!array) index = find_custom(&name[2],flag,cols); if (!array) index = find_custom(&name[2],flag,cols);
else index = find_custom(&name[3],flag,cols); else index = find_custom(&name[3],flag,cols);
if (index < 0) return NULL; if (index < 0) return NULL;
if (which != flag) return NULL; if (which != flag) return NULL;
if ((!array && cols) || (array && !cols)) return NULL; if ((!array && cols) || (array && !cols)) return NULL;
if (!which && !array) return (void *) ivector[index]; if (!which && !array) return (void *) ivector[index];
if (which && !array) return (void *) dvector[index]; if (which && !array) return (void *) dvector[index];
if (!which && array) return (void *) iarray[index]; if (!which && array) return (void *) iarray[index];
@ -2906,14 +2906,14 @@ int Atom::extract_datatype(const char *name)
// custom vectors and arrays // custom vectors and arrays
// OLDSTYLE code // OLDSTYLE code
if (strstr(name,"i_") == name || strstr(name,"d_") == name || if (strstr(name,"i_") == name || strstr(name,"d_") == name ||
strstr(name,"i2_") == name || strstr(name,"d2_") == name) { strstr(name,"i2_") == name || strstr(name,"d2_") == name) {
int which = 0; int which = 0;
if (name[0] == 'd') which = 1; if (name[0] == 'd') which = 1;
int array = 0; int array = 0;
if (name[1] == '2') array = 1; if (name[1] == '2') array = 1;
int index,flag,cols; int index,flag,cols;
if (!array) index = find_custom(&name[2],flag,cols); if (!array) index = find_custom(&name[2],flag,cols);
else index = find_custom(&name[3],flag,cols); else index = find_custom(&name[3],flag,cols);

View File

@ -147,8 +147,8 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
pack_choice[i] = &ComputePropertyAtom::pack_mu; pack_choice[i] = &ComputePropertyAtom::pack_mu;
// pack magnetic variables // pack magnetic variables
} else if (strcmp(arg[iarg],"spx") == 0) { } else if (strcmp(arg[iarg],"spx") == 0) {
if (!atom->sp_flag) if (!atom->sp_flag)
error->all(FLERR,"Compute property/atom for " error->all(FLERR,"Compute property/atom for "
"atom property that isn't allocated"); "atom property that isn't allocated");
@ -185,7 +185,7 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
pack_choice[i] = &ComputePropertyAtom::pack_fmz; pack_choice[i] = &ComputePropertyAtom::pack_fmz;
// bond count // bond count
} else if (strcmp(arg[iarg],"nbonds") == 0) { } else if (strcmp(arg[iarg],"nbonds") == 0) {
if (!atom->molecule_flag) if (!atom->molecule_flag)
error->all(FLERR,"Compute property/atom for " error->all(FLERR,"Compute property/atom for "
@ -193,7 +193,7 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
pack_choice[i] = &ComputePropertyAtom::pack_nbonds; pack_choice[i] = &ComputePropertyAtom::pack_nbonds;
// finite-size particles // finite-size particles
} else if (strcmp(arg[iarg],"radius") == 0) { } else if (strcmp(arg[iarg],"radius") == 0) {
if (!atom->radius_flag) if (!atom->radius_flag)
error->all(FLERR,"Compute property/atom for " error->all(FLERR,"Compute property/atom for "
@ -401,11 +401,11 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
// custom per-atom arrays, must include bracketed index // custom per-atom arrays, must include bracketed index
// OLDSTYLE code // OLDSTYLE code
} else if (strstr(arg[iarg],"i2_") == arg[iarg] || } else if (strstr(arg[iarg],"i2_") == arg[iarg] ||
strstr(arg[iarg],"d2_") == arg[iarg]) { strstr(arg[iarg],"d2_") == arg[iarg]) {
int which = 0; int which = 0;
if (arg[iarg][0] == 'd') which = 1; if (arg[iarg][0] == 'd') which = 1;
int n = strlen(arg[iarg]); int n = strlen(arg[iarg]);
char *suffix = new char[n]; char *suffix = new char[n];
strcpy(suffix,&arg[iarg][3]); strcpy(suffix,&arg[iarg][3]);
@ -418,7 +418,7 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
colindex[i] = utils::inumeric(FLERR,ptr+1,true,lmp); colindex[i] = utils::inumeric(FLERR,ptr+1,true,lmp);
*ptr = '\0'; *ptr = '\0';
} else error->all(FLERR,"Compute property/atom custom array is not indexed"); } else error->all(FLERR,"Compute property/atom custom array is not indexed");
int flag,cols; int flag,cols;
index[i] = atom->find_custom(suffix,flag,cols); index[i] = atom->find_custom(suffix,flag,cols);
delete [] suffix; delete [] suffix;

View File

@ -109,7 +109,7 @@ class ComputePropertyAtom : public Compute {
void pack_tqx(int); void pack_tqx(int);
void pack_tqy(int); void pack_tqy(int);
void pack_tqz(int); void pack_tqz(int);
void pack_end1x(int); void pack_end1x(int);
void pack_end1y(int); void pack_end1y(int);
void pack_end1z(int); void pack_end1z(int);

View File

@ -1046,7 +1046,7 @@ int DumpCustom::count()
int iwhich = custom[field2index[i]]; int iwhich = custom[field2index[i]];
ptr = atom->dvector[iwhich]; ptr = atom->dvector[iwhich];
nstride = 1; nstride = 1;
} else if (thresh_array[ithresh] == IARRAY) { } else if (thresh_array[ithresh] == IARRAY) {
i = nfield + ithresh; i = nfield + ithresh;
int iwhich = custom[field2index[i]]; int iwhich = custom[field2index[i]];
@ -1977,12 +1977,12 @@ int DumpCustom::modify_param(int narg, char **arg)
"Dump custom property array is accessed out-of-range"); "Dump custom property array is accessed out-of-range");
thresh_array[nthresh] = DARRAY; thresh_array[nthresh] = DARRAY;
} }
field2index[nfield+nthresh] = add_custom(name,0); field2index[nfield+nthresh] = add_custom(name,0);
break; break;
// custom per atom integer vector or array // custom per atom integer vector or array
case ArgInfo::INAME: case ArgInfo::INAME:
n = atom->find_custom(name,flag,cols); n = atom->find_custom(name,flag,cols);
@ -2015,7 +2015,7 @@ int DumpCustom::modify_param(int narg, char **arg)
} }
// set operation type of threshold // set operation type of threshold
if (strcmp(arg[2],"<") == 0) thresh_op[nthresh] = LT; if (strcmp(arg[2],"<") == 0) thresh_op[nthresh] = LT;
else if (strcmp(arg[2],"<=") == 0) thresh_op[nthresh] = LE; else if (strcmp(arg[2],"<=") == 0) thresh_op[nthresh] = LE;
else if (strcmp(arg[2],">") == 0) thresh_op[nthresh] = GT; else if (strcmp(arg[2],">") == 0) thresh_op[nthresh] = GT;
@ -2024,11 +2024,11 @@ int DumpCustom::modify_param(int narg, char **arg)
else if (strcmp(arg[2],"!=") == 0) thresh_op[nthresh] = NEQ; else if (strcmp(arg[2],"!=") == 0) thresh_op[nthresh] = NEQ;
else if (strcmp(arg[2],"|^") == 0) thresh_op[nthresh] = XOR; else if (strcmp(arg[2],"|^") == 0) thresh_op[nthresh] = XOR;
else error->all(FLERR,"Invalid dump_modify thresh operator"); else error->all(FLERR,"Invalid dump_modify thresh operator");
// set threshold value as number or special LAST keyword // set threshold value as number or special LAST keyword
// create FixStore to hold LAST values, should work with restart // create FixStore to hold LAST values, should work with restart
// id = dump-ID + nthreshlast + DUMP_STORE, fix group = dump group // id = dump-ID + nthreshlast + DUMP_STORE, fix group = dump group
if (strcmp(arg[3],"LAST") != 0) { if (strcmp(arg[3],"LAST") != 0) {
thresh_value[nthresh] = utils::numeric(FLERR,arg[3],false,lmp); thresh_value[nthresh] = utils::numeric(FLERR,arg[3],false,lmp);
thresh_last[nthresh] = -1; thresh_last[nthresh] = -1;
@ -2038,17 +2038,17 @@ int DumpCustom::modify_param(int narg, char **arg)
thresh_fixID = (char **) thresh_fixID = (char **)
memory->srealloc(thresh_fixID,(nthreshlast+1)*sizeof(char *),"dump:thresh_fixID"); memory->srealloc(thresh_fixID,(nthreshlast+1)*sizeof(char *),"dump:thresh_fixID");
memory->grow(thresh_first,(nthreshlast+1),"dump:thresh_first"); memory->grow(thresh_first,(nthreshlast+1),"dump:thresh_first");
std::string threshid = fmt::format("{}{}_DUMP_STORE",id,nthreshlast); std::string threshid = fmt::format("{}{}_DUMP_STORE",id,nthreshlast);
thresh_fixID[nthreshlast] = utils::strdup(threshid); thresh_fixID[nthreshlast] = utils::strdup(threshid);
threshid += fmt::format(" {} STORE peratom 1 1", group->names[igroup]); threshid += fmt::format(" {} STORE peratom 1 1", group->names[igroup]);
thresh_fix[nthreshlast] = (FixStore *) modify->add_fix(threshid); thresh_fix[nthreshlast] = (FixStore *) modify->add_fix(threshid);
thresh_last[nthreshlast] = nthreshlast; thresh_last[nthreshlast] = nthreshlast;
thresh_first[nthreshlast] = 1; thresh_first[nthreshlast] = 1;
nthreshlast++; nthreshlast++;
} }
nthresh++; nthresh++;
return 4; return 4;
} }
@ -2135,7 +2135,7 @@ void DumpCustom::pack_custom(int n)
int flag = custom_flag[field2index[n]]; int flag = custom_flag[field2index[n]];
int iwhich = custom[field2index[n]]; int iwhich = custom[field2index[n]];
int index = argindex[n]; int index = argindex[n];
if (flag == IVEC) { if (flag == IVEC) {
int *ivector = atom->ivector[iwhich]; int *ivector = atom->ivector[iwhich];
for (int i = 0; i < nchoose; i++) { for (int i = 0; i < nchoose; i++) {

View File

@ -61,7 +61,7 @@ idregion(nullptr), idvar(nullptr), idprop(nullptr)
delete [] idregion; delete [] idregion;
idregion = utils::strdup(arg[iarg+1]); idregion = utils::strdup(arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"var") == 0) { } else if (strcmp(arg[iarg],"var") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal group command"); if (iarg+2 > narg) error->all(FLERR,"Illegal group command");
if (input->variable->find(arg[iarg+1]) < 0) if (input->variable->find(arg[iarg+1]) < 0)
@ -70,19 +70,19 @@ idregion(nullptr), idvar(nullptr), idprop(nullptr)
delete [] idvar; delete [] idvar;
idvar = utils::strdup(arg[iarg+1]); idvar = utils::strdup(arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"property") == 0) { } else if (strcmp(arg[iarg],"property") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal group command"); if (iarg+2 > narg) error->all(FLERR,"Illegal group command");
int flag,cols; int flag,cols;
iprop = atom->find_custom(arg[iarg+1],flag,cols); iprop = atom->find_custom(arg[iarg+1],flag,cols);
if (iprop < 1 || cols) if (iprop < 1 || cols)
error->all(FLERR,"Custom per-atom vector for group dynamic " error->all(FLERR,"Custom per-atom vector for group dynamic "
"does not exist"); "does not exist");
propflag = 1; propflag = 1;
delete [] idprop; delete [] idprop;
idprop = utils::strdup(arg[iarg+1]); idprop = utils::strdup(arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"every") == 0) { } else if (strcmp(arg[iarg],"every") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal group command"); if (iarg+2 > narg) error->all(FLERR,"Illegal group command");
nevery = utils::inumeric(FLERR,arg[iarg+1],false,lmp); nevery = utils::inumeric(FLERR,arg[iarg+1],false,lmp);

View File

@ -50,7 +50,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
nvalue = 0; nvalue = 0;
values_peratom = 0; values_peratom = 0;
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"mol") == 0) { if (strcmp(arg[iarg],"mol") == 0) {
if (atom->molecule_flag) if (atom->molecule_flag)
@ -114,7 +114,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
// custom atom array // custom atom array
// OLDSTYLE code // OLDSTYLE code
} else if (strstr(arg[iarg],"i2_") == arg[iarg] || } else if (strstr(arg[iarg],"i2_") == arg[iarg] ||
strstr(arg[iarg],"d2_") == arg[iarg]) { strstr(arg[iarg],"d2_") == arg[iarg]) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix property/atom command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix property/atom command");
int which = 0; int which = 0;
@ -539,7 +539,7 @@ void FixPropertyAtom::grow_arrays(int nmax)
void FixPropertyAtom::copy_arrays(int i, int j, int /*delflag*/) void FixPropertyAtom::copy_arrays(int i, int j, int /*delflag*/)
{ {
int k,ncol; int k,ncol;
for (int nv = 0; nv < nvalue; nv++) { for (int nv = 0; nv < nvalue; nv++) {
if (style[nv] == MOLECULE) if (style[nv] == MOLECULE)
atom->molecule[j] = atom->molecule[i]; atom->molecule[j] = atom->molecule[i];
@ -697,15 +697,15 @@ int FixPropertyAtom::pack_exchange(int i, double *buf)
else if (style[nv] == DVEC) buf[m++] = atom->dvector[index[nv]][i]; else if (style[nv] == DVEC) buf[m++] = atom->dvector[index[nv]][i];
else if (style[nv] == IARRAY) { else if (style[nv] == IARRAY) {
ncol = cols[nv]; ncol = cols[nv];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
buf[m++] = ubuf(atom->iarray[index[nv]][i][k]).d; buf[m++] = ubuf(atom->iarray[index[nv]][i][k]).d;
} else if (style[nv] == DARRAY) { } else if (style[nv] == DARRAY) {
ncol = cols[nv]; ncol = cols[nv];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
buf[m++] = atom->darray[index[nv]][i][k]; buf[m++] = atom->darray[index[nv]][i][k];
} }
} }
return m; return m;
} }
@ -731,15 +731,15 @@ int FixPropertyAtom::unpack_exchange(int nlocal, double *buf)
atom->dvector[index[nv]][nlocal] = buf[m++]; atom->dvector[index[nv]][nlocal] = buf[m++];
else if (style[nv] == IARRAY) { else if (style[nv] == IARRAY) {
ncol = cols[nv]; ncol = cols[nv];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
atom->iarray[index[nv]][nlocal][k] = (int) ubuf(buf[m++]).i; atom->iarray[index[nv]][nlocal][k] = (int) ubuf(buf[m++]).i;
} else if (style[nv] == DARRAY) { } else if (style[nv] == DARRAY) {
ncol = cols[nv]; ncol = cols[nv];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
atom->darray[index[nv]][nlocal][k] = buf[m++]; atom->darray[index[nv]][nlocal][k] = buf[m++];
} }
} }
return m; return m;
} }
@ -750,9 +750,9 @@ int FixPropertyAtom::unpack_exchange(int nlocal, double *buf)
int FixPropertyAtom::pack_restart(int i, double *buf) int FixPropertyAtom::pack_restart(int i, double *buf)
{ {
int k,ncol; int k,ncol;
// pack buf[0] this way because other fixes unpack it // pack buf[0] this way because other fixes unpack it
buf[0] = values_peratom+1; buf[0] = values_peratom+1;
int m = 1; int m = 1;

View File

@ -293,7 +293,7 @@ FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) :
} else if (which[i] == ArgInfo::DNAME) { } else if (which[i] == ArgInfo::DNAME) {
int icustom,iflag,icol; int icustom,iflag,icol;
icustom = atom->find_custom(ids[i],iflag,icol); icustom = atom->find_custom(ids[i],iflag,icol);
if (icustom < 0) if (icustom < 0)
error->all(FLERR,"Custom vector/array for fix store/state does not exist"); error->all(FLERR,"Custom vector/array for fix store/state does not exist");
if (argindex[i] == 0) { if (argindex[i] == 0) {
if (!iflag || icol) if (!iflag || icol)
@ -311,7 +311,7 @@ FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) :
} else if (which[i] == ArgInfo::INAME) { } else if (which[i] == ArgInfo::INAME) {
int icustom,iflag,icol; int icustom,iflag,icol;
icustom = atom->find_custom(ids[i],iflag,icol); icustom = atom->find_custom(ids[i],iflag,icol);
if (icustom < 0) if (icustom < 0)
error->all(FLERR,"Custom vector/array for fix store/state does not exist"); error->all(FLERR,"Custom vector/array for fix store/state does not exist");
if (argindex[i] == 0) { if (argindex[i] == 0) {
if (iflag || icol) if (iflag || icol)
@ -417,7 +417,7 @@ void FixStoreState::init()
} else if (which[m] == ArgInfo::INAME || which[m] == ArgInfo::DNAME) { } else if (which[m] == ArgInfo::INAME || which[m] == ArgInfo::DNAME) {
int icustom,iflag,cols; int icustom,iflag,cols;
icustom = atom->find_custom(ids[m],iflag,cols); icustom = atom->find_custom(ids[m],iflag,cols);
if (icustom < 0) if (icustom < 0)
error->all(FLERR,"Custom vector/array for fix store/state does not exist"); error->all(FLERR,"Custom vector/array for fix store/state does not exist");
value2index[m] = icustom; value2index[m] = icustom;
} }

View File

@ -2834,7 +2834,7 @@ void lammps_gather(void *handle, char *name, int type, int count, void *data)
int i,j,offset,fcid,ltype,icol; int i,j,offset,fcid,ltype,icol;
// error if tags are not defined or not consecutive // error if tags are not defined or not consecutive
int flag = 0; int flag = 0;
if (lmp->atom->tag_enable == 0 || lmp->atom->tag_consecutive() == 0) if (lmp->atom->tag_enable == 0 || lmp->atom->tag_consecutive() == 0)
flag = 1; flag = 1;
@ -2849,7 +2849,7 @@ void lammps_gather(void *handle, char *name, int type, int count, void *data)
void *vptr = lmp->atom->extract(name); void *vptr = lmp->atom->extract(name);
// fix // fix
if (vptr==nullptr && utils::strmatch(name,"^f_")) { if (vptr==nullptr && utils::strmatch(name,"^f_")) {
fcid = lmp->modify->find_fix(&name[2]); fcid = lmp->modify->find_fix(&name[2]);
@ -2884,7 +2884,7 @@ void lammps_gather(void *handle, char *name, int type, int count, void *data)
} }
// compute // compute
if (vptr==nullptr && utils::strmatch(name,"^c_")) { if (vptr==nullptr && utils::strmatch(name,"^c_")) {
fcid = lmp->modify->find_compute(&name[2]); fcid = lmp->modify->find_compute(&name[2]);
@ -2913,7 +2913,7 @@ void lammps_gather(void *handle, char *name, int type, int count, void *data)
if (count==1) vptr = (void *) lmp->modify->compute[fcid]->vector_atom; if (count==1) vptr = (void *) lmp->modify->compute[fcid]->vector_atom;
else vptr = (void *) lmp->modify->compute[fcid]->array_atom; else vptr = (void *) lmp->modify->compute[fcid]->array_atom;
} }
// custom fix property/atom vector or array // custom fix property/atom vector or array
// OLDSTYLE code // OLDSTYLE code
@ -2930,7 +2930,7 @@ void lammps_gather(void *handle, char *name, int type, int count, void *data)
lmp->error->warning(FLERR,"lammps_gather: unknown property/atom id"); lmp->error->warning(FLERR,"lammps_gather: unknown property/atom id");
return; return;
} }
if (ltype != type) { if (ltype != type) {
if (lmp->comm->me == 0) if (lmp->comm->me == 0)
lmp->error->warning(FLERR,"lammps_gather: mismatch property/atom type"); lmp->error->warning(FLERR,"lammps_gather: mismatch property/atom type");
@ -2950,7 +2950,7 @@ void lammps_gather(void *handle, char *name, int type, int count, void *data)
if (count == 1) { if (count == 1) {
if (ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; if (ltype==0) vptr = (void *) lmp->atom->ivector[fcid];
else vptr = (void *) lmp->atom->dvector[fcid]; else vptr = (void *) lmp->atom->dvector[fcid];
} else { } else {
if (ltype==0) vptr = (void *) lmp->atom->iarray[fcid]; if (ltype==0) vptr = (void *) lmp->atom->iarray[fcid];
else vptr = (void *) lmp->atom->darray[fcid]; else vptr = (void *) lmp->atom->darray[fcid];
} }
@ -2963,11 +2963,11 @@ void lammps_gather(void *handle, char *name, int type, int count, void *data)
lmp->error->warning(FLERR,"lammps_gather: undefined property name"); lmp->error->warning(FLERR,"lammps_gather: undefined property name");
return; return;
} }
// copy = Natom length vector of per-atom values // copy = Natom length vector of per-atom values
// use atom ID to insert each atom's values into copy // use atom ID to insert each atom's values into copy
// MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID
if (type==0) { if (type==0) {
int *vector = nullptr; int *vector = nullptr;
int **array = nullptr; int **array = nullptr;
@ -3078,7 +3078,7 @@ void lammps_gather_concat(void *handle, char *name, int type, int count, void *d
int i,offset,fcid,ltype,icol; int i,offset,fcid,ltype,icol;
// error if tags are not defined or not consecutive // error if tags are not defined or not consecutive
int flag = 0; int flag = 0;
if (lmp->atom->tag_enable == 0) flag = 1; if (lmp->atom->tag_enable == 0) flag = 1;
if (lmp->atom->natoms > MAXSMALLINT) flag = 1; if (lmp->atom->natoms > MAXSMALLINT) flag = 1;
@ -3126,7 +3126,7 @@ void lammps_gather_concat(void *handle, char *name, int type, int count, void *d
} }
// compute // compute
if (vptr==nullptr && utils::strmatch(name,"^c_")) { if (vptr==nullptr && utils::strmatch(name,"^c_")) {
fcid = lmp->modify->find_compute(&name[2]); fcid = lmp->modify->find_compute(&name[2]);
@ -3162,7 +3162,7 @@ void lammps_gather_concat(void *handle, char *name, int type, int count, void *d
if ((vptr==nullptr) && if ((vptr==nullptr) &&
((strstr(name,"d_") == name) || (strstr(name,"i_") == name) || ((strstr(name,"d_") == name) || (strstr(name,"i_") == name) ||
(strstr(name,"d2_") == name) || (strstr(name,"i2_") == name))) { (strstr(name,"d2_") == name) || (strstr(name,"i2_") == name))) {
if ((strstr(name,"d_") == name) || (strstr(name,"i_") == name)) if ((strstr(name,"d_") == name) || (strstr(name,"i_") == name))
fcid = lmp->atom->find_custom(&name[2],ltype,icol); fcid = lmp->atom->find_custom(&name[2],ltype,icol);
else fcid = lmp->atom->find_custom(&name[3],ltype,icol); else fcid = lmp->atom->find_custom(&name[3],ltype,icol);
@ -3173,7 +3173,7 @@ void lammps_gather_concat(void *handle, char *name, int type, int count, void *d
"unknown property/atom id"); "unknown property/atom id");
return; return;
} }
if (ltype != type) { if (ltype != type) {
if (lmp->comm->me == 0) if (lmp->comm->me == 0)
lmp->error->warning(FLERR,"lammps_gather_concat: " lmp->error->warning(FLERR,"lammps_gather_concat: "
@ -3221,7 +3221,7 @@ void lammps_gather_concat(void *handle, char *name, int type, int count, void *d
if (type == 0) { if (type == 0) {
int *vector = nullptr; int *vector = nullptr;
int **array = nullptr; int **array = nullptr;
const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); const int imgunpack = (count == 3) && (strcmp(name,"image") == 0);
if ((count == 1) || imgunpack) vector = (int *) vptr; if ((count == 1) || imgunpack) vector = (int *) vptr;
@ -3345,7 +3345,7 @@ void lammps_gather_subset(void *handle, char *name,
tagint id; tagint id;
// error if tags are not defined or not consecutive // error if tags are not defined or not consecutive
int flag = 0; int flag = 0;
if (lmp->atom->tag_enable == 0) flag = 1; if (lmp->atom->tag_enable == 0) flag = 1;
if (lmp->atom->natoms > MAXSMALLINT) flag = 1; if (lmp->atom->natoms > MAXSMALLINT) flag = 1;
@ -3358,7 +3358,7 @@ void lammps_gather_subset(void *handle, char *name,
void *vptr = lmp->atom->extract(name); void *vptr = lmp->atom->extract(name);
// fix // fix
if (vptr==nullptr && utils::strmatch(name,"^f_")) { if (vptr==nullptr && utils::strmatch(name,"^f_")) {
fcid = lmp->modify->find_fix(&name[2]); fcid = lmp->modify->find_fix(&name[2]);
@ -3391,7 +3391,7 @@ void lammps_gather_subset(void *handle, char *name,
} }
// compute // compute
if (vptr==nullptr && utils::strmatch(name,"^c_")) { if (vptr==nullptr && utils::strmatch(name,"^c_")) {
fcid = lmp->modify->find_compute(&name[2]); fcid = lmp->modify->find_compute(&name[2]);
@ -3438,7 +3438,7 @@ void lammps_gather_subset(void *handle, char *name,
"unknown property/atom id"); "unknown property/atom id");
return; return;
} }
if (ltype != type) { if (ltype != type) {
if (lmp->comm->me == 0) if (lmp->comm->me == 0)
lmp->error->warning(FLERR,"lammps_gather_subset: " lmp->error->warning(FLERR,"lammps_gather_subset: "
@ -3529,7 +3529,7 @@ void lammps_gather_subset(void *handle, char *name,
} else { } else {
double *vector = nullptr; double *vector = nullptr;
double **array = nullptr; double **array = nullptr;
if (count == 1) vector = (double *) vptr; if (count == 1) vector = (double *) vptr;
else array = (double **) vptr; else array = (double **) vptr;
@ -3619,7 +3619,7 @@ void lammps_scatter(void *handle, char *name, int type, int count, void *data)
void *vptr = lmp->atom->extract(name); void *vptr = lmp->atom->extract(name);
// fix // fix
if (vptr==nullptr && utils::strmatch(name,"^f_")) { if (vptr==nullptr && utils::strmatch(name,"^f_")) {
fcid = lmp->modify->find_fix(&name[2]); fcid = lmp->modify->find_fix(&name[2]);
@ -3647,7 +3647,7 @@ void lammps_scatter(void *handle, char *name, int type, int count, void *data)
} }
// compute // compute
if (vptr==nullptr && utils::strmatch(name,"^c_")) { if (vptr==nullptr && utils::strmatch(name,"^c_")) {
fcid = lmp->modify->find_compute(&name[2]); fcid = lmp->modify->find_compute(&name[2]);
@ -3679,7 +3679,7 @@ void lammps_scatter(void *handle, char *name, int type, int count, void *data)
// custom fix property/atom vector or array // custom fix property/atom vector or array
// OLDSTYLE code // OLDSTYLE code
if ((vptr == nullptr) && if ((vptr == nullptr) &&
((strstr(name,"d_") == name) || (strstr(name,"i_") == name) || ((strstr(name,"d_") == name) || (strstr(name,"i_") == name) ||
(strstr(name,"d2_") == name) || (strstr(name,"i2_") == name))) { (strstr(name,"d2_") == name) || (strstr(name,"i2_") == name))) {
@ -3693,7 +3693,7 @@ void lammps_scatter(void *handle, char *name, int type, int count, void *data)
lmp->error->warning(FLERR,"lammps_scatter: unknown property/atom id"); lmp->error->warning(FLERR,"lammps_scatter: unknown property/atom id");
return; return;
} }
if (ltype != type) { if (ltype != type) {
if (lmp->comm->me == 0) if (lmp->comm->me == 0)
lmp->error->warning(FLERR,"lammps_scatter: mismatch property/atom type"); lmp->error->warning(FLERR,"lammps_scatter: mismatch property/atom type");
@ -3713,7 +3713,7 @@ void lammps_scatter(void *handle, char *name, int type, int count, void *data)
if (count == 1) { if (count == 1) {
if (ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; if (ltype==0) vptr = (void *) lmp->atom->ivector[fcid];
else vptr = (void *) lmp->atom->dvector[fcid]; else vptr = (void *) lmp->atom->dvector[fcid];
} else { } else {
if (ltype==0) vptr = (void *) lmp->atom->iarray[fcid]; if (ltype==0) vptr = (void *) lmp->atom->iarray[fcid];
else vptr = (void *) lmp->atom->darray[fcid]; else vptr = (void *) lmp->atom->darray[fcid];
} }
@ -3843,7 +3843,7 @@ void lammps_scatter_subset(void *handle, char *name,int type, int count,
void *vptr = lmp->atom->extract(name); void *vptr = lmp->atom->extract(name);
// fix // fix
if (vptr==nullptr && utils::strmatch(name,"^f_")) { if (vptr==nullptr && utils::strmatch(name,"^f_")) {
fcid = lmp->modify->find_fix(&name[2]); fcid = lmp->modify->find_fix(&name[2]);
@ -3903,7 +3903,7 @@ void lammps_scatter_subset(void *handle, char *name,int type, int count,
// custom fix property/atom vector or array // custom fix property/atom vector or array
// OLDSTYLE code // OLDSTYLE code
if ((vptr == nullptr) && if ((vptr == nullptr) &&
((strstr(name,"d_") == name) || (strstr(name,"i_") == name) || ((strstr(name,"d_") == name) || (strstr(name,"i_") == name) ||
(strstr(name,"d2_") == name) || (strstr(name,"i2_") == name))) { (strstr(name,"d2_") == name) || (strstr(name,"i2_") == name))) {
@ -3918,7 +3918,7 @@ void lammps_scatter_subset(void *handle, char *name,int type, int count,
"unknown property/atom id"); "unknown property/atom id");
return; return;
} }
if (ltype != type) { if (ltype != type) {
if (lmp->comm->me == 0) if (lmp->comm->me == 0)
lmp->error->warning(FLERR,"lammps_scatter_subset: " lmp->error->warning(FLERR,"lammps_scatter_subset: "
@ -3939,7 +3939,7 @@ void lammps_scatter_subset(void *handle, char *name,int type, int count,
if (count == 1) { if (count == 1) {
if (ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; if (ltype==0) vptr = (void *) lmp->atom->ivector[fcid];
else vptr = (void *) lmp->atom->dvector[fcid]; else vptr = (void *) lmp->atom->dvector[fcid];
} else { } else {
if (ltype==0) vptr = (void *) lmp->atom->iarray[fcid]; if (ltype==0) vptr = (void *) lmp->atom->iarray[fcid];
else vptr = (void *) lmp->atom->darray[fcid]; else vptr = (void *) lmp->atom->darray[fcid];
} }

View File

@ -581,7 +581,7 @@ void Set::command(int narg, char **arg)
if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
index_custom = atom->find_custom(argi.get_name(),flag,cols); index_custom = atom->find_custom(argi.get_name(),flag,cols);
if (index_custom < 0) error->all(FLERR,"Custom property {} does not exist",pname); if (index_custom < 0) error->all(FLERR,"Custom property {} does not exist",pname);
switch (argi.get_type()) { switch (argi.get_type()) {
case ArgInfo::INAME: case ArgInfo::INAME:
@ -1025,7 +1025,7 @@ void Set::set(int keyword)
} }
// update bonus data numbers // update bonus data numbers
if (keyword == SHAPE) { if (keyword == SHAPE) {
bigint nlocal_bonus = avec_ellipsoid->nlocal_bonus; bigint nlocal_bonus = avec_ellipsoid->nlocal_bonus;
MPI_Allreduce(&nlocal_bonus,&atom->nellipsoids,1, MPI_Allreduce(&nlocal_bonus,&atom->nellipsoids,1,

View File

@ -633,15 +633,15 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int mod
expandflag = 1; expandflag = 1;
} }
} }
} else if (arg[iarg][0] == 'd') { } else if (arg[iarg][0] == 'd') {
*ptr1 = '\0'; *ptr1 = '\0';
int flag,cols; int flag,cols;
int icustom = lmp->atom->find_custom(&arg[iarg][3],flag,cols); int icustom = lmp->atom->find_custom(&arg[iarg][3],flag,cols);
*ptr1 = '['; *ptr1 = '[';
// check for custom per-atom floating point array // check for custom per-atom floating point array
if (icustom >= 0) { if (icustom >= 0) {
if (mode == 1 && flag && cols) { if (mode == 1 && flag && cols) {
nmax = cols; nmax = cols;