public static Atom [ ] findNearestAtomLinkage ( final Group group1 , final Group group2 , List < String > potentialNamesOfAtomOnGroup1 , List < String > potentialNamesOfAtomOnGroup2 , final boolean ignoreNCLinkage , double bondLengthTolerance ) { List < Atom [ ] > linkages = findAtomLinkages ( group1 , group2 , potentialNamesOfAtomOnGroup1 , potentialNamesOfAtomOnGroup2 , ignoreNCLinkage , bondLengthTolerance ) ; Atom [ ] ret = null ; double minDistance = Double . POSITIVE_INFINITY ; for ( Atom [ ] linkage : linkages ) { double distance ; distance = Calc . getDistance ( linkage [ 0 ] , linkage [ 1 ] ) ; if ( distance < minDistance ) { minDistance = distance ; ret = linkage ; } } return ret ; }
Find a linkage between two groups within tolerance of bond length from potential atoms .