add warning if gravity is used incorrectly with overlapped rigid bodies

This commit is contained in:
Steve Plimpton 2019-12-19 16:17:14 -07:00
parent 5859b18d2f
commit a11b886b5c
2 changed files with 34 additions and 0 deletions

View File

@ -728,6 +728,23 @@ void FixRigid::init()
}
}
// warn if body properties are read from inpfile
// and the gravity keyword is not set and a gravity fix exists
// this could mean body particles are overlapped
// and gravity is not applied correctly
if (inpfile && !id_gravity) {
for (i = 0; i < modify->nfix; i++) {
if (strcmp(modify->fix[i]->style,"gravity") == 0) {
if (comm->me == 0)
error->warning(FLERR,"Gravity may not be correctly applied "
"to rigid bodies if they consist of "
"overlapped particles");
break;
}
}
}
// error if npt,nph fix comes before rigid fix
for (i = 0; i < modify->nfix; i++) {

View File

@ -574,6 +574,23 @@ void FixRigidSmall::init()
}
}
// warn if body properties are read from inpfile or a mol template file
// and the gravity keyword is not set and a gravity fix exists
// this could mean body particles are overlapped
// and gravity is not applied correctly
if ((inpfile || onemols) && !id_gravity) {
for (i = 0; i < modify->nfix; i++) {
if (strcmp(modify->fix[i]->style,"gravity") == 0) {
if (comm->me == 0)
error->warning(FLERR,"Gravity may not be correctly applied "
"to rigid bodies if they consist of "
"overlapped particles");
break;
}
}
}
// error if npt,nph fix comes before rigid fix
for (i = 0; i < modify->nfix; i++) {