Merge branch 'fix-property-array' of github.com:lammps/lammps into fix-property-array
This commit is contained in:
@ -92,7 +92,7 @@ Syntax
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
USER-MESONT package per-atom properties:
|
||||
MESONT package per-atom properties:
|
||||
buckling = buckling flag used in mesoscopic simulation of nanotubes
|
||||
|
||||
Examples
|
||||
|
||||
@ -1054,14 +1054,10 @@ void PairTableRXKokkos<DeviceType>::coeff(int narg, char **arg)
|
||||
|
||||
if (ispecies == nspecies && strcmp(site1,"1fluid") != 0)
|
||||
error->all(FLERR,"Site1 name not recognized in pair coefficients");
|
||||
site2 = utils::strdup(arg[5]);
|
||||
|
||||
n = strlen(arg[5]) + 1;
|
||||
site2 = new char[n];
|
||||
strcpy(site2,arg[5]);
|
||||
|
||||
for (ispecies = 0; ispecies < nspecies; ispecies++) {
|
||||
for (ispecies = 0; ispecies < nspecies; ispecies++)
|
||||
if (strcmp(site2,&atom->dvname[ispecies][0]) == 0) break;
|
||||
}
|
||||
|
||||
if (ispecies == nspecies && strcmp(site2,"1fluid") != 0)
|
||||
error->all(FLERR,"Site2 name not recognized in pair coefficients");
|
||||
|
||||
@ -2625,7 +2625,7 @@ void FixBondReact::unlimit_bond()
|
||||
// let's now unlimit in terms of i_limit_tags
|
||||
// we just run through all nlocal, looking for > limit_duration
|
||||
// then we return i_limit_tag to 0 (which removes from dynamic group)
|
||||
int flag,cols
|
||||
int flag, cols;
|
||||
int index1 = atom->find_custom("limit_tags",flag,cols);
|
||||
int *i_limit_tags = atom->ivector[index1];
|
||||
|
||||
|
||||
46
src/atom.cpp
46
src/atom.cpp
@ -2472,47 +2472,39 @@ int Atom::add_custom(const char *name, int flag, int cols)
|
||||
{
|
||||
int index;
|
||||
|
||||
if (flag == 0 && cols == 0) {
|
||||
if ((flag == 0) && (cols == 0)) {
|
||||
index = nivector;
|
||||
nivector++;
|
||||
ivname = (char **) memory->srealloc(ivname,nivector*sizeof(char *),
|
||||
"atom:ivname");
|
||||
ivname = (char **) memory->srealloc(ivname,nivector*sizeof(char *),"atom:ivname");
|
||||
ivname[index] = utils::strdup(name);
|
||||
ivector = (int **) memory->srealloc(ivector,nivector*sizeof(int *),
|
||||
"atom:ivector");
|
||||
ivector = (int **) memory->srealloc(ivector,nivector*sizeof(int *),"atom:ivector");
|
||||
memory->create(ivector[index],nmax,"atom:ivector");
|
||||
|
||||
} else if (flag == 1 && cols == 0) {
|
||||
} else if ((flag == 1) && (cols == 0)) {
|
||||
index = ndvector;
|
||||
ndvector++;
|
||||
dvname = (char **) memory->srealloc(dvname,ndvector*sizeof(char *),
|
||||
"atom:dvname");
|
||||
dvname = (char **) memory->srealloc(dvname,ndvector*sizeof(char *),"atom:dvname");
|
||||
dvname[index] = utils::strdup(name);
|
||||
dvector = (double **) memory->srealloc(dvector,ndvector*sizeof(double *),
|
||||
"atom:dvector");
|
||||
dvector = (double **) memory->srealloc(dvector,ndvector*sizeof(double *),"atom:dvector");
|
||||
memory->create(dvector[index],nmax,"atom:dvector");
|
||||
|
||||
} else if (flag == 0 && cols) {
|
||||
} else if ((flag == 0) && (cols > 0)) {
|
||||
index = niarray;
|
||||
niarray++;
|
||||
ianame = (char **) memory->srealloc(ianame,niarray*sizeof(char *),
|
||||
"atom:ianame");
|
||||
ianame = (char **) memory->srealloc(ianame,niarray*sizeof(char *),"atom:ianame");
|
||||
ianame[index] = utils::strdup(name);
|
||||
iarray = (int ***) memory->srealloc(iarray,niarray*sizeof(int **),
|
||||
"atom:iarray");
|
||||
iarray = (int ***) memory->srealloc(iarray,niarray*sizeof(int **),"atom:iarray");
|
||||
memory->create(iarray[index],nmax,cols,"atom:iarray");
|
||||
|
||||
icols = (int *) memory->srealloc(icols,niarray*sizeof(int),"atom:icols");
|
||||
icols[index] = cols;
|
||||
|
||||
} else if (flag == 1 && cols) {
|
||||
} else if ((flag == 1) && (cols > 0)) {
|
||||
index = ndarray;
|
||||
ndarray++;
|
||||
daname = (char **) memory->srealloc(daname,ndarray*sizeof(char *),
|
||||
"atom:daname");
|
||||
daname = (char **) memory->srealloc(daname,ndarray*sizeof(char *),"atom:daname");
|
||||
daname[index] = utils::strdup(name);
|
||||
darray = (double ***) memory->srealloc(darray,ndarray*sizeof(double **),
|
||||
"atom:darray");
|
||||
darray = (double ***) memory->srealloc(darray,ndarray*sizeof(double **),"atom:darray");
|
||||
memory->create(darray[index],nmax,cols,"atom:darray");
|
||||
|
||||
dcols = (int *) memory->srealloc(dcols,ndarray*sizeof(int),"atom:dcols");
|
||||
@ -2782,13 +2774,10 @@ void *Atom::extract(const char *name)
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// custom vectors and arrays
|
||||
// OLDSTYLE code
|
||||
|
||||
if (strstr(name,"i_") == name || strstr(name,"d_") == name ||
|
||||
strstr(name,"i2_") == name || strstr(name,"d2_") == name) {
|
||||
int which = 0;
|
||||
if (utils::strmatch(name,"^[id]2?_")) {
|
||||
int which = 0, array = 0;
|
||||
if (name[0] == 'd') which = 1;
|
||||
int array = 0;
|
||||
if (name[1] == '2') array = 1;
|
||||
|
||||
int index,flag,cols;
|
||||
@ -2905,13 +2894,10 @@ int Atom::extract_datatype(const char *name)
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// custom vectors and arrays
|
||||
// OLDSTYLE code
|
||||
|
||||
if (strstr(name,"i_") == name || strstr(name,"d_") == name ||
|
||||
strstr(name,"i2_") == name || strstr(name,"d2_") == name) {
|
||||
int which = 0;
|
||||
if (utils::strmatch(name,"^[id]2?_")) {
|
||||
int which = 0, array = 0;
|
||||
if (name[0] == 'd') which = 1;
|
||||
int array = 0;
|
||||
if (name[1] == '2') array = 1;
|
||||
|
||||
int index,flag,cols;
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
|
||||
#include "compute_property_atom.h"
|
||||
|
||||
#include "arg_info.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "atom_vec_body.h"
|
||||
@ -122,313 +123,263 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
} else if (strcmp(arg[iarg],"q") == 0) {
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_q;
|
||||
} else if (strcmp(arg[iarg],"mux") == 0) {
|
||||
if (!atom->mu_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_mux;
|
||||
} else if (strcmp(arg[iarg],"muy") == 0) {
|
||||
if (!atom->mu_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_muy;
|
||||
} else if (strcmp(arg[iarg],"muz") == 0) {
|
||||
if (!atom->mu_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_muz;
|
||||
} else if (strcmp(arg[iarg],"mu") == 0) {
|
||||
if (!atom->mu_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_mu;
|
||||
|
||||
// pack magnetic variables
|
||||
|
||||
} else if (strcmp(arg[iarg],"spx") == 0) {
|
||||
if (!atom->sp_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_spx;
|
||||
} else if (strcmp(arg[iarg],"spy") == 0) {
|
||||
if (!atom->sp_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_spy;
|
||||
} else if (strcmp(arg[iarg],"spz") == 0) {
|
||||
if (!atom->sp_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_spz;
|
||||
} else if (strcmp(arg[iarg],"sp") == 0) {
|
||||
if (!atom->sp_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_sp;
|
||||
} else if (strcmp(arg[iarg],"fmx") == 0) {
|
||||
if (!atom->sp_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_fmx;
|
||||
} else if (strcmp(arg[iarg],"fmy") == 0) {
|
||||
if (!atom->sp_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_fmy;
|
||||
} else if (strcmp(arg[iarg],"fmz") == 0) {
|
||||
if (!atom->sp_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_fmz;
|
||||
|
||||
// bond count
|
||||
|
||||
} else if (strcmp(arg[iarg],"nbonds") == 0) {
|
||||
if (!atom->molecule_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_nbonds;
|
||||
|
||||
// finite-size particles
|
||||
|
||||
} else if (strcmp(arg[iarg],"radius") == 0) {
|
||||
if (!atom->radius_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_radius;
|
||||
} else if (strcmp(arg[iarg],"diameter") == 0) {
|
||||
if (!atom->radius_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_diameter;
|
||||
} else if (strcmp(arg[iarg],"omegax") == 0) {
|
||||
if (!atom->omega_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_omegax;
|
||||
} else if (strcmp(arg[iarg],"omegay") == 0) {
|
||||
if (!atom->omega_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_omegay;
|
||||
} else if (strcmp(arg[iarg],"omegaz") == 0) {
|
||||
if (!atom->omega_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_omegaz;
|
||||
} else if (strcmp(arg[iarg],"angmomx") == 0) {
|
||||
if (!atom->angmom_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_angmomx;
|
||||
} else if (strcmp(arg[iarg],"angmomy") == 0) {
|
||||
if (!atom->angmom_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_angmomy;
|
||||
} else if (strcmp(arg[iarg],"angmomz") == 0) {
|
||||
if (!atom->angmom_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_angmomz;
|
||||
|
||||
} else if (strcmp(arg[iarg],"shapex") == 0) {
|
||||
avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
||||
if (!avec_ellipsoid) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_ellipsoid) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_shapex;
|
||||
} else if (strcmp(arg[iarg],"shapey") == 0) {
|
||||
avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
||||
if (!avec_ellipsoid) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_ellipsoid) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_shapey;
|
||||
} else if (strcmp(arg[iarg],"shapez") == 0) {
|
||||
avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
||||
if (!avec_ellipsoid) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_ellipsoid) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_shapez;
|
||||
|
||||
} else if (strcmp(arg[iarg],"quatw") == 0) {
|
||||
avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
||||
avec_body = (AtomVecBody *) atom->style_match("body");
|
||||
if (!avec_ellipsoid && !avec_body)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_quatw;
|
||||
} else if (strcmp(arg[iarg],"quati") == 0) {
|
||||
avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
||||
avec_body = (AtomVecBody *) atom->style_match("body");
|
||||
if (!avec_ellipsoid && !avec_body)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_quati;
|
||||
} else if (strcmp(arg[iarg],"quatj") == 0) {
|
||||
avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
||||
avec_body = (AtomVecBody *) atom->style_match("body");
|
||||
if (!avec_ellipsoid && !avec_body)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_quatj;
|
||||
} else if (strcmp(arg[iarg],"quatk") == 0) {
|
||||
avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
||||
avec_body = (AtomVecBody *) atom->style_match("body");
|
||||
if (!avec_ellipsoid && !avec_body)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_quatk;
|
||||
|
||||
} else if (strcmp(arg[iarg],"tqx") == 0) {
|
||||
if (!atom->torque_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_tqx;
|
||||
} else if (strcmp(arg[iarg],"tqy") == 0) {
|
||||
if (!atom->torque_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_tqy;
|
||||
} else if (strcmp(arg[iarg],"tqz") == 0) {
|
||||
if (!atom->torque_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_tqz;
|
||||
|
||||
} else if (strcmp(arg[iarg],"end1x") == 0) {
|
||||
avec_line = (AtomVecLine *) atom->style_match("line");
|
||||
if (!avec_line) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_end1x;
|
||||
} else if (strcmp(arg[iarg],"end1y") == 0) {
|
||||
avec_line = (AtomVecLine *) atom->style_match("line");
|
||||
if (!avec_line) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_end1y;
|
||||
} else if (strcmp(arg[iarg],"end1z") == 0) {
|
||||
avec_line = (AtomVecLine *) atom->style_match("line");
|
||||
if (!avec_line) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_end1z;
|
||||
} else if (strcmp(arg[iarg],"end2x") == 0) {
|
||||
avec_line = (AtomVecLine *) atom->style_match("line");
|
||||
if (!avec_line) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_end2x;
|
||||
} else if (strcmp(arg[iarg],"end2y") == 0) {
|
||||
avec_line = (AtomVecLine *) atom->style_match("line");
|
||||
if (!avec_line) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_end2y;
|
||||
} else if (strcmp(arg[iarg],"end2z") == 0) {
|
||||
avec_line = (AtomVecLine *) atom->style_match("line");
|
||||
if (!avec_line) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_end2z;
|
||||
|
||||
} else if (strcmp(arg[iarg],"corner1x") == 0) {
|
||||
avec_tri = (AtomVecTri *) atom->style_match("tri");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_corner1x;
|
||||
} else if (strcmp(arg[iarg],"corner1y") == 0) {
|
||||
avec_tri = (AtomVecTri *) atom->style_match("tri");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_corner1y;
|
||||
} else if (strcmp(arg[iarg],"corner1z") == 0) {
|
||||
avec_tri = (AtomVecTri *) atom->style_match("tri");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_corner1z;
|
||||
} else if (strcmp(arg[iarg],"corner2x") == 0) {
|
||||
avec_tri = (AtomVecTri *) atom->style_match("tri");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_corner2x;
|
||||
|
||||
} else if (strcmp(arg[iarg],"corner2y") == 0) {
|
||||
avec_tri = (AtomVecTri *) atom->style_match("tri");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_corner2y;
|
||||
} else if (strcmp(arg[iarg],"corner2z") == 0) {
|
||||
avec_tri = (AtomVecTri *) atom->style_match("tri");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_corner2z;
|
||||
} else if (strcmp(arg[iarg],"corner3x") == 0) {
|
||||
avec_tri = (AtomVecTri *) atom->style_match("tri");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_corner3x;
|
||||
} else if (strcmp(arg[iarg],"corner3y") == 0) {
|
||||
avec_tri = (AtomVecTri *) atom->style_match("tri");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_corner3y;
|
||||
} else if (strcmp(arg[iarg],"corner3z") == 0) {
|
||||
avec_tri = (AtomVecTri *) atom->style_match("tri");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_corner3z;
|
||||
|
||||
} else if (strcmp(arg[iarg],"nbonds") == 0) {
|
||||
if (!atom->molecule_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_nbonds;
|
||||
|
||||
// custom per-atom vector
|
||||
// custom per-atom vector or array
|
||||
|
||||
} else if (utils::strmatch(arg[iarg],"^i_")) {
|
||||
} else if (utils::strmatch(arg[iarg],"^[id]2?_")) {
|
||||
int flag,cols;
|
||||
index[i] = atom->find_custom(&arg[iarg][2],flag,cols);
|
||||
if (index[i] < 0 || flag || cols)
|
||||
error->all(FLERR,"Compute property/atom integer "
|
||||
"vector does not exist");
|
||||
ArgInfo argi(arg[iarg], ArgInfo::INAME| ArgInfo::DNAME);
|
||||
const char *pname = argi.get_name();
|
||||
|
||||
index[i] = atom->find_custom(pname,flag,cols);
|
||||
if (index[i] < 0)
|
||||
error->all(FLERR,"Compute property/atom property {} does not exist", pname);
|
||||
|
||||
// handle vectors
|
||||
if ((cols == 0) && (arg[iarg][1] == '_')) {
|
||||
if (argi.get_dim() != 0)
|
||||
error->all(FLERR,"Compute property/atom custom vector {} is incorrectly indexed",pname);
|
||||
|
||||
if (arg[iarg][0] == 'i') {
|
||||
if (argi.get_type() == ArgInfo::INAME)
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_iname;
|
||||
|
||||
} else if (utils::strmatch(arg[iarg],"^d_")) {
|
||||
int flag,cols;
|
||||
index[i] = atom->find_custom(&arg[iarg][2],flag,cols);
|
||||
if (index[i] < 0 || flag || cols)
|
||||
error->all(FLERR,"Compute property/atom floating point "
|
||||
"vector does not exist");
|
||||
else
|
||||
error->all(FLERR,"Compute property/atom integer vector {} does not exist",pname);
|
||||
} else if (arg[iarg][0] == 'd') {
|
||||
if (argi.get_type() == ArgInfo::DNAME)
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_dname;
|
||||
else
|
||||
error->all(FLERR,"Compute property/atom floating-point vector {} does not exist",pname);
|
||||
}
|
||||
}
|
||||
// handle arrays
|
||||
else if ((cols > 0) && (arg[iarg][1] == '2')) {
|
||||
if (argi.get_dim() != 1)
|
||||
error->all(FLERR,"Compute property/atom custom array {} is not indexed",pname);
|
||||
colindex[i] = argi.get_index1();
|
||||
|
||||
// custom per-atom arrays, must include bracketed index
|
||||
// OLDSTYLE code
|
||||
|
||||
} else if (strstr(arg[iarg],"i2_") == arg[iarg] ||
|
||||
strstr(arg[iarg],"d2_") == arg[iarg]) {
|
||||
int which = 0;
|
||||
if (arg[iarg][0] == 'd') which = 1;
|
||||
|
||||
int n = strlen(arg[iarg]);
|
||||
char *suffix = new char[n];
|
||||
strcpy(suffix,&arg[iarg][3]);
|
||||
|
||||
char *ptr = strchr(suffix,'[');
|
||||
if (ptr) {
|
||||
if (suffix[strlen(suffix)-1] != ']')
|
||||
error->all(FLERR,"Invalid attribute in set command");
|
||||
suffix[strlen(suffix)-1] = '\0';
|
||||
colindex[i] = utils::inumeric(FLERR,ptr+1,true,lmp);
|
||||
*ptr = '\0';
|
||||
} else error->all(FLERR,"Compute property/atom custom array is not indexed");
|
||||
|
||||
int flag,cols;
|
||||
index[i] = atom->find_custom(suffix,flag,cols);
|
||||
delete [] suffix;
|
||||
|
||||
if ((!which && (index[i] < 0 || flag || !cols)) ||
|
||||
(which && (index[i] < 0 || !flag || !cols)))
|
||||
error->all(FLERR,"Compute property/atom custom array does not exist");
|
||||
|
||||
if (!which) pack_choice[i] = &ComputePropertyAtom::pack_i2name;
|
||||
else pack_choice[i] = &ComputePropertyAtom::pack_d2name;
|
||||
if (arg[iarg][0] == 'i') {
|
||||
if (argi.get_type() == ArgInfo::INAME)
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_i2name;
|
||||
else
|
||||
error->all(FLERR,"Compute property/atom integer array {} does not exist",pname);
|
||||
} else if (arg[iarg][0] == 'd') {
|
||||
if (argi.get_type() == ArgInfo::DNAME)
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_d2name;
|
||||
else
|
||||
error->all(FLERR,"Compute property/atom floating-point array {} does not exist",pname);
|
||||
}
|
||||
} else error->all(FLERR,"Inconsistent request for custom property {}", pname);
|
||||
|
||||
// anything else must be recognized by atom style
|
||||
|
||||
|
||||
@ -112,24 +112,29 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
iarg++;
|
||||
|
||||
// custom atom array
|
||||
// OLDSTYLE code
|
||||
|
||||
} else if (strstr(arg[iarg],"i2_") == arg[iarg] ||
|
||||
strstr(arg[iarg],"d2_") == arg[iarg]) {
|
||||
} else if (utils::strmatch(arg[iarg],"^[id]2_")) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix property/atom command");
|
||||
int which = 0;
|
||||
if (arg[iarg][0] == 'd') which = 1;
|
||||
if (which == 0) style[nvalue] = IARRAY;
|
||||
else style[nvalue] = DARRAY;
|
||||
int flag,ncols;
|
||||
index[nvalue] = atom->find_custom(&arg[iarg][3],flag,ncols);
|
||||
if (index[nvalue] >= 0)
|
||||
error->all(FLERR,"Fix property/atom array name already exists");
|
||||
cols[nvalue] = utils::inumeric(FLERR,arg[iarg+1],true,lmp);
|
||||
if (cols[nvalue] < 1)
|
||||
error->all(FLERR,"Invalid array columns in fix property/atom");
|
||||
index[nvalue] = atom->add_custom(&arg[iarg][3],which,cols[nvalue]);
|
||||
values_peratom += cols[nvalue];
|
||||
|
||||
int which,flag,ncols;
|
||||
which = atom->find_custom(&arg[iarg][3],flag,ncols);
|
||||
if (which >= 0)
|
||||
error->all(FLERR,"Fix property/atom array name {} already exists", &arg[iarg][3]);
|
||||
|
||||
ncols = utils::inumeric(FLERR,arg[iarg+1],true,lmp);
|
||||
if (ncols < 1)
|
||||
error->all(FLERR,"Invalid array columns number {} in fix property/atom", ncols);
|
||||
|
||||
if (arg[iarg][0] == 'i') {
|
||||
which = 0;
|
||||
style[nvalue] = IARRAY;
|
||||
} else {
|
||||
which = 1;
|
||||
style[nvalue] = DARRAY;
|
||||
}
|
||||
index[nvalue] = atom->add_custom(&arg[iarg][3],which,ncols);
|
||||
cols[nvalue] = ncols;
|
||||
values_peratom += ncols;
|
||||
nvalue++;
|
||||
iarg += 2;
|
||||
|
||||
@ -250,7 +255,7 @@ void FixPropertyAtom::init()
|
||||
void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf,
|
||||
tagint id_offset)
|
||||
{
|
||||
int j,k,m,iword,ncol,nv;
|
||||
int j,k,m,ncol;
|
||||
tagint itag;
|
||||
char *next;
|
||||
|
||||
@ -394,7 +399,7 @@ void FixPropertyAtom::write_data_section_pack(int /*mth*/, double **buf)
|
||||
ncol = cols[nv];
|
||||
for (i = 0; i < nlocal; i++)
|
||||
for (k = 0; k < ncol; k++)
|
||||
buf[i][icol+k] = ubuf(darray[i][k]).d;
|
||||
buf[i][icol+k] = darray[i][k];
|
||||
icol += ncol;
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,88 +142,71 @@ FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
} else if (strcmp(arg[iarg],"q") == 0) {
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,
|
||||
"Fix store/state for atom property that isn't allocated");
|
||||
error->all(FLERR,"Fix store/state for atom property that isn't allocated");
|
||||
pack_choice[nvalues++] = &FixStoreState::pack_q;
|
||||
} else if (strcmp(arg[iarg],"mux") == 0) {
|
||||
if (!atom->mu_flag)
|
||||
error->all(FLERR,
|
||||
"Fix store/state for atom property that isn't allocated");
|
||||
error->all(FLERR,"Fix store/state for atom property that isn't allocated");
|
||||
pack_choice[nvalues++] = &FixStoreState::pack_mux;
|
||||
} else if (strcmp(arg[iarg],"muy") == 0) {
|
||||
if (!atom->mu_flag)
|
||||
error->all(FLERR,
|
||||
"Fix store/state for atom property that isn't allocated");
|
||||
error->all(FLERR,"Fix store/state for atom property that isn't allocated");
|
||||
pack_choice[nvalues++] = &FixStoreState::pack_muy;
|
||||
} else if (strcmp(arg[iarg],"muz") == 0) {
|
||||
if (!atom->mu_flag)
|
||||
error->all(FLERR,
|
||||
"Fix store/state for atom property that isn't allocated");
|
||||
error->all(FLERR,"Fix store/state for atom property that isn't allocated");
|
||||
pack_choice[nvalues++] = &FixStoreState::pack_muz;
|
||||
} else if (strcmp(arg[iarg],"mu") == 0) {
|
||||
if (!atom->mu_flag)
|
||||
error->all(FLERR,
|
||||
"Fix store/state for atom property that isn't allocated");
|
||||
error->all(FLERR,"Fix store/state for atom property that isn't allocated");
|
||||
pack_choice[nvalues++] = &FixStoreState::pack_mu;
|
||||
|
||||
} else if (strcmp(arg[iarg],"radius") == 0) {
|
||||
if (!atom->radius_flag)
|
||||
error->all(FLERR,
|
||||
"Fix store/state for atom property that isn't allocated");
|
||||
error->all(FLERR,"Fix store/state for atom property that isn't allocated");
|
||||
pack_choice[nvalues++] = &FixStoreState::pack_radius;
|
||||
} else if (strcmp(arg[iarg],"diameter") == 0) {
|
||||
if (!atom->radius_flag)
|
||||
error->all(FLERR,
|
||||
"Fix store/state for atom property that isn't allocated");
|
||||
error->all(FLERR,"Fix store/state for atom property that isn't allocated");
|
||||
pack_choice[nvalues++] = &FixStoreState::pack_diameter;
|
||||
} else if (strcmp(arg[iarg],"omegax") == 0) {
|
||||
if (!atom->omega_flag)
|
||||
error->all(FLERR,
|
||||
"Fix store/state for atom property that isn't allocated");
|
||||
error->all(FLERR,"Fix store/state for atom property that isn't allocated");
|
||||
pack_choice[nvalues++] = &FixStoreState::pack_omegax;
|
||||
} else if (strcmp(arg[iarg],"omegay") == 0) {
|
||||
if (!atom->omega_flag)
|
||||
error->all(FLERR,
|
||||
"Fix store/state for atom property that isn't allocated");
|
||||
error->all(FLERR,"Fix store/state for atom property that isn't allocated");
|
||||
pack_choice[nvalues++] = &FixStoreState::pack_omegay;
|
||||
} else if (strcmp(arg[iarg],"omegaz") == 0) {
|
||||
if (!atom->omega_flag)
|
||||
error->all(FLERR,
|
||||
"Fix store/state for atom property that isn't allocated");
|
||||
error->all(FLERR,"Fix store/state for atom property that isn't allocated");
|
||||
pack_choice[nvalues++] = &FixStoreState::pack_omegaz;
|
||||
} else if (strcmp(arg[iarg],"angmomx") == 0) {
|
||||
if (!atom->angmom_flag)
|
||||
error->all(FLERR,
|
||||
"Fix store/state for atom property that isn't allocated");
|
||||
error->all(FLERR,"Fix store/state for atom property that isn't allocated");
|
||||
pack_choice[nvalues++] = &FixStoreState::pack_angmomx;
|
||||
} else if (strcmp(arg[iarg],"angmomy") == 0) {
|
||||
if (!atom->angmom_flag)
|
||||
error->all(FLERR,
|
||||
"Fix store/state for atom property that isn't allocated");
|
||||
error->all(FLERR,"Fix store/state for atom property that isn't allocated");
|
||||
pack_choice[nvalues++] = &FixStoreState::pack_angmomy;
|
||||
} else if (strcmp(arg[iarg],"angmomz") == 0) {
|
||||
if (!atom->angmom_flag)
|
||||
error->all(FLERR,
|
||||
"Fix store/state for atom property that isn't allocated");
|
||||
error->all(FLERR,"Fix store/state for atom property that isn't allocated");
|
||||
pack_choice[nvalues++] = &FixStoreState::pack_angmomz;
|
||||
} else if (strcmp(arg[iarg],"tqx") == 0) {
|
||||
if (!atom->torque_flag)
|
||||
error->all(FLERR,
|
||||
"Fix store/state for atom property that isn't allocated");
|
||||
error->all(FLERR,"Fix store/state for atom property that isn't allocated");
|
||||
pack_choice[nvalues++] = &FixStoreState::pack_tqx;
|
||||
} else if (strcmp(arg[iarg],"tqy") == 0) {
|
||||
if (!atom->torque_flag)
|
||||
error->all(FLERR,
|
||||
"Fix store/state for atom property that isn't allocated");
|
||||
error->all(FLERR,"Fix store/state for atom property that isn't allocated");
|
||||
pack_choice[nvalues++] = &FixStoreState::pack_tqy;
|
||||
} else if (strcmp(arg[iarg],"tqz") == 0) {
|
||||
if (!atom->torque_flag)
|
||||
error->all(FLERR,
|
||||
"Fix store/state for atom property that isn't allocated");
|
||||
error->all(FLERR,"Fix store/state for atom property that isn't allocated");
|
||||
pack_choice[nvalues++] = &FixStoreState::pack_tqz;
|
||||
|
||||
// compute or fix or variable or custom per-atom vector or array
|
||||
// NEWSTYLE code
|
||||
|
||||
} else {
|
||||
ArgInfo argi(arg[iarg],ArgInfo::COMPUTE|ArgInfo::FIX|ArgInfo::VARIABLE
|
||||
|
||||
@ -2915,14 +2915,10 @@ void lammps_gather(void *handle, char *name, int type, int count, void *data)
|
||||
}
|
||||
|
||||
// custom fix property/atom vector or array
|
||||
// OLDSTYLE code
|
||||
|
||||
if ((vptr == nullptr) &&
|
||||
((strstr(name,"d_") == name) || (strstr(name,"i_") == name) ||
|
||||
(strstr(name,"d2_") == name) || (strstr(name,"i2_") == name))) {
|
||||
if ((vptr == nullptr) && utils::strmatch(name,"^[id]2?_")) {
|
||||
|
||||
if ((strstr(name,"d_") == name) || (strstr(name,"i_") == name))
|
||||
fcid = lmp->atom->find_custom(&name[2],ltype,icol);
|
||||
if (utils::strmatch(name,"^[id]_")) fcid = lmp->atom->find_custom(&name[2],ltype,icol);
|
||||
else fcid = lmp->atom->find_custom(&name[3],ltype,icol);
|
||||
|
||||
if (fcid < 0) {
|
||||
@ -3104,20 +3100,17 @@ void lammps_gather_concat(void *handle, char *name, int type, int count, void *d
|
||||
|
||||
if (lmp->modify->fix[fcid]->peratom_flag == 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat:"
|
||||
" fix does not return peratom data");
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: fix does not return peratom data");
|
||||
return;
|
||||
}
|
||||
if (count>1 && lmp->modify->fix[fcid]->size_peratom_cols != count) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat:"
|
||||
" count != values peratom for fix");
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: count != values peratom for fix");
|
||||
return;
|
||||
}
|
||||
if (lmp->update->ntimestep % lmp->modify->fix[fcid]->peratom_freq) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->all(FLERR,"lammps_gather_concat:"
|
||||
" fix not computed at compatible time");
|
||||
lmp->error->all(FLERR,"lammps_gather_concat: fix not computed at compatible time");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3138,14 +3131,12 @@ void lammps_gather_concat(void *handle, char *name, int type, int count, void *d
|
||||
|
||||
if (lmp->modify->compute[fcid]->peratom_flag == 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat:"
|
||||
" compute does not return peratom data");
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: compute does not return peratom data");
|
||||
return;
|
||||
}
|
||||
if (count>1 && lmp->modify->compute[fcid]->size_peratom_cols != count) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat:"
|
||||
" count != values peratom for compute");
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: count != values peratom for compute");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3157,39 +3148,31 @@ void lammps_gather_concat(void *handle, char *name, int type, int count, void *d
|
||||
}
|
||||
|
||||
// custom per-atom vector or array
|
||||
// OLDSTYLE code
|
||||
|
||||
if ((vptr==nullptr) &&
|
||||
((strstr(name,"d_") == name) || (strstr(name,"i_") == name) ||
|
||||
(strstr(name,"d2_") == name) || (strstr(name,"i2_") == name))) {
|
||||
if ((vptr==nullptr) && utils::strmatch(name,"^[id]2?_")) {
|
||||
|
||||
if ((strstr(name,"d_") == name) || (strstr(name,"i_") == name))
|
||||
fcid = lmp->atom->find_custom(&name[2],ltype,icol);
|
||||
if (utils::strmatch(name,"^[id]_")) fcid = lmp->atom->find_custom(&name[2],ltype,icol);
|
||||
else fcid = lmp->atom->find_custom(&name[3],ltype,icol);
|
||||
|
||||
if (fcid < 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: "
|
||||
"unknown property/atom id");
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: unknown property/atom id");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ltype != type) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: "
|
||||
"mismatch property/atom type");
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: mismatch property/atom type");
|
||||
return;
|
||||
}
|
||||
if (count == 1 && icol != 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: "
|
||||
"mismatch property/atom count");
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: mismatch property/atom count");
|
||||
return;
|
||||
}
|
||||
if (count > 1 && icol != count) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: "
|
||||
"mismatch property/atom count");
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: mismatch property/atom count");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3375,14 +3358,12 @@ void lammps_gather_subset(void *handle, char *name,
|
||||
return;
|
||||
}
|
||||
if (count>1 && lmp->modify->fix[fcid]->size_peratom_cols != count) {
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset:"
|
||||
" count != values peratom for fix");
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: count != values peratom for fix");
|
||||
return;
|
||||
}
|
||||
if (lmp->update->ntimestep % lmp->modify->fix[fcid]->peratom_freq) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->all(FLERR,"lammps_gather_subset:"
|
||||
" fix not computed at compatible time");
|
||||
lmp->error->all(FLERR,"lammps_gather_subset: fix not computed at compatible time");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3403,14 +3384,12 @@ void lammps_gather_subset(void *handle, char *name,
|
||||
|
||||
if (lmp->modify->compute[fcid]->peratom_flag == 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset:"
|
||||
" compute does not return peratom data");
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: compute does not return peratom data");
|
||||
return;
|
||||
}
|
||||
if (count>1 && lmp->modify->compute[fcid]->size_peratom_cols != count) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset:"
|
||||
" count != values peratom for compute");
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: count != values peratom for compute");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3422,39 +3401,32 @@ void lammps_gather_subset(void *handle, char *name,
|
||||
}
|
||||
|
||||
// custom fix property/atom vector or array
|
||||
// OLDSTYLE code
|
||||
|
||||
if ((vptr == nullptr) &&
|
||||
((strstr(name,"d_") == name) || (strstr(name,"i_") == name) ||
|
||||
(strstr(name,"d2_") == name) || (strstr(name,"i2_") == name))) {
|
||||
if ((vptr == nullptr) && utils::strmatch(name,"^[id]2?_")) {
|
||||
|
||||
if ((strstr(name,"d_") == name) || (strstr(name,"i_") == name))
|
||||
if (utils::strmatch(name,"^[id]_"))
|
||||
fcid = lmp->atom->find_custom(&name[2],ltype,icol);
|
||||
else fcid = lmp->atom->find_custom(&name[3],ltype,icol);
|
||||
|
||||
if (fcid < 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: "
|
||||
"unknown property/atom id");
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: unknown property/atom id");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ltype != type) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: "
|
||||
"mismatch property/atom type");
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: mismatch property/atom type");
|
||||
return;
|
||||
}
|
||||
if (count == 1 && icol != 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: "
|
||||
"mismatch property/atom count");
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: mismatch property/atom count");
|
||||
return;
|
||||
}
|
||||
if (count > 1 && icol != count) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: "
|
||||
"mismatch property/atom count");
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: mismatch property/atom count");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3678,13 +3650,10 @@ void lammps_scatter(void *handle, char *name, int type, int count, void *data)
|
||||
}
|
||||
|
||||
// custom fix property/atom vector or array
|
||||
// OLDSTYLE code
|
||||
|
||||
if ((vptr == nullptr) &&
|
||||
((strstr(name,"d_") == name) || (strstr(name,"i_") == name) ||
|
||||
(strstr(name,"d2_") == name) || (strstr(name,"i2_") == name))) {
|
||||
if ((vptr == nullptr) && utils::strmatch(name,"^[id]2?_")) {
|
||||
|
||||
if ((strstr(name,"d_") == name) || (strstr(name,"i_") == name))
|
||||
if (utils::strmatch(name,"^[id]_"))
|
||||
fcid = lmp->atom->find_custom(&name[2],ltype,icol);
|
||||
else fcid = lmp->atom->find_custom(&name[3],ltype,icol);
|
||||
|
||||
@ -3902,27 +3871,22 @@ void lammps_scatter_subset(void *handle, char *name,int type, int count,
|
||||
}
|
||||
|
||||
// custom fix property/atom vector or array
|
||||
// OLDSTYLE code
|
||||
|
||||
if ((vptr == nullptr) &&
|
||||
((strstr(name,"d_") == name) || (strstr(name,"i_") == name) ||
|
||||
(strstr(name,"d2_") == name) || (strstr(name,"i2_") == name))) {
|
||||
if ((vptr == nullptr) && utils::strmatch(name,"^[id]2?_")) {
|
||||
|
||||
if ((strstr(name,"d_") == name) || (strstr(name,"i_") == name))
|
||||
if (utils::strmatch(name,"^[id]_"))
|
||||
fcid = lmp->atom->find_custom(&name[2],ltype,icol);
|
||||
else fcid = lmp->atom->find_custom(&name[3],ltype,icol);
|
||||
|
||||
if (fcid < 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter_subset: "
|
||||
"unknown property/atom id");
|
||||
lmp->error->warning(FLERR,"lammps_scatter_subset: unknown property/atom id");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ltype != type) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter_subset: "
|
||||
"mismatch property/atom type");
|
||||
lmp->error->warning(FLERR,"lammps_scatter_subset: mismatch property/atom type");
|
||||
return;
|
||||
}
|
||||
if (count == 1 && icol != 0) {
|
||||
|
||||
@ -223,16 +223,11 @@ void Modify::init()
|
||||
list_init_energy_global(n_energy_global,list_energy_global);
|
||||
list_init_energy_atom(n_energy_atom,list_energy_atom);
|
||||
|
||||
list_init(INITIAL_INTEGRATE_RESPA,
|
||||
n_initial_integrate_respa,list_initial_integrate_respa);
|
||||
list_init(POST_INTEGRATE_RESPA,
|
||||
n_post_integrate_respa,list_post_integrate_respa);
|
||||
list_init(POST_FORCE_RESPA,
|
||||
n_post_force_respa,list_post_force_respa);
|
||||
list_init(PRE_FORCE_RESPA,
|
||||
n_pre_force_respa,list_pre_force_respa);
|
||||
list_init(FINAL_INTEGRATE_RESPA,
|
||||
n_final_integrate_respa,list_final_integrate_respa);
|
||||
list_init(INITIAL_INTEGRATE_RESPA,n_initial_integrate_respa,list_initial_integrate_respa);
|
||||
list_init(POST_INTEGRATE_RESPA,n_post_integrate_respa,list_post_integrate_respa);
|
||||
list_init(POST_FORCE_RESPA,n_post_force_respa,list_post_force_respa);
|
||||
list_init(PRE_FORCE_RESPA,n_pre_force_respa,list_pre_force_respa);
|
||||
list_init(FINAL_INTEGRATE_RESPA,n_final_integrate_respa,list_final_integrate_respa);
|
||||
|
||||
list_init(MIN_PRE_EXCHANGE,n_min_pre_exchange,list_min_pre_exchange);
|
||||
list_init(MIN_PRE_NEIGHBOR,n_min_pre_neighbor,list_min_pre_neighbor);
|
||||
|
||||
104
src/set.cpp
104
src/set.cpp
@ -14,6 +14,7 @@
|
||||
|
||||
#include "set.h"
|
||||
|
||||
#include "arg_info.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "atom_vec_body.h"
|
||||
@ -570,69 +571,64 @@ void Set::command(int narg, char **arg)
|
||||
set(DPDTHETA);
|
||||
iarg += 2;
|
||||
|
||||
// custom per-atom vector
|
||||
} else {
|
||||
|
||||
} else if (utils::strmatch(arg[iarg],"^i_")) {
|
||||
// set custom per-atom vector or array or error out
|
||||
|
||||
int flag,cols;
|
||||
ArgInfo argi(arg[iarg],ArgInfo::DNAME|ArgInfo::INAME);
|
||||
const char *pname = argi.get_name();
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
index_custom = atom->find_custom(argi.get_name(),flag,cols);
|
||||
if (index_custom < 0) error->all(FLERR,"Custom property {} does not exist",pname);
|
||||
|
||||
switch (argi.get_type()) {
|
||||
|
||||
case ArgInfo::INAME:
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
int flag,cols;
|
||||
index_custom = atom->find_custom(&arg[iarg][2],flag,cols);
|
||||
if (index_custom < 0 || flag || cols)
|
||||
error->all(FLERR,"Set command integer vector does not exist");
|
||||
set(IVEC);
|
||||
iarg += 2;
|
||||
if (flag != 0) error->all(FLERR,"Custom property {} is not integer",pname);
|
||||
|
||||
} else if (utils::strmatch(arg[iarg],"^d_")) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (argi.get_dim() == 0) {
|
||||
if (cols > 0)
|
||||
error->all(FLERR,"Set command custom integer property {} is not a vector",pname);
|
||||
set(IVEC);
|
||||
} else if (argi.get_dim() == 1) {
|
||||
if (cols == 0)
|
||||
error->all(FLERR,"Set command custom integer property {} is not an array",pname);
|
||||
icol_custom = argi.get_index1();
|
||||
if (icol_custom <= 0 || icol_custom > cols)
|
||||
error->all(FLERR,"Set command per-atom custom integer array {} is accessed "
|
||||
"out-of-range",pname);
|
||||
set(IARRAY);
|
||||
} else error->all(FLERR,"Illegal set command");
|
||||
break;
|
||||
|
||||
case ArgInfo::DNAME:
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
int flag,cols;
|
||||
index_custom = atom->find_custom(&arg[iarg][2],flag,cols);
|
||||
if (index_custom < 0 || flag || cols)
|
||||
error->all(FLERR,"Set command floating point vector does not exist");
|
||||
if (flag != 1) error->all(FLERR,"Custom property {} is not floating-point",argi.get_name());
|
||||
|
||||
if (argi.get_dim() == 0) {
|
||||
if (cols > 0)
|
||||
error->all(FLERR,"Set command custom floating-point property is not a vector");
|
||||
set(DVEC);
|
||||
iarg += 2;
|
||||
|
||||
// custom per-atom array, must include bracketed index
|
||||
// OLDSTYLE code
|
||||
|
||||
} else if (strstr(arg[iarg],"i2_") == arg[iarg] ||
|
||||
strstr(arg[iarg],"d2_") == arg[iarg]) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
int which = 0;
|
||||
if (arg[iarg][0] == 'd') which = 1;
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
else if (!which) ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
|
||||
int n = strlen(arg[iarg]);
|
||||
char *suffix = new char[n];
|
||||
strcpy(suffix,&arg[iarg][3]);
|
||||
|
||||
char *ptr = strchr(suffix,'[');
|
||||
if (ptr) {
|
||||
if (suffix[strlen(suffix)-1] != ']')
|
||||
error->all(FLERR,"Invalid attribute in set command");
|
||||
icol_custom = atoi(ptr+1);
|
||||
*ptr = '\0';
|
||||
} else error->all(FLERR,"Set command per-atom custom array is not indexed");
|
||||
|
||||
int flag,cols;
|
||||
index_custom = atom->find_custom(suffix,flag,cols);
|
||||
delete [] suffix;
|
||||
|
||||
if ((!which && (index_custom < 0 || flag || !cols)) ||
|
||||
(which && (index_custom < 0 || !flag || !cols)))
|
||||
error->all(FLERR,"Set command per-atom custom array does not exist");
|
||||
} else if (argi.get_dim() == 1) {
|
||||
if (cols == 0)
|
||||
error->all(FLERR,"Set command custom floating-point property is not an array");
|
||||
icol_custom = argi.get_index1();
|
||||
if (icol_custom <= 0 || icol_custom > cols)
|
||||
error->all(FLERR,"Set command per-atom custom array is accessed out-of-range");
|
||||
|
||||
if (!which) set(IARRAY);
|
||||
else set(DARRAY);
|
||||
iarg += 2;
|
||||
|
||||
error->all(FLERR,"Set command per-atom custom integer array is accessed out-of-range");
|
||||
set(DARRAY);
|
||||
} else error->all(FLERR,"Illegal set command");
|
||||
break;
|
||||
|
||||
default:
|
||||
error->all(FLERR,"Illegal set command");
|
||||
break;
|
||||
}
|
||||
iarg += 2;
|
||||
}
|
||||
|
||||
// statistics
|
||||
// for CC option, include species index
|
||||
@ -1007,7 +1003,7 @@ void Set::set(int keyword)
|
||||
(((imageint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS);
|
||||
}
|
||||
|
||||
// set value for custom vector or array
|
||||
// set value for custom property vector or array
|
||||
|
||||
else if (keyword == IVEC) {
|
||||
atom->ivector[index_custom][i] = ivalue;
|
||||
|
||||
@ -214,7 +214,7 @@ char *utils::fgets_trunc(char *buf, int size, FILE *fp)
|
||||
void utils::sfgets(const char *srcname, int srcline, char *s, int size, FILE *fp,
|
||||
const char *filename, Error *error)
|
||||
{
|
||||
constexpr int MAXPATHLENBUF=1024;
|
||||
constexpr int MAXPATHLENBUF = 1024;
|
||||
char *rv = fgets(s, size, fp);
|
||||
if (rv == nullptr) { // something went wrong
|
||||
char buf[MAXPATHLENBUF];
|
||||
@ -243,7 +243,7 @@ void utils::sfgets(const char *srcname, int srcline, char *s, int size, FILE *fp
|
||||
void utils::sfread(const char *srcname, int srcline, void *s, size_t size, size_t num, FILE *fp,
|
||||
const char *filename, Error *error)
|
||||
{
|
||||
constexpr int MAXPATHLENBUF=1024;
|
||||
constexpr int MAXPATHLENBUF = 1024;
|
||||
size_t rv = fread(s, size, num, fp);
|
||||
if (rv != num) { // something went wrong
|
||||
char buf[MAXPATHLENBUF];
|
||||
@ -543,16 +543,21 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int mod
|
||||
std::string word(arg[iarg]);
|
||||
expandflag = 0;
|
||||
|
||||
// only match compute/fix reference with a '*' wildcard
|
||||
// match compute, fix, or custom property array reference with a '*' wildcard
|
||||
// number range in the first pair of square brackets
|
||||
|
||||
if (strmatch(word, "^[cf]_\\w+\\[\\d*\\*\\d*\\]")) {
|
||||
if (strmatch(word, "^[cf]_\\w+\\[\\d*\\*\\d*\\]") ||
|
||||
strmatch(word, "^[id]2_\\w+\\[\\d*\\*\\d*\\]")) {
|
||||
|
||||
// split off the compute/fix ID, the wildcard and trailing text
|
||||
// split off the compute/fix/property ID, the wildcard and trailing text
|
||||
|
||||
size_t first = word.find("[");
|
||||
size_t second = word.find("]", first + 1);
|
||||
if (word[1] == '2')
|
||||
id = word.substr(3, first - 3);
|
||||
else
|
||||
id = word.substr(2, first - 2);
|
||||
|
||||
wc = word.substr(first + 1, second - first - 1);
|
||||
tail = word.substr(second + 1);
|
||||
|
||||
@ -604,64 +609,23 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int mod
|
||||
expandflag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// only match custom array reference with a '*' wildcard
|
||||
// number range in the first pair of square brackets
|
||||
// OLDSTYLE code
|
||||
|
||||
if (strncmp(arg[iarg],"i2_",3) == 0 || strncmp(arg[iarg],"d2_",3) == 0) {
|
||||
char *ptr1 = strchr(arg[iarg],'[');
|
||||
if (ptr1) {
|
||||
char *ptr2 = strchr(ptr1,']');
|
||||
if (ptr2) {
|
||||
*ptr2 = '\0';
|
||||
if (strchr(ptr1,'*')) {
|
||||
} else if ((word[0] == 'i') || (word[0] == 'd')) {
|
||||
int flag, cols;
|
||||
int icustom = lmp->atom->find_custom(id.c_str(), flag, cols);
|
||||
|
||||
if (arg[iarg][0] == 'i') {
|
||||
*ptr1 = '\0';
|
||||
int flag,cols;
|
||||
int icustom = lmp->atom->find_custom(&arg[iarg][3],flag,cols);
|
||||
*ptr1 = '[';
|
||||
if ((icustom >= 0) && (mode == 1) && (cols > 0)) {
|
||||
|
||||
// check for custom per-atom integer array
|
||||
// check for custom per-atom array
|
||||
|
||||
if (icustom >= 0) {
|
||||
if (mode == 1 && !flag && cols) {
|
||||
if (((word[0] == 'i') && (flag == 0)) || ((word[0] == 'd') && (flag == 1))) {
|
||||
nmax = cols;
|
||||
expandflag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (arg[iarg][0] == 'd') {
|
||||
*ptr1 = '\0';
|
||||
int flag,cols;
|
||||
int icustom = lmp->atom->find_custom(&arg[iarg][3],flag,cols);
|
||||
*ptr1 = '[';
|
||||
|
||||
// check for custom per-atom floating point array
|
||||
|
||||
if (icustom >= 0) {
|
||||
if (mode == 1 && flag && cols) {
|
||||
nmax = cols;
|
||||
expandflag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// split off the array name ID, the wildcard and trailing text
|
||||
|
||||
if (expandflag) {
|
||||
size_t first = word.find("[");
|
||||
size_t second = word.find("]", first + 1);
|
||||
id = word.substr(2, first - 2);
|
||||
wc = word.substr(first + 1, second - first - 1);
|
||||
tail = word.substr(second + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// expansion will take place
|
||||
@ -678,10 +642,12 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int mod
|
||||
|
||||
for (int index = nlo; index <= nhi; index++) {
|
||||
// assemble and duplicate expanded string
|
||||
if (word[1] == '2')
|
||||
earg[newarg] = utils::strdup(fmt::format("{}2_{}[{}]{}", word[0], id, index, tail));
|
||||
else
|
||||
earg[newarg] = utils::strdup(fmt::format("{}_{}[{}]{}", word[0], id, index, tail));
|
||||
newarg++;
|
||||
}
|
||||
|
||||
} else {
|
||||
// no expansion: duplicate original string
|
||||
if (newarg == maxarg) {
|
||||
@ -692,6 +658,7 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int mod
|
||||
newarg++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("NEWARG %d\n",newarg);
|
||||
for (int i = 0; i < newarg; i++)
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "../testing/core.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec_body.h"
|
||||
#include "atom_vec_ellipsoid.h"
|
||||
@ -24,7 +25,6 @@
|
||||
#include "utils.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "../testing/core.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
@ -48,7 +48,7 @@
|
||||
|
||||
using LAMMPS_NS::utils::split_words;
|
||||
|
||||
static void create_molecule_files(const std::string & h2o_filename, const std::string & co2_filename)
|
||||
static void create_molecule_files(const std::string &h2o_filename, const std::string &co2_filename)
|
||||
{
|
||||
// create molecule files
|
||||
const char h2o_file[] = "# Water molecule. SPC/E model.\n\n3 atoms\n2 bonds\n1 angles\n\n"
|
||||
@ -95,11 +95,10 @@ using ::testing::Eq;
|
||||
|
||||
class AtomStyleTest : public LAMMPSTest {
|
||||
protected:
|
||||
static void SetUpTestSuite() {
|
||||
create_molecule_files("h2o.mol", "co2.mol");
|
||||
}
|
||||
static void SetUpTestSuite() { create_molecule_files("h2o.mol", "co2.mol"); }
|
||||
|
||||
static void TearDownTestSuite() {
|
||||
static void TearDownTestSuite()
|
||||
{
|
||||
remove("h2o.mol");
|
||||
remove("co2.mol");
|
||||
}
|
||||
@ -237,8 +236,10 @@ struct AtomState {
|
||||
bool has_dihedral = false;
|
||||
bool has_improper = false;
|
||||
|
||||
bool has_iname = false;
|
||||
bool has_dname = false;
|
||||
bool has_ivname = false;
|
||||
bool has_dvname = false;
|
||||
bool has_ianame = false;
|
||||
bool has_daname = false;
|
||||
bool has_mass = false;
|
||||
bool has_mass_setflag = false;
|
||||
|
||||
@ -444,8 +445,10 @@ void ASSERT_ATOM_STATE_EQ(Atom *atom, const AtomState &expected)
|
||||
ASSERT_EQ(atom->nivector, expected.nivector);
|
||||
ASSERT_EQ(atom->ndvector, expected.ndvector);
|
||||
|
||||
ASSERT_ARRAY_ALLOCATED(atom->iname, expected.has_iname);
|
||||
ASSERT_ARRAY_ALLOCATED(atom->dname, expected.has_dname);
|
||||
ASSERT_ARRAY_ALLOCATED(atom->ivname, expected.has_ivname);
|
||||
ASSERT_ARRAY_ALLOCATED(atom->dvname, expected.has_dvname);
|
||||
ASSERT_ARRAY_ALLOCATED(atom->ianame, expected.has_ianame);
|
||||
ASSERT_ARRAY_ALLOCATED(atom->daname, expected.has_daname);
|
||||
ASSERT_ARRAY_ALLOCATED(atom->mass, expected.has_mass);
|
||||
ASSERT_ARRAY_ALLOCATED(atom->mass_setflag, expected.has_mass_setflag);
|
||||
|
||||
@ -4555,7 +4558,8 @@ TEST_F(AtomStyleTest, property_atom)
|
||||
{
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("atom_modify map array");
|
||||
command("fix Properties all property/atom i_one d_two mol d_three q rmass ghost yes");
|
||||
command("fix Properties all property/atom "
|
||||
"i_one d_two mol d_three q rmass i2_four 2 d2_five 3 ghost yes");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
AtomState expected;
|
||||
@ -4570,8 +4574,10 @@ TEST_F(AtomStyleTest, property_atom)
|
||||
expected.has_x = true;
|
||||
expected.has_v = true;
|
||||
expected.has_f = true;
|
||||
expected.has_iname = true;
|
||||
expected.has_dname = true;
|
||||
expected.has_ivname = true;
|
||||
expected.has_dvname = true;
|
||||
expected.has_ianame = true;
|
||||
expected.has_daname = true;
|
||||
expected.has_extra_grow = true;
|
||||
expected.has_extra_restart = true;
|
||||
expected.has_extra_border = true;
|
||||
@ -4614,7 +4620,12 @@ TEST_F(AtomStyleTest, property_atom)
|
||||
command("set atom 2 d_three -1.0");
|
||||
command("set atom 3 d_three 0.5");
|
||||
command("set atom 4 d_three 2.0");
|
||||
|
||||
command("set atom * d2_five[1] -5.9");
|
||||
command("set atom * d2_five[2] 1.1e-2");
|
||||
command("set atom * d2_five[3] .1");
|
||||
command("set atom 1*2 i2_four[1] -2");
|
||||
command("set atom 3*4 i2_four[1] -1");
|
||||
command("set atom * i2_four[2] 2");
|
||||
END_HIDE_OUTPUT();
|
||||
expected.natoms = 4;
|
||||
expected.nlocal = 4;
|
||||
|
||||
@ -478,6 +478,17 @@ TEST(Utils, strmatch_opt_char)
|
||||
{
|
||||
ASSERT_TRUE(utils::strmatch("rigid", "^r?igid"));
|
||||
ASSERT_TRUE(utils::strmatch("igid", "^r?igid"));
|
||||
ASSERT_TRUE(utils::strmatch("c_name","^[cfvid]2?_name"));
|
||||
ASSERT_TRUE(utils::strmatch("f_name","^[cfvid]2?_name"));
|
||||
ASSERT_TRUE(utils::strmatch("v_name","^[cfvid]2?_name"));
|
||||
ASSERT_TRUE(utils::strmatch("i_name","^[cfvid]2?_name"));
|
||||
ASSERT_TRUE(utils::strmatch("d_name","^[cfvid]2?_name"));
|
||||
ASSERT_TRUE(utils::strmatch("i2_name","^[cfvid]2?_name"));
|
||||
ASSERT_TRUE(utils::strmatch("d2_name","^[cfvid]2?_name"));
|
||||
ASSERT_FALSE(utils::strmatch("d2name","^[cfvid]2?_name"));
|
||||
ASSERT_FALSE(utils::strmatch("i1_name","^[cfvid]2?_name"));
|
||||
ASSERT_FALSE(utils::strmatch("V_name","^[cfvid]2?_name"));
|
||||
ASSERT_FALSE(utils::strmatch("x_name","^[cfvid]2?_name"));
|
||||
}
|
||||
|
||||
TEST(Utils, strmatch_dot)
|
||||
|
||||
Reference in New Issue
Block a user