From 884cf474f152d89bef80001a18f15b8818011704 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Fri, 29 Jun 2007 17:11:02 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@706 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/create_atoms.cpp | 29 ++++++++++++++++++----------- src/lammps.cpp | 4 ++-- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index 3afe22ddb6..b1229f6a68 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -260,9 +260,16 @@ void CreateAtoms::add_many() if (zmin < 0.0) klo--; // set bounds for my proc - // if periodic and I am lo/hi proc, adjust bounds by EPSILON - // on lower boundary, allows triclinic atoms just outside box to be added - // on upper boundary, prevents atoms with lower images from being added + // if periodic: + // should create exactly 1 atom when 2 images are both "on" the boundary + // either image may be slightly inside/outside true box due to round-off + // if I am lo proc, decrement lower bound by EPSILON + // this will insure lo image is created + // if I am hi proc, decrement upper bound by 2.0*EPSILON + // this will insure hi image is not created + // thus insertion box is EPSILON smaller than true box + // and is shifted away from true boundary + // which is where atoms are likely to be generated double sublo[3],subhi[3]; @@ -277,20 +284,20 @@ void CreateAtoms::add_many() } if (domain->xperiodic) { - if (triclinic && comm->myloc[0] == 0) sublo[0] -= EPSILON; - if (comm->myloc[0] == comm->procgrid[0]-1) subhi[0] -= EPSILON; + if (comm->myloc[0] == 0) sublo[0] -= EPSILON; + if (comm->myloc[0] == comm->procgrid[0]-1) subhi[0] -= 2.0*EPSILON; } if (domain->yperiodic) { - if (triclinic && comm->myloc[1] == 0) sublo[1] -= EPSILON; - if (comm->myloc[1] == comm->procgrid[1]-1) subhi[1] -= EPSILON; + if (comm->myloc[1] == 0) sublo[1] -= EPSILON; + if (comm->myloc[1] == comm->procgrid[1]-1) subhi[1] -= 2.0*EPSILON; } if (domain->zperiodic) { - if (triclinic && comm->myloc[2] == 0) sublo[2] -= EPSILON; - if (comm->myloc[2] == comm->procgrid[2]-1) subhi[2] -= EPSILON; + if (comm->myloc[2] == 0) sublo[2] -= EPSILON; + if (comm->myloc[2] == comm->procgrid[2]-1) subhi[2] -= 2.0*EPSILON; } - // iterate on 3d periodic lattice using loop bounds - // invoke add_atom for nbasis atoms in each unit cell + // iterate on 3d periodic lattice of unit cells using loop bounds + // iterate on nbasis atoms in each unit cell // convert lattice coords to box coords // add atom if it meets all criteria diff --git a/src/lammps.cpp b/src/lammps.cpp index 919791b0f3..607670eb1d 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -307,7 +307,7 @@ void LAMMPS::init() // used by fix shear_history::unpack_restart() // when force->pair->gran_history creates fix ?? modify->init(); // modify must come after update, force, atom - neighbor->init(); // neighbor must come after force, modify (due to min) + neighbor->init(); // neighbor must come after force, modify output->init(); // output must come after domain, force, modify comm->init(); // comm must come after force, modify timer->init(); @@ -329,7 +329,7 @@ void LAMMPS::destroy() delete output; delete modify; // modify must come after output, force, update // since they delete fixes - delete atom; // must come after modify, neighbor + delete atom; // atom must come after modify, neighbor // since fixes delete callbacks in atom delete timer; }