neighbor lists, distance and PBC

Dear all,

I have been trying to write a fix that impose a charge transfer,
distance-dependent, between neighbor atoms of given types (source
files enclosed). It is obviously not working since when it is used the
system does not remain charge neutral. The problem seems to arise at
the periodic boundaries of the system, so I guess there is something I
don't understand about the way periodic boundary conditions are taken
into account in neighbor lists.

Specifically, in the double loop over the (half) neighbor list where
the distance is computed, which can be found in every pair style, and
also for instance in fix_bond_create/swap..., I don't understand how
the PBC are taken into account since the distance doesn't seem to be
computed modulo the box size. Where am I missing something?

Best regards,
Laurent

fix_qeq_da.cpp (4.71 KB)

fix_qeq_da.h (1.12 KB)

Dear all,

I have been trying to write a fix that impose a charge transfer,
distance-dependent, between neighbor atoms of given types (source
files enclosed). It is obviously not working since when it is used the
system does not remain charge neutral. The problem seems to arise at
the periodic boundaries of the system, so I guess there is something I
don't understand about the way periodic boundary conditions are taken
into account in neighbor lists.

Specifically, in the double loop over the (half) neighbor list where
the distance is computed, which can be found in every pair style, and
also for instance in fix_bond_create/swap..., I don't understand how
the PBC are taken into account since the distance doesn't seem to be
computed modulo the box size. Where am I missing something?

perhaps the fact that ghost atoms are copies?

if you want to uniquely access specific atoms,
you have to examine their "tag" value.

axel.

And the PBC effects are added/subtracted when
the ghost atoms are communicated in methods
like pack_comm() in atom_vec_atomic.cpp.

Steve

Thanks... Before I try to reinvent fire, could you tell me what do you
think would be the best (=simplest) approach to change the charge of
each real atom once and once only, according to its number of
neighbors and their distance?

Best,
Laurent

Not 100% clear on what you are asking, but several
fixes work with this kind of info. Clearly the existing
qeq fixes do something like this: fix qeq/reax and
fix qeq/comb.

More generally, I think you want the fix to operate
only on the processors local atoms. Then there
is no ambiguity about ghost atoms. A fix can request
and use a half or full neighbor list. In the case of
full, each atom will know all its neighbors, whether
they are owned or ghost. In the case of half,
you might have to do some communication with
ghost atoms to aquire info about a neighbor's
atoms that is doesnt know about, similar to
the way an EAM potential does.

Either way, if your charge assignment scheme
is iterative, then you will need to do ghost communication
(possibly forward and reverse) in the fix to be
consistent between atoms and their ghost images.
Again several fixes do this.

Steve

Thanks a lot, requesting a full neighbor list did the trick!

On a related subject, I didn't find a simple way to plot charge
profiles using fix ave/spatial. Would it be possible to add the charge
in atom values for variables? It would be interesting to deal with
every fixes affecting atom charge...

Best regards,
Laurent

You can do this by using compute property/atom and
handing the compute to fix ave/spatial.

Steve