git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@431 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2007-03-22 17:05:51 +00:00
parent 2f25e80bf2
commit 9926a91608
4 changed files with 40 additions and 1 deletions

View File

@ -569,7 +569,7 @@ double Variable::evaluate(char *str, Tree *tree)
// customize by adding group function to this list and to if statement
// mass(group),charge(group),xcm(group,dim),vcm(group,dim),
// bound(group,xmin),gyration(group)
// fcm(group,dim),bound(group,xmin),gyration(group)
} else if (strcmp(func,"mass") == 0) {
if (arg2) error->all("Cannot evaluate variable");
@ -610,6 +610,17 @@ double Variable::evaluate(char *str, Tree *tree)
else if (strcmp(arg2,"z") == 0) answer = vcm[2];
else error->all("Cannot evaluate variable");
} else if (strcmp(func,"fcm") == 0) {
if (!arg2) error->all("Cannot evaluate variable");
int igroup = group->find(arg1);
if (igroup == -1) error->all("Variable group ID does not exist");
double fcm[3];
group->fcm(igroup,fcm);
if (strcmp(arg2,"x") == 0) answer = fcm[0];
else if (strcmp(arg2,"y") == 0) answer = fcm[1];
else if (strcmp(arg2,"z") == 0) answer = fcm[2];
else error->all("Cannot evaluate variable");
} else if (strcmp(func,"bound") == 0) {
if (!arg2) error->all("Cannot evaluate variable");
int igroup = group->find(arg1);