@ Override public DescriptorValue calculate ( IAtomContainer container ) { int c1sp1 = 0 ; int c2sp1 = 0 ; int c1sp2 = 0 ; int c2sp2 = 0 ; int c3sp2 = 0 ; int c1sp3 = 0 ; int c2sp3 = 0 ; int c3sp3 = 0 ; int c4sp3 = 0 ; for ( IAtom atom : container . atoms ( ) ) { if ( ! atom . getSymbol ( ) . equals ( "C" ) && ! atom . getSymbol ( ) . equals ( "c" ) ) continue ; List < IAtom > connectedAtoms = container . getConnectedAtomsList ( atom ) ; int cc = 0 ; for ( IAtom connectedAtom : connectedAtoms ) { if ( connectedAtom . getSymbol ( ) . equals ( "C" ) || connectedAtom . getSymbol ( ) . equals ( "c" ) ) cc ++ ; } IBond . Order maxBondOrder = getHighestBondOrder ( container , atom ) ; if ( maxBondOrder == IBond . Order . TRIPLE && cc == 1 ) c1sp1 ++ ; else if ( maxBondOrder == IBond . Order . TRIPLE && cc == 2 ) c2sp1 ++ ; else if ( maxBondOrder == IBond . Order . DOUBLE && cc == 1 ) c1sp2 ++ ; else if ( maxBondOrder == IBond . Order . DOUBLE && cc == 2 ) c2sp2 ++ ; else if ( maxBondOrder == IBond . Order . DOUBLE && cc == 3 ) c3sp2 ++ ; else if ( maxBondOrder == IBond . Order . SINGLE && cc == 1 ) c1sp3 ++ ; else if ( maxBondOrder == IBond . Order . SINGLE && cc == 2 ) c2sp3 ++ ; else if ( maxBondOrder == IBond . Order . SINGLE && cc == 3 ) c3sp3 ++ ; else if ( maxBondOrder == IBond . Order . SINGLE && cc == 4 ) c4sp3 ++ ; } IntegerArrayResult retval = new IntegerArrayResult ( 9 ) ; retval . add ( c1sp1 ) ; retval . add ( c2sp1 ) ; retval . add ( c1sp2 ) ; retval . add ( c2sp2 ) ; retval . add ( c3sp2 ) ; retval . add ( c1sp3 ) ; retval . add ( c2sp3 ) ; retval . add ( c3sp3 ) ; retval . add ( c4sp3 ) ; return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , retval , getDescriptorNames ( ) ) ; }
Calculates the 9 carbon types descriptors