Improve performance of pair_reaxc, this change is safe because the non-bonded i-loop doesn't include ghost atoms; this optimization is already included in the USER-OMP version

This commit is contained in:
Stan Moore 2017-11-30 09:22:32 -07:00
parent 8c2d38c7e9
commit c3aa705d04
1 changed files with 8 additions and 2 deletions

View File

@ -697,7 +697,7 @@ int PairReaxC::write_reax_lists()
int itr_i, itr_j, i, j;
int num_nbrs;
int *ilist, *jlist, *numneigh, **firstneigh;
double d_sqr;
double d_sqr, cutoff_sqr;
rvec dvec;
double *dist, **x;
reax_list *far_nbrs;
@ -712,6 +712,7 @@ int PairReaxC::write_reax_lists()
far_list = far_nbrs->select.far_nbr_list;
num_nbrs = 0;
int inum = list->inum;
dist = (double*) calloc( system->N, sizeof(double) );
int numall = list->inum + list->gnum;
@ -721,12 +722,17 @@ int PairReaxC::write_reax_lists()
jlist = firstneigh[i];
Set_Start_Index( i, num_nbrs, far_nbrs );
if (i < inum)
cutoff_sqr = control->nonb_cut*control->nonb_cut;
else
cutoff_sqr = control->bond_cut*control->bond_cut;
for( itr_j = 0; itr_j < numneigh[i]; ++itr_j ){
j = jlist[itr_j];
j &= NEIGHMASK;
get_distance( x[j], x[i], &d_sqr, &dvec );
if( d_sqr <= (control->nonb_cut*control->nonb_cut) ){
if( d_sqr <= (cutoff_sqr) ){
dist[j] = sqrt( d_sqr );
set_far_nbr( &far_list[num_nbrs], j, dist[j], dvec );
++num_nbrs;