bufferGridPoint2PointAcceleration - ProkopHapala/SimpleSimulationEngine GitHub Wiki

Description

Algorithm for acceleration of point-to-point radial short range interaction bounded by maximum interaction range R_MAX. Typical use is for molecule-molecule interaction. The idea is to project interaction bounding spheres of atoms iatom of the molecule imol to rectangular grid. Than for all interaction partners (molecules jmol) for each of its atom jatom current box is evaluated, and only interactions with iatom projected to that grid box is evaluated.

Pseudo code

for imol in molecules :
   gridBuff.clean()
   gridBuff.setBounds(imol)
   iatoms = imol.getAtomsWorldSpace()
   gridBuff.projectMoleculeToBox( iatoms )
   for jmol < imol :
      if ( not gridBuff.overlap(jmol.bounds) ) continue
      jatoms = jmol.getAtomsWorldSpace()
      for jatom in jatoms :
          if (not gridBuff.pointIn(jatom) ) continue
          icell = gridBuff.getCell(jatom)
          for iatom in gridBuff.getAtom(icell) :
               interact(iatom,jatom)

Properties & considerations

  • GridBuffer is allocated usually once for whole systems, so the parameters like Lbox,nx,ny,nz,nAtomPerCell are common for all molecules
  • Box size Lbox should be set according to Rmax such that each interaction bounding sphere overlap at max 8 boxes (or 4 in 2D). This means that box is enclosing the sphere or in other words Lbox > 2*Rmax
  • Memory consumption is quite large, nx*ny*nz*nAtomPerCell
    • nx,ny,nz can be reduced by larger grid spacing (increasing Lmax), but than nAtomPerCell grows for riven Rmax
  • GridBuffer acceleration is efficient if the same inserted molecule is used many times (for interactions with several other jmols). Therefore it is good to put large molecules first in list (since jmol < imol)