From 7f4ebaf672eb0989abbf588fe3fa5afca20f3f7f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 23 Nov 2022 13:32:13 -0500 Subject: [PATCH] correct triclinic box check --- src/domain.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/domain.cpp b/src/domain.cpp index c51f222483..97f626cbcd 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -211,12 +211,11 @@ void Domain::set_initial_box(int expandflag) if (dimension == 2 && (xz != 0.0 || yz != 0.0)) error->all(FLERR,"Cannot skew triclinic box in z for 2d simulation"); - // error check or warning on triclinic tilt factors + // check on triclinic tilt factors if (triclinic) { - if ((fabs(xy/(boxhi[0]-boxlo[0])) > 0.5 && xperiodic) || - (fabs(xz/(boxhi[0]-boxlo[0])) > 0.5 && xperiodic) || - (fabs(yz/(boxhi[1]-boxlo[1])) > 0.5 && yperiodic)) { + if ((fabs(xy/(boxhi[1]-boxlo[1])) > 0.5 && yperiodic) || + ((fabs(xz)+fabs(yz))/(boxhi[2]-boxlo[2]) > 0.5 && zperiodic)) { if (comm->me == 0) error->warning(FLERR,"Triclinic box skew is large. LAMMPS will run inefficiently."); }