From 2e60e461a08fe3fe441503614fe08485702cc07a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer <akohlmey@gmail.com> Date: Thu, 31 Jan 2019 18:12:37 -0500 Subject: [PATCH] must convert regions bounding box to lattice coordinates before checking to reduce lattice creation range --- src/create_atoms.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index ddbf2e6b59..83175b9afb 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -709,6 +709,7 @@ void CreateAtoms::add_lattice() xmin = ymin = zmin = BIG; xmax = ymax = zmax = -BIG; + // convert to lattice coordinates and set bounding box domain->lattice->bbox(1,bboxlo[0],bboxlo[1],bboxlo[2], xmin,ymin,zmin,xmax,ymax,zmax); domain->lattice->bbox(1,bboxhi[0],bboxlo[1],bboxlo[2], @@ -729,12 +730,14 @@ void CreateAtoms::add_lattice() // narrow down min/max further by extent of the region, if possible if ((style == REGION) && domain->regions[nregion]->bboxflag) { - const double rxmin = domain->regions[nregion]->extent_xlo; - const double rxmax = domain->regions[nregion]->extent_xhi; - const double rymin = domain->regions[nregion]->extent_ylo; - const double rymax = domain->regions[nregion]->extent_yhi; - const double rzmin = domain->regions[nregion]->extent_zlo; - const double rzmax = domain->regions[nregion]->extent_zhi; + double rxmin = domain->regions[nregion]->extent_xlo; + double rxmax = domain->regions[nregion]->extent_xhi; + double rymin = domain->regions[nregion]->extent_ylo; + double rymax = domain->regions[nregion]->extent_yhi; + double rzmin = domain->regions[nregion]->extent_zlo; + double rzmax = domain->regions[nregion]->extent_zhi; + domain->lattice->box2lattice(rxmin,rymin,rzmin); + domain->lattice->box2lattice(rxmax,rymax,rzmax); if (rxmin > xmin) xmin = (rxmin > xmax) ? xmax : rxmin; if (rxmax < xmax) xmax = (rxmax < xmin) ? xmin : rxmax; -- GitLab