private void bondAtom ( IAtomContainer container , IAtom atom ) { double myCovalentRadius = atom . getCovalentRadius ( ) ; double searchRadius = myCovalentRadius + maxCovalentRadius + bondTolerance ; Point tupleAtom = new Point ( atom . getPoint3d ( ) . x , atom . getPoint3d ( ) . y , atom . getPoint3d ( ) . z ) ; for ( Bspt . EnumerateSphere e = bspt . enumHemiSphere ( tupleAtom , searchRadius ) ; e . hasMoreElements ( ) ; ) { IAtom atomNear = ( ( TupleAtom ) e . nextElement ( ) ) . getAtom ( ) ; if ( ! atomNear . equals ( atom ) && container . getBond ( atom , atomNear ) == null ) { boolean bonded = isBonded ( myCovalentRadius , atomNear . getCovalentRadius ( ) , e . foundDistance2 ( ) ) ; if ( bonded ) { IBond bond = atom . getBuilder ( ) . newInstance ( IBond . class , atom , atomNear , IBond . Order . SINGLE ) ; container . addBond ( bond ) ; } } } }
Rebonds one atom by looking up nearby atom using the binary space partition tree .