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

View File

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

View File

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