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

This commit is contained in:
sjplimp 2011-06-22 13:11:56 +00:00
parent b1f2ef75fa
commit b6796f01c5
3 changed files with 7 additions and 4 deletions

View File

@ -350,7 +350,8 @@ double ComputeReduce::compute_scalar()
MPI_Allreduce(&one,&scalar,1,MPI_DOUBLE,MPI_MAX,world);
} else if (mode == AVE) {
MPI_Allreduce(&one,&scalar,1,MPI_DOUBLE,MPI_SUM,world);
scalar /= count(0);
bigint n = count(0);
if (n) scalar /= n;
}
return scalar;
@ -419,7 +420,8 @@ void ComputeReduce::compute_vector()
} else if (mode == AVE) {
for (int m = 0; m < nvalues; m++) {
MPI_Allreduce(&onevec[m],&vector[m],1,MPI_DOUBLE,MPI_SUM,world);
vector[m] /= count(m);
bigint n = count(m);
if (n) vector[m] /= n;
}
}
}

View File

@ -440,7 +440,7 @@ void FixStoreState::end_of_step()
// evaluate atom-style variable
} else if (which[m] == VARIABLE)
input->variable->compute_atom(n,igroup,&values[0][m],nvalues,1);
input->variable->compute_atom(n,igroup,&values[0][m],nvalues,0);
}
}

View File

@ -210,6 +210,7 @@ void Variable::set(int narg, char **arg)
if (nvar == maxvar) extend();
style[nvar] = UNIVERSE;
num[nvar] = narg - 2;
pad[nvar] = 0;
data[nvar] = new char*[num[nvar]];
copy(num[nvar],&arg[2],data[nvar]);
} else if (strcmp(arg[1],"uloop") == 0) {
@ -500,7 +501,7 @@ void Variable::compute_atom(int ivar, int igroup,
if (sumflag == 0) {
int m = 0;
for (int i = 0; i < nlocal; i++) {
if (mask[i] && groupbit) result[m] = eval_tree(tree,i);
if (mask[i] & groupbit) result[m] = eval_tree(tree,i);
else result[m] = 0.0;
m += stride;
}