public static double getDBE ( IMolecularFormula formula ) throws CDKException { int valencies [ ] = new int [ 5 ] ; IAtomContainer ac = getAtomContainer ( formula ) ; AtomTypeFactory factory = AtomTypeFactory . getInstance ( "org/openscience/cdk/config/data/structgen_atomtypes.xml" , ac . getBuilder ( ) ) ; for ( int f = 0 ; f < ac . getAtomCount ( ) ; f ++ ) { IAtomType [ ] types = factory . getAtomTypes ( ac . getAtom ( f ) . getSymbol ( ) ) ; if ( types . length == 0 ) throw new CDKException ( "Calculation of double bond equivalents not possible due to problems with element " + ac . getAtom ( f ) . getSymbol ( ) ) ; // valencies[(int) (types[0].getBondOrderSum() + ac.getAtom(f).getFormalCharge())]++; valencies [ types [ 0 ] . getBondOrderSum ( ) . intValue ( ) ] ++ ; } return 1 + ( valencies [ 4 ] ) + ( valencies [ 3 ] / 2 ) - ( valencies [ 1 ] / 2 ) ; }
Returns the number of double bond equivalents in this molecule .