region->match() and periodic boundary conditions

Dear Lammps users and developers,

I had a look at the method region->match(x,y,z) in region.cpp and I am not entirely sure, how I am supposed to use it correctly in combination with periodic boundary conditions.

In particular, it seems that region->match() does not check whether the remapped coordinates are inside the region (or at least the method inside() doesn’t). Therefore, in a fully periodic system I would be inclined to use domain->remap() first and then pass the result on to region->match(), if I wanted to know, whether an atom is contained in a region.

The reason why I am confused is that I had a look at the implementations of other fixes/functions (e.g. fix_heat->end_of_step() or group->ke(groupid, regionid)) and I saw that no prior remapping is carried out. Is this not necessary in end_of_step()-methods?

Thanks,

Peter

Dear Lammps users and developers,

I had a look at the method region->match(x,y,z) in region.cpp and I am not
entirely sure, how I am supposed to use it correctly in combination with
periodic boundary conditions.
In particular, it seems that region->match() does not check whether the
remapped coordinates are inside the region (or at least the method inside()
doesn't). Therefore, in a fully periodic system I would be inclined to use
domain->remap() first and then pass the result on to region->match(), if I
wanted to know, whether an atom is contained in a region.

The reason why I am confused is that I had a look at the implementations of
other fixes/functions (e.g. fix_heat->end_of_step() or group->ke(groupid,
regionid)) and I saw that no prior remapping is carried out. Is this not
necessary in end_of_step()-methods?

it not necessary, because it "isn't in the contract". from the region
command documentation:

IMPORTANT NOTE: Regions in LAMMPS do not get wrapped across periodic
boundaries, as specified by the "boundary"_boundary.html command. For
example, a spherical region that is defined so that it overlaps a
periodic boundary is not treated as 2 half-spheres, one on either side
of the simulation box.

so you have to choose your region smartly. if you want to have a
region wrap around a box boundary, you need to combine two regions
with INF bounds where they wrap around the box.

axel.

Hi Axel,

thanks for clarifying!

Best regards,
Peter