diff --git a/doc/src/variable.rst b/doc/src/variable.rst index 31338279ea..8bd33218ac 100644 --- a/doc/src/variable.rst +++ b/doc/src/variable.rst @@ -69,7 +69,7 @@ Syntax special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x), is_file(name), is_os(name), extract_setting(name), label2type(kind,label) feature functions = is_active(category,feature), is_available(category,feature), is_defined(category,id) atom value = id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i], q[i] - atom vector = id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q + atom vector = id, mass, type, mol, radius, q, x, y, z, vx, vy, vz, fx, fy, fz compute references = c_ID, c_ID[i], c_ID[i][j], C_ID, C_ID[i] fix references = f_ID, f_ID[i], f_ID[i][j], F_ID, F_ID[i] variable references = v_name, v_name[i] diff --git a/src/variable.cpp b/src/variable.cpp index 19aed73734..b9b3661af8 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -4563,6 +4563,7 @@ int Variable::is_atom_vector(char *word) if (strcmp(word,"id") == 0) return 1; if (strcmp(word,"mass") == 0) return 1; if (strcmp(word,"type") == 0) return 1; + if (strcmp(word,"radius") == 0) return 1; if (strcmp(word,"mol") == 0) return 1; if (strcmp(word,"x") == 0) return 1; if (strcmp(word,"y") == 0) return 1; @@ -4621,7 +4622,7 @@ void Variable::atom_vector(char *word, Tree **tree, Tree **treestack, int &ntree } else if (strcmp(word,"mol") == 0) { if (!atom->molecule_flag) - error->one(FLERR,"Variable uses atom property that isn't allocated"); + error->one(FLERR,"Variable uses atom property 'mol' that isn't allocated"); if (sizeof(tagint) == sizeof(smallint)) { newtree->type = INTARRAY; newtree->iarray = (int *) atom->molecule; @@ -4630,6 +4631,18 @@ void Variable::atom_vector(char *word, Tree **tree, Tree **treestack, int &ntree newtree->barray = (bigint *) atom->molecule; } newtree->nstride = 1; + + } else if (strcmp(word,"radius") == 0) { + if (!atom->radius_flag) + error->one(FLERR,"Variable uses atom property 'radius' that isn't allocated"); + newtree->array = atom->radius; + newtree->nstride = 1; + + } else if (strcmp(word,"q") == 0) { + if (!atom->q_flag) + error->one(FLERR,"Variable uses atom property 'q' that isn't allocated"); + newtree->array = atom->q; + newtree->nstride = 1; } else if (strcmp(word,"x") == 0) newtree->array = &atom->x[0][0]; @@ -4641,11 +4654,6 @@ void Variable::atom_vector(char *word, Tree **tree, Tree **treestack, int &ntree else if (strcmp(word,"fx") == 0) newtree->array = &atom->f[0][0]; else if (strcmp(word,"fy") == 0) newtree->array = &atom->f[0][1]; else if (strcmp(word,"fz") == 0) newtree->array = &atom->f[0][2]; - - else if (strcmp(word,"q") == 0) { - newtree->nstride = 1; - newtree->array = atom->q; - } } /* ----------------------------------------------------------------------