diff --git a/src/BODY/fix_wall_body_polygon.cpp b/src/BODY/fix_wall_body_polygon.cpp index 5ec5a7cca8eb30309294a14b13f8e2d10e56bd26..0e7aaea1e1a2a6c9ac0060c092eb703eaf90f2b6 100644 --- a/src/BODY/fix_wall_body_polygon.cpp +++ b/src/BODY/fix_wall_body_polygon.cpp @@ -641,18 +641,15 @@ int FixWallBodyPolygon::compute_distance_to_wall(double* x0, double rradi, mode = VERTEX; contact = 1; } else { + mode = NONE; if (side == XLO) { if (x0[0] < wall_pos) mode = VERTEX; - else mode = NONE; } else if (side == XHI) { if (x0[0] > wall_pos) mode = VERTEX; - else mode = NONE; } else if (side == YLO) { if (x0[1] < wall_pos) mode = VERTEX; - else mode = NONE; } else if (side == YHI) { if (x0[1] > wall_pos) mode = VERTEX; - else mode = NONE; } } diff --git a/src/BODY/pair_body_rounded_polyhedron.cpp b/src/BODY/pair_body_rounded_polyhedron.cpp index 2ff209d609bf1d5f31f82ddf0c6b3063949b5e2e..051be762e5a432193326596e6acbc3ad7bb9e616 100644 --- a/src/BODY/pair_body_rounded_polyhedron.cpp +++ b/src/BODY/pair_body_rounded_polyhedron.cpp @@ -685,7 +685,7 @@ void PairBodyRoundedPolyhedron::sphere_against_edge(int ibody, int jbody, { int ni,nei,ifirst,iefirst,npi1,npi2,ibonus; double xi1[3],xi2[3],vti[3],h[3],fn[3],ft[3],d,t; - double delx,dely,delz,rij,rsqinv,R,fx,fy,fz,fpair,shift,energy; + double delx,dely,delz,rsq,rij,rsqinv,R,fx,fy,fz,fpair,shift,energy; double rradi,rradj,contact_dist; double vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3; double *quat, *inertia; @@ -749,7 +749,9 @@ void PairBodyRoundedPolyhedron::sphere_against_edge(int ibody, int jbody, delx = h[0] - x[jbody][0]; dely = h[1] - x[jbody][1]; delz = h[2] - x[jbody][2]; - rij = sqrt(delx*delx + dely*dely + delz*delz); + rsq = delx*delx + dely*dely + delz*delz; + rsqinv = (rsq == 0.0) ? 0.0 : 1.0/rsq; + rij = sqrt(rsq); R = rij - contact_dist; energy = 0; @@ -2077,6 +2079,7 @@ void PairBodyRoundedPolyhedron::distance_bt_edges(const double* x1, double s1,s2,x13[3],x23[3],x13h[3]; double t13,t23,t31,t41,x31[3],x41[3]; + t13=t23=t31=t41=0.0; MathExtra::sub3(x1,x3,x13); // x13 = x1 - x3 MathExtra::sub3(x2,x3,x23); // x23 = x2 - x3