A region within a group

Hi,

i'm trying to define a region within a group of atoms, and i wonder whether this is doable.

Briefly, i have a chunk of atoms on top of a substrate. Both are hot. I want to monitor how the atoms in the chunk and closer to the substrate rearranges as the MD proceeds.

To do this, i have defined a region with a certain range. Initially, the region only includes substrate atoms, however, as the MD proceeds, substrate atoms sneak in and cloud the results. I could play with the range so as to insure that this does not happen, but it seems arbitrary and prone to error (substrate atoms could sneak in and i might not be able to notice).

So i'd like to define the region with the same range but in such a way that it'll exclude the atoms of the substrate, and include only the atoms of the chunk.

Is this doable?

Thanks
Miguel

Hi,

i'm trying to define a region within a group of atoms, and i wonder whether this is doable.

Briefly, i have a chunk of atoms on top of a substrate. Both are hot. I want to monitor how the atoms in the chunk and closer to the substrate rearranges as the MD proceeds.

To do this, i have defined a region with a certain range. Initially, the region only includes substrate atoms, however, as the MD proceeds, substrate atoms sneak in and cloud the results. I could play with the range so as to insure that this does not happen, but it seems arbitrary and prone to error (substrate atoms could sneak in and i might not be able to notice).

So i'd like to define the region with the same range but in such a way that it'll exclude the atoms of the substrate, and include only the atoms of the chunk.

Is this doable?

yes and no. a region is a region and has nothing to do with groups.
however, you can compute the intersection of a group and a region, eg.
with atom style variables, which have mask functions for that.

axel.

Axel,

thanks.

I believe you mean this:

What’s the error message you’re seeing?

I tried these commands and got a segfault, which might indicate a bug:

group group1 id 1
region region1 block INF INF INF INF INF INF
variable 1 atom grmask(group1,region1)
group inside variable 1

Seems to me that it should work, but doesn’t. So it isn’t clear to me that the error is in your input commands.

Paul

What's the error message you're seeing?

I tried these commands and got a segfault, which might indicate a bug:

group group1 id 1
region region1 block INF INF INF INF INF INF
variable 1 atom grmask(group1,region1)
group inside variable 1

Seems to me that it should work, but doesn't. So it isn't clear to me that
the error is in your input commands.

it is a bug in LAMMPS. there is a typo in the parser for atom variable
functions. this one line change fixes it.

[[email protected] src]$ git diff
diff --git a/src/variable.cpp b/src/variable.cpp
index 5c94195..d714e65 100644
--- a/src/variable.cpp
+++ b/src/variable.cpp
@@ -3233,7 +3233,7 @@ int Variable::special_function(char *word, char *contents,
     int iregion = region_function(arg2);

     Tree *newtree = new Tree();
- newtree->type = RMASK;
+ newtree->type = GRMASK;
     newtree->ivalue1 = group->bitmask[igroup];
     newtree->ivalue2 = iregion;
     newtree->left = newtree->middle = newtree->right = NULL;

axel.

Paul, Axel,

Thanks!

Miguel

I’ve updated the main repository accordingly. Thanks Axel!

Paul

Thanks.

One more question regarding this issue.

Doing this:

Thanks.

One more question regarding this issue.

Doing this:
----
group group1 id 1
region region1 block INF INF INF INF INF INF
variable 1 atom grmask(group1,region1)
group inside variable 1
----

Assigns a particular number of atoms to the group "inside". Now, this seems to be a fixed number of atoms, i.e. it does not change during the simulation. This is similar to the "region style" definition within group command. In this case, the manual says:

---
The region style puts all atoms in the region volume into the group. Note that this is a static one-time assignment. The atoms remain assigned (or not assigned) to the group even in they later move out of the region volume.
---

I'm interested on having a "dynamic assignment".

this is not possible.

Using the variable style within the group command does not allow, it seems, to do a dynamic assignment. An option could be to re-define the variable for particular time-steps during the MD run. I understand it's ok to redefine atom-style variables within a script. But, how can one redefine the variable for specific time steps, or for all of them for that matter?

that is not the right way to look at it. if you want to compute some
property that requires a looping over a variable size atoms, you would
define an atom style variable for that and in that formula (variables
are evaluated "fresh" when using the v_name syntax) you can multiply
the result with grmask() and then you have only the contributions from
the intersection of group and region. if you when use compute reduce,
you can turn this into a global property.

as a general issue, having dynamical groups would make a lot of common
tasks needlessly time consuming and badly affect parallel scaling for
all those cases, where this is not needed. so it is not done, but you
can define those by yourself or write a custom compute, if needed. if
a feature would negatively affect the performance of the (more) common
case, then it is usually not implemented directly, but requires extra
work from the user.

axel.

axel.