Mapping atoms in a custom multi-body potential

Hello,

I have implemented a new coarse-grained DNA model within LAMMPS. This model includes a multi-body pair-potential that applies forces between the pair of atoms i,j and neighboring sites on the DNA. I’ve attached an image to give you an idea of how the potential works.

As implemented, the model runs perfectly in a serial version of LAMMPS. Further investigation showed that this is to be expected given the use of atom->tag() and atom->map().

I would now like to take advantage of the MPI capability of LAMMPS. The thread below suggests that atom->tag() and atom->map() won’t work.
http://lammps.sandia.gov/threads/msg23810.html

This is what I’d like to do on each processor:

  1. Take the local ID of a site and obtain it’s global ID i.
  2. Calculate the global ID of nearby sites (e.g. i-1,i+3)
  3. Convert the global IDs of the nearby sites to local IDs
  4. Use local ID of all 3 sites in the calculation of “pair” potential

The nearby sites will always be very close to site i, so I assume that they would always be present either as local atoms or ghost atoms.

I’ve envisioned one solution where I construct a list similar to anglelist, etc. containing site i and 2 of its neighbors. This “pairlist” would be updated like the other bond lists and should, according to my limited understanding, store the local IDs of neighboring sites. However, it does not appear possible to know a priori which values in the “pairlist” to use for the pair interaction. I would have to search the list until I find the entry with a local ID that matches the local ID i used in the pair interaction.

Is this proposed solution viable? Are there other, better ways to do this in LAMMPS?

Thank you for your assistance!

Dan

basepair.pdf (442 KB)

Comments below. When you have this working,
please consider releasing it to us to include in the distro.
Sounds like it would be a nice addition.

Steve

Hello,

I have implemented a new coarse-grained DNA model within LAMMPS. This model
includes a multi-body pair-potential that applies forces between the pair of
atoms i,j and neighboring sites on the DNA. I've attached an image to give
you an idea of how the potential works.

As implemented, the model runs perfectly in a serial version of LAMMPS.
Further investigation showed that this is to be expected given the use of
atom->tag() and atom->map().

I would now like to take advantage of the MPI capability of LAMMPS. The
thread below suggests that atom->tag() and atom->map() won't work.
http://lammps.sandia.gov/threads/msg23810.html

This is what I'd like to do on each processor:

1) Take the local ID of a site and obtain it's global ID i.

this is stored in tag[i]

2) Calculate the global ID of nearby sites (e.g. i-1,i+3)
3) Convert the global IDs of the nearby sites to local IDs

atom->map[gid] will give you the local index of a global ID
but see below

4) Use local ID of all 3 sites in the calculation of "pair" potential

The nearby sites will always be very close to site i, so I assume that they
would always be present either as local atoms or ghost atoms.

I've envisioned one solution where I construct a list similar to anglelist,
etc. containing site i and 2 of its neighbors. This "pairlist" would be
updated like the other bond lists and should, according to my limited
understanding, store the local IDs of neighboring sites. However, it does
not appear possible to know a priori which values in the "pairlist" to use
for the pair interaction. I would have to search the list until I find the
entry with a local ID that matches the local ID i used in the pair
interaction.

if the atom J that is nearby to atom I is a ghost atom,
then atom->map[J] may give you an index of an atom
far away (i.e. the index of the corresponding owned (non-ghost) atom

there is a function domain->closest_image(i,j) which will give
you the one index out of all the images of J that is closest to I,
which sounds like what you want. See neigh_bond.cpp::bond_all()
for an example of how it is used