Modification of pair style

Dear all,

I am trying to modify the dpd pair style so as to calculate the total force exerted by one type of atoms upon all other atom types. I want to store the result in a per-atom vector defined using fix property/atom and access the information using a custom fix called at the end of each time-step. If I run with both newton flags on, the force acting upon an atom may be calculated by a processor other than the one to which it belongs. Therefore, what do I need to do to ensure that the forces I am calculating are correctly communicated between processors?

Best,

Karthik.

***DISCLAIMER*** The sender of this email is an alumnus of National University of Singapore (NUS). Kindly note that NUS is not responsible for the contents of this email, and views and opinions expressed are solely the sender's.

Dear all,

I am trying to modify the dpd pair style so as to calculate the total force exerted by one type of atoms upon all other atom types. I want to store the result in a per-atom vector defined using fix property/atom and access the information using a custom fix called at the end of each time-step. If I run with both newton flags on, the force acting upon an atom may be calculated by a processor other than the one to which it belongs. Therefore, what do I need to do to ensure that the forces I am calculating are correctly communicated between processors?

to sum data from ghost atoms to their corresponding local atoms, you
need to do what is called in LAMMPS a "reverse communication".
you can find an example for that in the eam pair style, where the
"rho" array is accumulated (which contains the sum of contributions to
a local density at the location of a specific atom from its
neighboring atoms). look for a call to comm->reverse() and at the
pack/unpack_reverse_comm() methods.

axel.

Hi,

Thanks for the clarification. This page (http://lammps.sandia.gov/doc/Section_modify.html#mod-1) mentions that custom atom properties defined using fix property/atom are vectors of length Nlocal = # of owned atoms. However, the grow_arrays method of fix property/atom contains the line " memory->grow(atom->dvector[index[m]],nmax,"atom:dvector"); ", which seems to imply that these custom attributes are vectors of length nmax instead of nlocal. May I know which is it?

In addition to calculating the forces between atom types, I also need to determine the minimum distance between an atom of a particular type and all atoms of another type. In order to reverse communicate this distance, can I simply use the unpack_reverse_comm method with the '+=" replaced by the '=' operator?

Best,

Karthik.

Hi,

Thanks for the clarification. This page (http://lammps.sandia.gov/doc/Section_modify.html#mod-1) mentions that custom atom properties defined using fix property/atom are vectors of length Nlocal = # of owned atoms. However, the grow_arrays method of fix property/atom contains the line " memory->grow(atom->dvector[index[m]],nmax,"atom:dvector"); ", which seems to imply that these custom attributes are vectors of length nmax instead of nlocal. May I know which is it?

it is nlocal (or nlocal + nghost, in case the ghost flag is set). the
use of nmax is to minimize the number of reallocations. for the same
reason arrays are only grown and not shrunk.

In addition to calculating the forces between atom types, I also need to determine the minimum distance between an atom of a particular type and all atoms of another type. In order to reverse communicate this distance, can I simply use the unpack_reverse_comm method with the '+=" replaced by the '=' operator?

this doesn't make sense. you use the reverse communication to
correctly *sum* properties collected from all neighbors.

axel.

How can I calculate the minimum distance between an atom of a particular type and all atoms of another type? Since pair styles calculate distances between pairs of particles, can it be done via a straightforward extension of the pair style that I am using?

Best,

Karthik.

the easiest approach is probably to have two neigbor list requests:
one for a half and one for a full neighbor list. pair styles meam and
meam/c do that. the full list has all neighbors regardless of the
newton_pair setting.

axel.