Programming question regarding bond and angle

Hello all:

Right now I am working on programming a new angle style. I am stuck at how to find how many times a bond is shared among the angles.

I tried two approaches without MPI communication but could not get them to work:

  1. I thought I could loop through neighbor->anglelist and count number of appearances for each bond, but found that the anglelist only has information about local angles, so it does not work for the bonds whose atoms do not belong to the same processor.

  2. Then I thought the number of times a bond is shared equals the number of atoms bonded to each atom combined minus 2 (the atoms of the given bond itself). But It is still limited by the fact that variables atom->num_bond and atom->bond_atom are also local.

So I am wondering if there is some kind of global connectivity array that stores the global bonding information? Or I can somehow access the number of bonded atom of a ghost atom. Also, definitely let me know if you have better approaches.

Preferably I don’t want to MPI involved, because not only it affects the performance of the angle style, it also is difficult to code.

Let me know if I need to elaborate on my question more.

Thanks

Jianlan

Two comments.

a) if you think that programming MPI is difficult, you have not seen “difficult”. i regularly teach classes on parallel programming with MPI and have never seen people struggling much with the MPI programming itself. the challenge is usually the “parallel thinking”. there are other libraries and tools available that are much more complex and difficult to program in.

b) if you make your angle style require the force->newton_bond setting to be off, then the LAMMPS changes how the bond topology is stored. with newton_bond enabled, which is the default, all bonds, angles and so on are stored only once, but when it is disabled, bonds/angles/dihedrals/impropers are stored with all atoms that participate. that should give you access to the information that you are asking for.

axel.