private static boolean isEndOfDoubleBond ( IAtomContainer container , IAtom atom , IAtom parent , boolean [ ] doubleBondConfiguration ) { if ( container . indexOf ( container . getBond ( atom , parent ) ) == - 1 || doubleBondConfiguration . length <= container . indexOf ( container . getBond ( atom , parent ) ) || ! doubleBondConfiguration [ container . indexOf ( container . getBond ( atom , parent ) ) ] ) { return false ; } int hcount ; if ( atom . getImplicitHydrogenCount ( ) == CDKConstants . UNSET ) hcount = 0 ; else hcount = atom . getImplicitHydrogenCount ( ) ; int lengthAtom = container . getConnectedAtomsList ( atom ) . size ( ) + hcount ; if ( parent . getImplicitHydrogenCount ( ) == CDKConstants . UNSET ) hcount = 0 ; else hcount = parent . getImplicitHydrogenCount ( ) ; int lengthParent = container . getConnectedAtomsList ( parent ) . size ( ) + hcount ; if ( container . getBond ( atom , parent ) != null ) { if ( container . getBond ( atom , parent ) . getOrder ( ) == Order . DOUBLE && ( lengthAtom == 3 || ( lengthAtom == 2 && atom . getSymbol ( ) . equals ( "N" ) ) ) && ( lengthParent == 3 || ( lengthParent == 2 && parent . getSymbol ( ) . equals ( "N" ) ) ) ) { List < IAtom > atoms = container . getConnectedAtomsList ( atom ) ; IAtom one = null ; IAtom two = null ; for ( IAtom conAtom : atoms ) { if ( ! conAtom . equals ( parent ) && one == null ) { one = conAtom ; } else if ( ! conAtom . equals ( parent ) && one != null ) { two = conAtom ; } } String [ ] morgannumbers = MorganNumbersTools . getMorganNumbersWithElementSymbol ( container ) ; if ( ( one != null && two == null && atom . getSymbol ( ) . equals ( "N" ) && Math . abs ( giveAngleBothMethods ( parent , atom , one , true ) ) > Math . PI / 10 ) || ( ! atom . getSymbol ( ) . equals ( "N" ) && one != null && two != null && ! morgannumbers [ container . indexOf ( one ) ] . equals ( morgannumbers [ container . indexOf ( two ) ] ) ) ) { return ( true ) ; } else { return ( false ) ; } } } return ( false ) ; }
Says if an atom is the end of a double bond configuration