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