detect and abort if inconsistent body data for rounded polygon/polyhedra was provided

This commit is contained in:
Axel Kohlmeyer
2021-02-25 18:26:20 -05:00
parent 441279d935
commit 8e63f1ebf5
2 changed files with 12 additions and 0 deletions

View File

@ -569,6 +569,10 @@ void PairBodyRoundedPolygon::body2space(int i)
memory->grow(edge,edmax,5,"pair:edge");
}
if ((body_num_edges > 0) && (edge_ends == nullptr))
error->one(FLERR,fmt::format("Inconsistent edge data for body of atom {}",
atom->tag[i]));
for (int m = 0; m < body_num_edges; m++) {
edge[nedge][0] = static_cast<int>(edge_ends[2*m+0]);
edge[nedge][1] = static_cast<int>(edge_ends[2*m+1]);

View File

@ -556,6 +556,10 @@ void PairBodyRoundedPolyhedron::body2space(int i)
memory->grow(edge,edmax,6,"pair:edge");
}
if ((body_num_edges > 0) && (edge_ends == nullptr))
error->one(FLERR,fmt::format("Inconsistent edge data for body of atom {}",
atom->tag[i]));
for (int m = 0; m < body_num_edges; m++) {
edge[nedge][0] = static_cast<int>(edge_ends[2*m+0]);
edge[nedge][1] = static_cast<int>(edge_ends[2*m+1]);
@ -579,6 +583,10 @@ void PairBodyRoundedPolyhedron::body2space(int i)
memory->grow(face,facmax,MAX_FACE_SIZE,"pair:face");
}
if ((body_num_faces > 0) && (face_pts == nullptr))
error->one(FLERR,fmt::format("Inconsistent face data for body of atom {}",
atom->tag[i]));
for (int m = 0; m < body_num_faces; m++) {
for (int k = 0; k < MAX_FACE_SIZE; k++)
face[nface][k] = static_cast<int>(face_pts[MAX_FACE_SIZE*m+k]);