private List < Integer > getFreeValenciesForRingGroup ( IAtomContainer molecule , List < Integer > atomsToCheck , Matrix M , IRingSet rs ) { List < Integer > fvtc = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < atomsToCheck . size ( ) ; i ++ ) { int j = atomsToCheck . get ( i ) ; //Put in an implicit hydrogen atom for Planar3 C- atoms in 5-membered rings (it doesn't get put in by the Smiles parser) if ( ( "C" . equals ( molecule . getAtom ( j ) . getSymbol ( ) ) ) && ( molecule . getAtom ( j ) . getHybridization ( ) == Hybridization . PLANAR3 ) ) { //Check that ring containing the atom is five-membered for ( IAtomContainer ac : rs . atomContainers ( ) ) { if ( ac . contains ( molecule . getAtom ( j ) ) ) { if ( ( int ) molecule . getBondOrderSum ( molecule . getAtom ( j ) ) == 2 && ac . getAtomCount ( ) == 5 ) { molecule . getAtom ( j ) . setImplicitHydrogenCount ( 1 ) ; break ; } } } } int implicitH = 0 ; if ( molecule . getAtom ( j ) . getImplicitHydrogenCount ( ) == null ) { CDKHydrogenAdder ha = CDKHydrogenAdder . getInstance ( molecule . getBuilder ( ) ) ; try { ha . addImplicitHydrogens ( molecule , molecule . getAtom ( j ) ) ; implicitH = molecule . getAtom ( j ) . getImplicitHydrogenCount ( ) ; } catch ( CDKException e ) { //No need to do anything because implicitH already set to 0 } } else { implicitH = molecule . getAtom ( j ) . getImplicitHydrogenCount ( ) ; } fvtc . add ( molecule . getAtom ( j ) . getValency ( ) - ( implicitH + ( int ) molecule . getBondOrderSum ( molecule . getAtom ( j ) ) ) + M . sumOfRow ( i ) ) ; } return fvtc ; }
Function to set up an array of integers corresponding to indicate how many free valencies need fulfilling for each atom through ring bonds .