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

This commit is contained in:
sjplimp
2012-06-20 14:29:20 +00:00
parent f55e618e9e
commit c1e0bec7f6
3 changed files with 37 additions and 21 deletions

View File

@ -267,8 +267,9 @@ void ComputeAtomMolecule::compute_array()
}
}
MPI_Allreduce(&aone[0][0],&array[0][0],nvalues*nmolecules,
MPI_DOUBLE,MPI_SUM,world);
if (array)
MPI_Allreduce(&aone[0][0],&array[0][0],nvalues*nmolecules,
MPI_DOUBLE,MPI_SUM,world);
}
/* ----------------------------------------------------------------------
@ -296,7 +297,8 @@ void ComputeAtomMolecule::compute_one(int m)
peratom = compute->vector_atom;
nstride = 1;
} else {
peratom = &compute->array_atom[0][aidx-1];
if (compute->array_atom) peratom = &compute->array_atom[0][aidx-1];
else peratom = NULL;
nstride = compute->size_array_cols;
}

View File

@ -627,8 +627,9 @@ void FixAveHisto::end_of_step()
compute->compute_array();
compute->invoked_flag |= INVOKED_ARRAY;
}
bin_vector(compute->size_array_rows,&compute->array[0][j-1],
compute->size_array_cols);
if (compute->array)
bin_vector(compute->size_array_rows,&compute->array[0][j-1],
compute->size_array_cols);
}
} else if (kind == PERATOM) {
@ -638,7 +639,7 @@ void FixAveHisto::end_of_step()
}
if (j == 0)
bin_atoms(compute->vector_atom,1);
else
else if (compute->array_atom)
bin_atoms(compute->array_atom[j-1],
compute->size_peratom_cols);
@ -649,7 +650,7 @@ void FixAveHisto::end_of_step()
}
if (j == 0)
bin_vector(compute->size_local_rows,compute->vector_local,1);
else
else if (compute->array_local)
bin_vector(compute->size_local_rows,&compute->array_local[0][j-1],
compute->size_local_cols);
}
@ -675,11 +676,12 @@ void FixAveHisto::end_of_step()
} else if (kind == PERATOM) {
if (j == 0) bin_atoms(fix->vector_atom,1);
else bin_atoms(fix->array_atom[j-1],fix->size_peratom_cols);
else if (fix->array_atom)
bin_atoms(fix->array_atom[j-1],fix->size_peratom_cols);
} else if (kind == LOCAL) {
if (j == 0) bin_vector(fix->size_local_rows,fix->vector_local,1);
else
else if (fix->array_local)
bin_vector(fix->size_local_rows,&fix->array_local[0][j-1],
fix->size_local_cols);
}

View File

@ -871,9 +871,10 @@ double Variable::evaluate(char *str, Tree **tree)
compute->invoked_flag |= INVOKED_PERATOM;
}
peratom2global(1,NULL,&compute->array_atom[0][index2-1],
compute->size_peratom_cols,index1,
tree,treestack,ntreestack,argstack,nargstack);
if (compute->array_atom)
peratom2global(1,NULL,&compute->array_atom[0][index2-1],
compute->size_peratom_cols,index1,
tree,treestack,ntreestack,argstack,nargstack);
// c_ID = vector from per-atom vector
@ -921,7 +922,10 @@ double Variable::evaluate(char *str, Tree **tree)
Tree *newtree = new Tree();
newtree->type = ATOMARRAY;
newtree->array = &compute->array_atom[0][index1-1];
if (compute->array_atom)
newtree->array = &compute->array_atom[0][index1-1];
else
newtree->array = NULL;
newtree->nstride = compute->size_peratom_cols;
newtree->left = newtree->middle = newtree->right = NULL;
treestack[ntreestack++] = newtree;
@ -1048,9 +1052,10 @@ double Variable::evaluate(char *str, Tree **tree)
update->ntimestep % fix->peratom_freq)
error->all(FLERR,"Fix in variable not computed at compatible time");
peratom2global(1,NULL,&fix->array_atom[0][index2-1],
fix->size_peratom_cols,index1,
tree,treestack,ntreestack,argstack,nargstack);
if (fix->array_atom)
peratom2global(1,NULL,&fix->array_atom[0][index2-1],
fix->size_peratom_cols,index1,
tree,treestack,ntreestack,argstack,nargstack);
// f_ID = vector from per-atom vector
@ -1086,7 +1091,10 @@ double Variable::evaluate(char *str, Tree **tree)
Tree *newtree = new Tree();
newtree->type = ATOMARRAY;
newtree->array = &fix->array_atom[0][index1-1];
if (fix->array_atom)
newtree->array = &fix->array_atom[0][index1-1];
else
newtree->array = NULL;
newtree->nstride = fix->size_peratom_cols;
newtree->left = newtree->middle = newtree->right = NULL;
treestack[ntreestack++] = newtree;
@ -2883,7 +2891,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
"is accessed out-of-range");
if (update->whichflag == 0) {
if (compute->invoked_array != update->ntimestep)
error->all(FLERR,"Compute used in variable between runs is not current");
error->all(FLERR,
"Compute used in variable between runs is not current");
} else if (!(compute->invoked_flag & INVOKED_ARRAY)) {
compute->compute_array();
compute->invoked_flag |= INVOKED_ARRAY;
@ -2910,7 +2919,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
nstride = 1;
} else if (index && fix->array_flag) {
if (index > fix->size_array_cols)
error->all(FLERR,"Variable formula fix array is accessed out-of-range");
error->all(FLERR,
"Variable formula fix array is accessed out-of-range");
if (update->whichflag > 0 && update->ntimestep % fix->global_freq)
error->all(FLERR,"Fix in variable not computed at compatible time");
nvec = fix->size_array_rows;
@ -2925,8 +2935,10 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
if (compute) {
double *vec;
if (index) vec = &compute->array[0][index-1];
else vec = compute->vector;
if (index) {
if (compute->array) vec = &compute->array[0][index-1];
else vec = NULL;
} else vec = compute->vector;
int j = 0;
for (int i = 0; i < nvec; i++) {