Here is the patch again (it also adds access to the per atom charge):
diff --git a/src/variable.cpp b/src/variable.cpp
index f625668..a0badb6 100644
--- a/src/variable.cpp
+++ b/src/variable.cpp
@@ -3278,6 +3278,8 @@ void Variable::peratom2global(int flag, char *word,
else if (strcmp(word,"fx") == 0) mine = atom->f[index][0];
else if (strcmp(word,"fy") == 0) mine = atom->f[index][1];
else if (strcmp(word,"fz") == 0) mine = atom->f[index][2];
+ else if (strcmp(word,"q") == 0 && atom->q_flag) mine = atom->q[index];
+ else if (strcmp(word,"radius") == 0 && atom->radius_flag) mine
= atom->radius[index];
else error->one(FLERR,"Invalid atom vector in variable formula");
@@ -3317,6 +3319,8 @@ int Variable::is_atom_vector(char *word)
if (strcmp(word,"fx") == 0) return 1;
if (strcmp(word,"fy") == 0) return 1;
if (strcmp(word,"fz") == 0) return 1;
+ if (strcmp(word,"q") == 0 && atom->q_flag) return 1;
+ if (strcmp(word,"radius") == 0 && atom->radius_flag) return 1;
return 0;
}
@@ -3362,6 +3366,8 @@ void Variable::atom_vector(char *word, Tree **tree,
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->array = atom->q;
+ else if (strcmp(word,"radius") == 0) newtree->array = atom->radius;
}
/* ----------------------------------------------------------------------