Skip to content
Snippets Groups Projects
Commit c3aa705d authored by Stan Moore's avatar Stan Moore
Browse files

Improve performance of pair_reaxc, this change is safe because the non-bonded...

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
parent 8c2d38c7
No related branches found
No related tags found
No related merge requests found
...@@ -697,7 +697,7 @@ int PairReaxC::write_reax_lists() ...@@ -697,7 +697,7 @@ int PairReaxC::write_reax_lists()
int itr_i, itr_j, i, j; int itr_i, itr_j, i, j;
int num_nbrs; int num_nbrs;
int *ilist, *jlist, *numneigh, **firstneigh; int *ilist, *jlist, *numneigh, **firstneigh;
double d_sqr; double d_sqr, cutoff_sqr;
rvec dvec; rvec dvec;
double *dist, **x; double *dist, **x;
reax_list *far_nbrs; reax_list *far_nbrs;
...@@ -712,6 +712,7 @@ int PairReaxC::write_reax_lists() ...@@ -712,6 +712,7 @@ int PairReaxC::write_reax_lists()
far_list = far_nbrs->select.far_nbr_list; far_list = far_nbrs->select.far_nbr_list;
num_nbrs = 0; num_nbrs = 0;
int inum = list->inum;
dist = (double*) calloc( system->N, sizeof(double) ); dist = (double*) calloc( system->N, sizeof(double) );
int numall = list->inum + list->gnum; int numall = list->inum + list->gnum;
...@@ -721,12 +722,17 @@ int PairReaxC::write_reax_lists() ...@@ -721,12 +722,17 @@ int PairReaxC::write_reax_lists()
jlist = firstneigh[i]; jlist = firstneigh[i];
Set_Start_Index( i, num_nbrs, far_nbrs ); 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 ){ for( itr_j = 0; itr_j < numneigh[i]; ++itr_j ){
j = jlist[itr_j]; j = jlist[itr_j];
j &= NEIGHMASK; j &= NEIGHMASK;
get_distance( x[j], x[i], &d_sqr, &dvec ); 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 ); dist[j] = sqrt( d_sqr );
set_far_nbr( &far_list[num_nbrs], j, dist[j], dvec ); set_far_nbr( &far_list[num_nbrs], j, dist[j], dvec );
++num_nbrs; ++num_nbrs;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment