Guest User

Untitled

a guest
Nov 19th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. double sum_sin = 0.0, sum_cos = 0.0;
  2. int count = 0;
  3. #pragma omp parallel for reduction(+ : count ,sum_sin,sum_cos)
  4. for (vector<int>::iterator it = box_neighbors[bx[i]].begin(); it != box_neighbors[bx[i]].end(); ++it)
  5. {
  6. for (vector<int>::iterator itp = box_particles[*it].begin(); itp != box_particles[*it].end(); ++itp)
  7. {
  8. if(dist(x[i], y[i], x[*itp], y[*itp], L) < R0_two)
  9. {
  10. sum_sin+= sin(theta[*itp]);
  11. sum_cos+= cos(theta[*itp]);
  12. count+=1; //number of neighbours of i'th particle
  13. }
  14. }
  15. }
  16. sum_sin/= count;
  17. sum_cos/= count;
Add Comment
Please, Sign In to add comment