Atom Id s,

Dear Axel,
Thanks for your response,

1-I have a neighbour list and keep only the 12 nearest neighbour atoms every time but the id(say m here) will be local. m= nbr[i].id[j], I thought that when I apply force f[m] to atom m it would be applied to the equivalent atom inside the simulation cell because of PBC.
but it wouldn’t. I thought the problem should be solved by some sort of mapping the id and it should be simple, but the only solution I found was tag[i]-1 that apparently works for the wrong reason, is there any other simple mapping that takes m and gives the equivalent id inside the cell?

2- In general If I wanted to say add force to an atom would I use its local id or global id?

3-I see that pair_style hybrid/overlay is usually used to apply multiple potentials, can you elaborate a bit more how it can be helpful in addressing my issue?

4-Is there any way other than checking this mailing list to learn more about details of lammps atom ids, domain decomposition, any documentation maybe?
Sorry for asking too many question!
Thanks again,
Sherri,

From: Shahrzad Hadian <[email protected]>
Date: Thu, Jun 5, 2014 at 12:28 PM
Subject: Re: [lammps-users] Atom Id s,
To: Axel Kohlmeyer <[email protected]>

Dear Axel,
Thanks for your response,

1-I have a neighbour list and keep only the 12 nearest neighbour atoms
every time but the id(say m here) will be local. m= nbr[i].id[j], I thought
that when I apply force f[m] to atom m it would be applied to the
equivalent atom inside the simulation cell because of PBC.
but it wouldn't. I thought the problem should be solved by some sort of
mapping the id and it should be simple, but the only solution I found was
tag[i]-1 that apparently works for the wrong reason, is there any other
simple mapping that takes m and gives the equivalent id inside the cell?

​what you speculate is irrelevant. you cannot write a piece of code based
on speculation. you have to *know*. if you don't you have to study existing
code unless you understand.

the way how you would do the processing of the 12 nearest neighbors​, is to
request an additional (full?) neighborlist with a suitable cutoff
(including a safety margin) and then process it into a list with only the
12 nearest list and then loop over that list. a few existing pair styles,
e.g. several many-body pair styles do similar things. everything else is
not compatible with how LAMMPS handles parallelization and is doomed to
fail very badly. it also is very likely not very efficient.

2- In general If I wanted to say add force to an atom would I use its
local id or global id?

the force arrays are arranged by the local id. LAMMPS is using a
distributed memory parallelization.​

3-I see that pair_style hybrid/overlay is usually used to apply multiple
potentials, can you elaborate a bit more how it can be helpful in
addressing my issue?

​you want to add a force to an atom that is dependent on its neighbors.
pairwise potentials are ​forces on each atoms that are dependent on the
individual distances of its neighbors, so it is a very similar problem.

4-Is there any way other than checking this mailing list to learn more
about details of lammps atom ids, domain decomposition, any documentation
maybe?

i mentioned the mailing list, because the questions you were asking have
already been answered there several times. do you need *me* to look it up
for you, so you can solve *your* problem?? also, ​there is a *lot* of
material​ posted on the LAMMPS homepage and bundled in the LAMMPS
distribution and last but not least there is the sources code. many parts
are very readable and well commented.

in general, you won't find a document that will tell you right up front all
of the steps that you need to do. you have to do some of the legwork
yourself. but in order to be successful in this, you have to reverse your
approach. rather than forcing your assumptions onto the LAMMPS code, you
should look at how similar problems are solved and then use those as guide
and adapt to your own needs.

Sorry for asking too many question!

​not a problem, if you pay attention, learn from them and come back with
better questions.​ :wink:

​axel.​

You should always access atoms and their properties by their local ID.

You can apply forces to atoms that way.

However, a proc may then apply it to a ghost atom, owned
by another proc. Atoms across the PBC can be ghost atoms,
even if running on one proc. To translate forces on ghost
atoms back on to the real, owned atom (on whatever proc
owns it), you need to do “reverse communication”. Many
pair styles and fixes do this.

Steve

Thank you very much Steve , that’s exactly what I was asking for, I’ll look into it now,

Dear Axel,
Thanks for your response,

1-I have a neighbour list and keep only the 12 nearest neighbour atoms
every time but the id(say m here) will be local. m= nbr[i].id[j], I thought
that when I apply force f[m] to atom m it would be applied to the
equivalent atom inside the simulation cell because of PBC.
but it wouldn't. I thought the problem should be solved by some sort of
mapping the id and it should be simple, but the only solution I found was
tag[i]-1 that apparently works for the wrong reason, is there any other
simple mapping that takes m and gives the equivalent id inside the cell?

​what you speculate is irrelevant. you cannot write a piece of code based
on speculation. you have to *know*. if you don't you have to study existing
code unless you understand.

the way how you would do the processing of the 12 nearest neighbors​, is
to request an additional (full?) neighborlist with a suitable cutoff
(including a safety margin) and then process it into a list with only the
12 nearest list and then loop over that list. a few existing pair styles,
e.g. several many-body pair styles do similar things. everything else is
not compatible with how LAMMPS handles parallelization and is doomed to
fail very badly. it also is very likely not very efficient.

​*Thanks, I already have the sorted 12 NN within a cut-off in an

existing code, I think my question was much simpler than you thought.*
*I now understand from Steve P's answer that I need reverse communication
to apply force to ghost atoms(across PBC).*

2- In general If I wanted to say add force to an atom would I use its

local id or global id?

the force arrays are arranged by the local id. LAMMPS is using a
distributed memory parallelization.​

3-I see that pair_style hybrid/overlay is usually used to apply multiple
potentials, can you elaborate a bit more how it can be helpful in
addressing my issue?

​you want to add a force to an atom that is dependent on its neighbors.

​*Not exactly but thanks.​*

pairwise potentials are ​forces on each atoms that are dependent on the
individual distances of its neighbors, so it is a very similar problem.

4-Is there any way other than checking this mailing list to learn more
about details of lammps atom ids, domain decomposition, any documentation
maybe?

i mentioned the mailing list, because the questions you were asking have
already been answered there several times. do you need *me* to look it up
for you, so you can solve *your* problem?? also, ​there is a *lot* of
material​ posted on the LAMMPS homepage and bundled in the LAMMPS
distribution and last but not least there is the sources code. many parts
are very readable and well commented.

in general, you won't find a document that will tell you right up front
all of the steps that you need to do. you have to do some of the legwork
yourself. but in order to be successful in this, you have to reverse your
approach. rather than forcing your assumptions onto the LAMMPS code, you
should look at how similar problems are solved and then use those as guide
and adapt to your own needs.

*​with all due respect sir, I think you misunderstood both my question and
my approach to solving it ! :-)​*

Compute coord/atom and fix orient/fcc are

2 example style classses that request and
use full neighbor lists to find a set of nearest
neighbors.

Steve