public List < Contact > getIndicesContacts ( ) { List < Contact > list = new ArrayList <> ( ) ; // if the 2 sets of atoms are not overlapping they are too far away and no need to calculate anything // this won't apply if there's only one set of atoms (iAtoms), where we would want all-to-all contacts if ( noOverlap ) return list ; for ( int xind = 0 ; xind < cells . length ; xind ++ ) { for ( int yind = 0 ; yind < cells [ xind ] . length ; yind ++ ) { for ( int zind = 0 ; zind < cells [ xind ] [ yind ] . length ; zind ++ ) { // distances of points within this cell GridCell thisCell = cells [ xind ] [ yind ] [ zind ] ; if ( thisCell == null ) continue ; list . addAll ( thisCell . getContactsWithinCell ( ) ) ; // distances of points from this box to all neighbouring boxes: 26 iterations (26 neighbouring boxes) for ( int x = xind - 1 ; x <= xind + 1 ; x ++ ) { for ( int y = yind - 1 ; y <= yind + 1 ; y ++ ) { for ( int z = zind - 1 ; z <= zind + 1 ; z ++ ) { if ( x == xind && y == yind && z == zind ) continue ; if ( x >= 0 && x < cells . length && y >= 0 && y < cells [ x ] . length && z >= 0 && z < cells [ x ] [ y ] . length ) { if ( cells [ x ] [ y ] [ z ] == null ) continue ; list . addAll ( thisCell . getContactsToOtherCell ( cells [ x ] [ y ] [ z ] ) ) ; } } } } } } } return list ; }
Returns all contacts i . e . all atoms that are within the cutoff distance as simple Contact objects containing the atom indices pairs and the distance . If both iAtoms and jAtoms are defined then contacts are between iAtoms and jAtoms if jAtoms is null then contacts are within the iAtoms .