group/group and compute property/atom atom-style variable problem

Hello all

I just got some problems when use “group/group” to calculate force between two groups

A large box is built fully with water molecule , and region “cal” smaller than the box is created . One graphene layer is inside the region . I use “compute group/group” to calculate force between graphene and water inside the region , so that "dynamic group region cal " is also needed. The problem is when some water molecules straddle the region boundary , the force calculated is just with the atoms inside the region ,and the coulomb force between atoms inside the region of these water molecules and graphene is quite large that couldn’t ignore. Finally ,the total force is not right. If is there any way could handle this problem.

region cal block INF INF INF INF 149 234 #box is quite big
group h2o type 5 6
group h2o_cal dynamic h2o region cal
compute 1 h2o_cal group/group ban kspace yes

Then , I try “compute property/atom” and “variable” command.

group oo type 5 # 5 the oxygen type
group h2o_cal dynamic oo region cal
compute mm h2o_cal property/atom mol # get the molecule id of water molecule
variable mm2 atom mol[c_mm]
group water dynamic all var mm2

Atom-style variable here does not work , and mol[c_mm] may be wrong style , but I don’t know how to use “atom-style variable” to link with "compute mm h2o_cal property/atom mol ".

Help please !!

Thanks,
Dai
Nanjing Technology University

Not sure what you are trying to do with the atom-style variable.

The problem here is that dynamic groups do not have an

option to include atoms outside the region in the group if any other atom in

the same molecule is in the region.

There is a group include molecule command that does

that, but it is for static groups. It is also an expensive

operation, that requires communication among all

processors (think of a long polymer chain that spans
many procs). So I’m not sure its a good idea to have

an option to invoke it as part of dynamic groups, e.g.

every timestep. But it would be possible to enable

that as an option.

Another idea is to compute these group/group forces

as a post-processing step via the rerun command.

In that script you could read a snapshot, set up

2 static groups using group include molecule for

the atoms you want, and compute the eng/forces

between the groups.

Axel - what do you think?

Steve

Thanks for your reply!

I know ”group include command" for static groups . However ,it does not work for dynamic groups. As you say ,it could be possible to enable the option. How could I do that ? I am not familiar with C/C++ code , if compiling the group.cpp needed?

Thanks for another idea! But I need to compute that every 2 fs for 0.5ns without dump as dump atom is too large.

I use “compute property/atom mol” command to get molecule ID of oxygen atoms inside the region. Then ,I want to set these molecules as variable “mm2” by “atom-style variable” command. Finally, group these water molecules by “group water dynamic all var mm2” . But the variable command don’t work well. How could the per-atom value “c_mm” be set to an variable?

group oo type 5 # 5 the oxygen type
group h2o_cal dynamic oo region cal
compute mm h2o_cal property/atom mol # get the molecule id of water molecule
variable mm2 atom mol[c_mm]
group water dynamic all var mm2

Not sure what you are trying to do with the atom-style variable.

The problem here is that dynamic groups do not have an
option to include atoms outside the region in the group if any other atom
in
the same molecule is in the region.

There is a group include molecule command that does
that, but it is for static groups. It is also an expensive
operation, that requires communication among all
processors (think of a long polymer chain that spans
many procs). So I'm not sure its a good idea to have
an option to invoke it as part of dynamic groups, e.g.
every timestep. But it would be possible to enable
that as an option.

Another idea is to compute these group/group forces
as a post-processing step via the rerun command.
In that script you could read a snapshot, set up
2 static groups using group include molecule for
the atoms you want, and compute the eng/forces
between the groups.

Axel - what do you think?

​this is one of several applications that pop up occasionally where people
want to use groups for something that would be better done differently.

so i've been wondering, if it wouldn't be useful if we would start porting
some of the group based features to using the chunk infrastructure instead.
for example we could have a compute group/chunk, and you'd be computing the
force/energy between the reference group and each (active) chunk. creating
a chunk assignment that includes a whole molecule when one of the
constituent atoms is selected by whatever criterion would possibly easier
to doing the dynamic group thing for those, and useful for multiple
applications (if it is not already possible).

axel.

Thanks for your reply!

I know ”group include command" for static groups . However ,it does not
work for dynamic groups. As you say ,it could be possible to enable the
option. How could I do that ? I am not familiar with C/C++ code , if
compiling the group.cpp needed?

Thanks for another idea! But I need to compute that every 2 fs for 0.5ns
without dump as dump atom is too large.

​data at timesteps so close to each other is highly correlated and thus has
very little statistical relevance.​ what is the purpose of this computation?

axel.

This is a test . I want to calculate time correlation function ,for example the solid-liquid friction coefficient which is calculated from the frictional force auto-correlation function, following the Green-Kubo formulation

But I think the complication here is he wants

one of the groups to be only molecules near

the graphene surface, i.e. in a region that

bounds the surface.

Since water molecules move in/out of that region,

you need both the region condition and the whole

molecule condition to be met. I think the logic

is equally complicated whether you try to do it

with a dynamic group vs a dynamic chunk.

However, I agree with Axel that it would be good

to think of another way around what you want to

compute. Or do it initially via post-processing

to see if you can actually compute something useful.

Steve

But I think the complication here is he wants
one of the groups to be only molecules near
the graphene surface, i.e. in a region that
bounds the surface.

Since water molecules move in/out of that region,
you need both the region condition and the whole
molecule condition to be met. I think the logic
is equally complicated whether you try to do it
with a dynamic group vs a dynamic chunk.

​i was thinking that when you have to assign the chunk ids, you already
have to have communication and there it might be possible to have a pass
over the assembled data to merge chunks that have bonds between them
without having to do additional communication. ​

However, I agree with Axel that it would be good
to think of another way around what you want to
compute. Or do it initially via post-processing
to see if you can actually compute something useful.

​yeah, particularly the notion that this data should go into computing time
correlation functions is worrisome. with molecules entering and leaving the
region, you have additional (significant) perturbations​ due to this, which
can taint the correlation function data. this will be the larger, the
smaller the group/region is, and thus results will likely depend on the
definition of that region. at that point, i would look into making things
more consistent by looking at regions large enough, so that the
perturbations are small, which in turn should also reduce the artifact of
not considering entire molecules less important.