# Defining groups of atoms give non-straight division lines.

Dear LAMMPS users,

In my input scripts, I usually define several regions, groups and types of atoms after the system box has been created and filled with atoms according to a certain lattice structure. For instance, let us say I define a region that consist of atoms with x-coordinate between 0 and 5, and another region with atoms with x-coordinate between 5 and 10. Then I create a group of the first region called "left" and a group of the second region called "right". Everything is done before any run or minimization is done, so all the atoms are perfectly placed in the initial lattice structure. Thus I expect a sharp, straight line between the different groups, with atoms of coordinate x<5.000 in group "left" and atoms of coordinate x>=5.000 in group "right". However, this is not always the case when I look at my simulations.

As shown in the attached image, along a dividing line between two groups some atoms are assigned to one group, while some are assigned to the other. By investigating the coordinates of the atoms, they have exactly the same x-coordinates, so my question is this: why do some atoms go into one group, and some to the other? Is this all due to numerical round-offs, possibly combined with a bad choice of dividing line between the two groups? This is really frustrating, since I sometimes end up with non-straight cracks (in my crack simulations), and if I have defects on a surface I get stress concentrations at these defect points. I wish, of course, to have a perfect initial structure.

By the way, this artifact appears both when running on a single processor and when running on several processors.

Do you have any explanation as to why this happens, and what I could do to solve it?

Sincerely,
Christer H. Ersland.

If you have an atom at x = 5, and you define 2 regions as you say, with their
dividing line at 5, and then invoke 2 group commands using those 2 regions,
then the atom at x = 5 will be in both regions. The definition of "inside" a
region is inside it or on the surface. The atom is on the surface of
both regions.

Your idea below of using < 5 for one region and >= 5 for the other might
work for region boundaries which are lines aligned with coordinate
axes. But it wouldn't work for anything else, e.g. a region that is a sphere.

The solution is not to define both your regions boundaries with 5.
Use 5 for one, and 5.0001
for the other.

It's easy to tell if you get the group assignment you want since
LAMMPS prints out
how many atoms got assigned to each group. If the sum != # of atoms,
you know you mis-assigned some atoms.

Steve

Dear LAMMPS users,

As shown in the attached image, along a dividing line between two groups some atoms are assigned to one group, while some are assigned to the other. By investigating the coordinates of the atoms, they have exactly the same x-coordinates, so my question is this: why do some atoms go into one group, and some to the other? Is this all due to numerical round-offs, possibly combined with a bad choice of dividing line between the two groups? This is really frustrating, since I sometimes end up with non-straight cracks (in my crack simulations), and if I have defects on a surface I get stress concentrations at these defect points. I wish, of course, to have a perfect initial structure.

those are likely to be rounding errors. you must have placed atoms
_exactly on the group boundary
and then the tiniest difference can decide for left of right. you
won't see this on output, unless you
write out positions with more than 15 digits accuracy. the problem is
the group definition. just shift
it be a few fractions of an angstrom (e.g. 4.99 or 5.01) and you should be fine.

By the way, this artifact appears both when running on a single processor and when running on several processors.

yes., atom positions are computed the same way on each processor. no
rounding involved.

axel.

I should have also mentioned that you can define a region with
the "side out" option. Atoms will only be in that region
if they are outside the region and not on the surface. So that
is perfectly opposite the definition of "inside" the region and
your atoms at x = 5 would go into one or the other of the
regions with no duplicates.

Steve