Bond list generator implementation advice

Hello,

I'm writing a program in c++ to create a bond list generator for periodic systems to use with the read_data command, at first only for cubic systems with bonds, but later on with angles, dihedral, and impropers and general triclinic systems. I have previously created my own class for keeping track of atoms and their neighbours, but I was wondering what data structures lammps uses for storing bond, angle, dihedral, etc arrays. Where could I find these in the code, and what would be the simplest way for me to implement them in my own code?
My own incomplete code can be found at github.com/darkarconio/bondlistgenerator

Thanks,
Michal

Hello,

I'm writing a program in c++ to create a bond list generator for periodic systems to use with the read_data command, at first only for cubic systems with bonds, but later on with angles, dihedral, and impropers and general triclinic systems. I have previously created my own class for keeping track of atoms and their neighbours, but I was wondering what data structures lammps uses for storing bond, angle, dihedral, etc arrays. Where could I find these in the code, and what would be the simplest way for me to implement them in my own code?

please check out atom_vec_molecule.{cpp,h} and neigh_bond.{cpp,h}

but i don't think that following this will be helpful for your
purposes. you are likely better of using a scripting language that
makes it easy to create and manipulate lists. a lot of the stuff you
need is, for example, already in here.

https://sites.google.com/site/akohlmey/software/topotools/topotools---documentation

axel.

How would I be able to modify the algorithms used by topotools for bond
generation? To be able to find if two atoms are bonded across a cell
boundary algorithically, I need to be able to add a function of this
sort:

//Shifts the unit cell so that atoms more than 1/2 the cell length apart
are shifted to be less than 1/2 cell length apart in each dimension
Point Parameters::getRealDiff (Point & a, Point & b)
{
   Point c;
   c = (a-b);
   double sign;
   double xDel = c.scalarProj(dim(0));
   double yDel = c.scalarProj(dim(1));
   double zDel = c.scalarProj(dim(2));

   if (xDel < -mlen.x()/2 || xDel > mlen.x()/2)
   {
      sign = xDel < 0 ? 1 : -1;
      c += dim(0)*sign;
   }
   if (yDel < -mlen.y()/2 || yDel > mlen.y()/2)
   {
      sign = yDel < 0 ? 1 : -1;
      c += dim(1)*sign;
   }
   if (zDel < -mlen.z()/2 || zDel > mlen.z()/2)
   {
      sign = zDel < 0 ? 1 : -1;
      c += dim(2)*sign;
   }

   return c;
}

Thanks,
Michal

How would I be able to modify the algorithms used by topotools for bond
generation? To be able to find if two atoms are bonded across a cell
boundary algorithically, I need to be able to add a function of this
sort:

that is not what i would do.
there are basically two approaches. if you have knowledge about the
bonding topology with respect to the order of the atoms in the
coordinate file, you can just infer the entire bond topology from
that. build a list of bonds and assign them with topo setbondlist.
this way you can define any bond you want.

if you do not have this information, i would first auto-generate
(after adjusting radii as needed) the non-periodic bonds and then
locate atoms that have missing valences and then identify possible
connections between them.this will require some smart VMD scripting,
though.

axel.