From 179dcd68953adb0b45b6b91a990c0c222689a8f0 Mon Sep 17 00:00:00 2001
From: Trung Nguyen <ndactrung@gmail.com>
Date: Sat, 26 May 2018 10:02:53 -0500
Subject: [PATCH] Updated pair body rounded/polygon and rounded/polyhedron

---
 src/BODY/pair_body_rounded_polygon.cpp    | 21 +++++++++++++--------
 src/BODY/pair_body_rounded_polyhedron.cpp |  4 ++--
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/BODY/pair_body_rounded_polygon.cpp b/src/BODY/pair_body_rounded_polygon.cpp
index 62a6d77a01..22300091ae 100644
--- a/src/BODY/pair_body_rounded_polygon.cpp
+++ b/src/BODY/pair_body_rounded_polygon.cpp
@@ -38,12 +38,14 @@
 
 using namespace LAMMPS_NS;
 
-//#define _POLYGON_DEBUG
 #define DELTA 10000
 #define EPSILON 1e-3
 #define MAX_CONTACTS 4  // maximum number of contacts for 2D models
 #define EFF_CONTACTS 2  // effective contacts for 2D models
 
+//#define _CONVEX_POLYGON
+//#define _POLYGON_DEBUG
+
 enum {INVALID=0,NONE=1,VERTEXI=2,VERTEXJ=3,EDGE=4};
 
 /* ---------------------------------------------------------------------- */
@@ -846,11 +848,11 @@ int PairBodyRoundedPolygon::vertex_against_edge(int i, int j,
         #endif
         }
 
+        #ifdef _CONVEX_POLYGON
         // done with the edges from body j,
         // given that vertex ni interacts with only one vertex from one edge of body j
-        // comment out this break to take into account concave shapes
-
-//        break;
+        break;
+        #endif
 
       } else if (mode == EDGE) {
 
@@ -954,12 +956,11 @@ int PairBodyRoundedPolygon::vertex_against_edge(int i, int j,
           #endif
         } // end if contact
 
+        #ifdef _CONVEX_POLYGON
         // done with the edges from body j,
         // given that vertex ni interacts with only one edge from body j
-        // comment out this break to take into account concave shapes
-
-//        break;
-
+        break;
+        #endif
       } // end if mode
 
     } // end for looping through the edges of body j
@@ -1082,7 +1083,11 @@ int PairBodyRoundedPolygon::compute_distance_to_vertex(int ibody,
     // check if x0 (the queried vertex) and xmi (the body's center of mass)
     // are on the different sides of the edge
 
+    #ifdef _CONVEX_POLYGON
     int m = opposite_sides(xi1, xi2, x0, xmi);
+    #else
+    int m = 1;
+    #endif
 
     if (m == 0) {
 
diff --git a/src/BODY/pair_body_rounded_polyhedron.cpp b/src/BODY/pair_body_rounded_polyhedron.cpp
index 42c107d68e..d0690335df 100644
--- a/src/BODY/pair_body_rounded_polyhedron.cpp
+++ b/src/BODY/pair_body_rounded_polyhedron.cpp
@@ -46,8 +46,8 @@ using namespace MathConst;
 
 #define DELTA 10000
 #define EPSILON 1e-3
-#define MAX_FACE_SIZE 4 // maximum number of vertices per face (same as BodyRoundedPolyhedron)
-#define MAX_CONTACTS 32  // for 3D models
+#define MAX_FACE_SIZE 4  // maximum number of vertices per face (same as BodyRoundedPolyhedron)
+#define MAX_CONTACTS 32  // for 3D models (including duplicated counts)
 
 //#define _POLYHEDRON_DEBUG
 
-- 
GitLab