diff --git a/src/compute_hexorder_atom.cpp b/src/compute_hexorder_atom.cpp index eba3c41684..d1257e9d8b 100644 --- a/src/compute_hexorder_atom.cpp +++ b/src/compute_hexorder_atom.cpp @@ -140,7 +140,7 @@ void ComputeHexOrderAtom::init_list(int id, NeighList *ptr) void ComputeHexOrderAtom::compute_peratom() { - int i,j,m,ii,jj,inum,jnum; + int i,j,ii,jj,inum,jnum; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; int *ilist,*jlist,*numneigh,**firstneigh; @@ -264,7 +264,6 @@ inline void ComputeHexOrderAtom::calc_qn_trig(double delx, double dely, double & if(dely > 0.0) ntheta = nnn * MY_PI / 2.0; else ntheta = nnn * 3.0 * MY_PI / 2.0; } else ntheta = nnn * atan(dely / delx); - ntheta = nnn * atan(dely / delx); u = cos(ntheta); v = sin(ntheta); } diff --git a/src/compute_orientorder_atom.cpp b/src/compute_orientorder_atom.cpp index e7eabf4936..14e66f2d79 100644 --- a/src/compute_orientorder_atom.cpp +++ b/src/compute_orientorder_atom.cpp @@ -172,7 +172,7 @@ void ComputeOrientOrderAtom::init_list(int id, NeighList *ptr) void ComputeOrientOrderAtom::compute_peratom() { - int i,j,m,ii,jj,inum,jnum; + int i,j,ii,jj,inum,jnum; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; int *ilist,*jlist,*numneigh,**firstneigh; @@ -260,8 +260,14 @@ void ComputeOrientOrderAtom::compute_peratom() if (nnn > 0) { select3(nnn,ncount,distsq,nearest,rlist); calc_boop(rlist, nnn, qn, qlist, nqlist); - } else - calc_boop(rlist, ncount, qn, qlist, nqlist); + } else { // nnn == 0 + if (ncount > 0) + calc_boop(rlist, ncount, qn, qlist, nqlist); + else { // ncount == 0 + for (int iw = 0; iw < nqlist; iw++) + qn[iw] = 0.0; + } + } } } } @@ -376,14 +382,8 @@ void ComputeOrientOrderAtom::select3(int k, int n, double *arr, int *iarr, doubl ------------------------------------------------------------------------- */ void ComputeOrientOrderAtom::calc_boop(double **rlist, - int numNeighbors, double qn[], + int ncount, double qn[], int qlist[], int nqlist) { - - // DONE: Need to make this memory allocation dynamic, - // DONE: Add error handling - // DONE: Add to memory usage - // DONE: Add options for different nnn and qlist - for (int iw = 0; iw < nqlist; iw++) { int n = qlist[iw]; @@ -394,7 +394,7 @@ void ComputeOrientOrderAtom::calc_boop(double **rlist, } } - for(int ineigh = 0; ineigh < numNeighbors; ineigh++) { + for(int ineigh = 0; ineigh < ncount; ineigh++) { const double * const r = rlist[ineigh]; double rmag = dist(r); if(rmag <= MY_EPSILON) { @@ -442,7 +442,7 @@ void ComputeOrientOrderAtom::calc_boop(double **rlist, } } - double fac = sqrt(MY_4PI) / numNeighbors; + double fac = sqrt(MY_4PI) / ncount; for (int iw = 0; iw < nqlist; iw++) { int n = qlist[iw]; double qm_sum = 0.0;